Steven Heynderickx wrote on 10 Nov 2009 15:49
Originally suggested by pieterh on 17 September 2009.
Wikidot uses (due to historical merging of various ideas) inconsistent syntax for passing arguments to tools (modules and tools like include, image, etc.). There are at least three syntaxes for passing arguments: unnamed (e.g. [[image filename]]), named without delimiters (e.g. [[include filename argument = value | argument = value]]) and named with delimiters (e.g. [[module ListPages category="*"]]).
As well as being inconsistent, argument values are limited in important ways: they cannot contain special characters like quotes, they cannot run over multiple lines, etc.
The goal of this design sketch is to define a single consistent syntax for arguments that can be used in new tools. It works as follows:
- It uses the named argument style (name = "value")
- It provides a mechanism for escaping special characters
- It provides a mechanism for creating multiline (block) values
Escaping special characters
The character "\" is used to escape single characters inside the string value. To pass the backslash, we use two backslashes. All characters can be escaped.
Passing a block value
To pass a block value the tool must use closures, i.e. a closing tag that matches the opening tag. Between the opening and closing tag, we have a body that may provide templating for tools like ListPages.
We pass a block value within the tool body as follows:
[[opening tag]]
==== name
value
====
[[closing tag]]
The closing marker '====' is optional when the block ends with another value, or at the closing tag. Here is an example of ListPages using this style (and the new header/footer arguments defined in design:12:
[[module ListPages]]
==== header
[[table style="border: 1px solid #000"]]
==== footer
[[/table]]
[[/module]]
We discourage direct comments on this thread: to discuss it, please start a sub-thread.