]> sipb.mit.edu Git - ikiwiki.git/blob - doc/ikiwiki/directive.mdwn
response
[ikiwiki.git] / doc / ikiwiki / directive.mdwn
1 [[!meta robots="noindex, follow"]]
2 Directives are similar to a [[ikiwiki/WikiLink]] in form, except they
3 begin with `!` and may contain parameters. The general form is:
4
5         \[[!directive param="value" param="value"]]
6
7 This gets expanded before the rest of the page is processed, and can be used
8 to transform the page in various ways.
9
10 The quotes around values can be omitted if the value is a simple word.
11 Also, some directives may use parameters without values, for example:
12
13         \[[!tag foo]]
14
15 A directive does not need to all be on one line, it can be
16 wrapped to multiple lines if you like:
17         
18         \[[!directive foo="baldersnatch"
19         bar="supercalifragilisticexpialidocious" baz=11]]
20
21 Also, multiple lines of *quoted* text can be used for a value.
22 To allow quote marks inside the quoted text, delimit the block
23 of text with triple-quotes:
24
25         \[[!directive text="""
26         1. "foo"
27         2. "bar"
28         3. "baz"
29         """]]
30
31 ikiwiki also has an older syntax for directives, which requires a
32 space in directives to distinguish them from [[wikilinks|ikiwiki/wikilink]].
33 This syntax has several disadvantages: it requires a space after directives
34 with no parameters (such as `\[[pagecount ]]`), and it prohibits spaces in
35 [[wikilinks|ikiwiki/wikilink]].  ikiwiki now provides the `!`-prefixed syntax
36 shown above as the preferred alternative.  However, ikiwiki still supports
37 wikis using the older syntax, if the `prefix_directives` option is not enabled.
38 For backward compatibility with existing wikis, this option currently
39 defaults to off, so ikiwiki supports the old syntax.
40
41 [[!if test="enabled(listdirectives)" then="""
42 Here is a list of currently available directives in this wiki:
43
44 [[!listdirectives ]]
45 """]]