Consistent Tool Arguments
nav_first.pngFirst: thread:131
HTML Block
Edited: 11 Oct 2012 12:06 by: GoVegan
Comments: 0
nav_prev.pngPrevious: thread:128
Drive-by Sign-in & Registration
Edited: 12 Nov 2009 12:44 by: pieterh
Comments: 0
Last: thread:112
Image Module
Edited: 12 Nov 2009 12:22 by: pieterh
Comments: 0
Next: thread:136
Ten Core Principles
Edited: 12 Nov 2009 12:27 by: pieterh
Comments: 0

Steven HeynderickxSteven Heynderickx wrote on 10 Nov 2009 15:49

Originally suggested by pieterhpieterh 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
[[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

Start a new sub-thread

We discourage direct comments on this thread: to discuss it, please start a sub-thread.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License