195 | | Variables expansion could also be done using a dedicated syntax (e.g. `@INCLUDE_CONTENT@`, like [MoinMoin:HelpOnVariables MoinMoin] or [http://www.dokuwiki.org/plugin:templater plugin:templater] in dokuwiki), (to be continued...) |
| 196 | Variable expansion could also be done using a dedicated syntax (e.g. `@INCLUDE_CONTENT@`, like [MoinMoin:HelpOnVariables MoinMoin] or [http://www.dokuwiki.org/plugin:templater plugin:templater] in dokuwiki), the `{{{...}}}` style of MediaWiki conflicts with our inline verbatim style. |
| 197 | |
| 198 | The Template:ReleaseInfo page would have the following content: |
| 199 | {{{ |
| 200 | Version:: @version|unknown@ |
| 201 | {{{#!if defined="description" |
| 202 | Description:: @description@ |
| 203 | }}} |
| 204 | }}} |
| 205 | |
| 206 | Instead of `#!param`, we could also use `!#define` to create a variable that could be used in the document itself, or rather in the current scope. |
| 207 | |
| 208 | A define would not only work for defining variables but also for defining in-document templates ("macros"), unifying variables and templates. |
| 209 | |
| 210 | The example "Template:ReleaseInfo" above could be inlined: |
| 211 | {{{ |
| 212 | {{{#!define name="ReleaseInfo" |
| 213 | Version:: @version|unknown@ |
| 214 | {{{#!if defined="description" |
| 215 | Description:: @description@ |
| 216 | }}} |
| 217 | }}} |
| 218 | }}} |
| 219 | And would be called: |
| 220 | {{{ |
| 221 | {{{#!include name=".#ReleaseInfo" version="2.0" description="not there yet" |
| 222 | }}} |
| 223 | }}} |
| 224 | or simpler: |
| 225 | - `[[Include(#ReleaseInfo, version=2.0, description=not there yet)]]` |
| 226 | - `{{#ReleaseInfo|version=2.0|description=not there yet}}` (MediaWiki:Help:Template) |
| 227 | Note that `.#abc` and `#abc` are targeting the same node. |
| 228 | |
| 229 | "Define" could also be used for much small repetitive text, like repetitive URLs, when one doesn't want to define an InterWiki prefix for it, e.g. |
| 230 | - |
| 231 | `[[Define(issue=http://bugs.python.org/issue@1@)]]` and `{{issue|1234}}` |
| 232 | - `@issue=http://bugs.python.org/issue{{1}}@` (?) |
| 233 | - `@issue=http://bugs.python.org/issue@` and `@issue@1234` (?) |
| 234 | |
| 235 | In summary, we would have the following constructions: |
| 236 | || ||= Define =||= Include =|| |
| 237 | {{{#!th rowspan=2 |
| 238 | Dedicated Wiki Syntax |
| 239 | }}} |
| 240 | || `@<name>=value@` ? || `@<name>@` or `@<name>|default@` || |
| 241 | || `{{<name>=value}}` ? || `{{<name>}}` or `{{<name>|p1|p=val}}` || |
| 242 | ||= Macro ||\ |
| 243 | || `[[Define(<name>=<content>)]]` ||\ |
| 244 | || `[[Include(<name>)]]` || |
| 245 | ||= WikiProcessor ||\ |
| 246 | {{{#!td |
| 247 | {{{ |
| 248 | {{{#!define name="<name>" p="default" |
| 249 | ... |
| 250 | }}} |
| 251 | }}} |
| 252 | }}} |
| 253 | {{{#!td |
| 254 | {{{ |
| 255 | {{{#!include name="<name>" p="value" |
| 256 | ... |
| 257 | }}} |
| 258 | }}} |
| 259 | }}} |
| 260 | Defines should of course be able to contain anything, including other transclusions. Includes can contain defines, as a way to pass complex input parameters which can also contain anything, including other transclusions. |
| 261 | |
| 262 | A technical difficulty with the short form for transclusion `{{...}}` is the need to handle the nesting of `{{...}}` pairs, to allow for multiple level of expansion, like shown in [http://meta.wikimedia.org/wiki/Help:Advanced_templates advanced templates] in MediaWiki. |
| 263 | |
| 264 | The `<name>` parameter given to includes should itself be subject to expansion , and if this corresponds to an unbound variable, the inclusion will be dynamic (parsing deferred to the formatting stage). |
| 265 | //Or should parsing always be deferred?//. |
| 266 | |
| 267 | Recursion should be detected (//trying to include `<name>` when `<name>` is already in the stack of includes//) and prevented (//as if `<name>` was missing, i.e. replaced by nothing or the given `default` value//). |
| 268 | |
| 269 | Finally, the transclusion should not be restricted to Wiki pages, but should ultimately be able to include other Trac resources (e.g. milestone or ticket descriptions, (parts of) files from the repository, etc.) |