]> sipb.mit.edu Git - ikiwiki.git/blob - doc/ikiwiki/directive.mdwn
try to fix escaping of nested directive
[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-double-quotes or triple-single-quotes:
24
25         \[[!directive text="""
26         1. "foo"
27         2. "bar"
28         3. "baz"
29         """ othertext='''
30         1. 'quux'
31         2. "foo"
32         ''']]
33
34 If you want to put text with triple quotes into a parameter value, you can
35 use perl-style here-doc syntax, even nesting it like this:
36
37         \[[!directive text=<<OUTER
38         [[!otherdirective <<INNER
39         inner text
40         INNER]]
41         outer text
42         OUTER]]
43
44 ikiwiki also has an older syntax for directives, which requires a space in
45 directives to distinguish them from [[wikilinks|ikiwiki/wikilink]]. This
46 syntax has several disadvantages: it requires a space after directives with
47 no parameters (such as `\[[pagecount ]]`), and it prohibits spaces in
48 [[wikilinks|ikiwiki/wikilink]].  ikiwiki now provides the `!`-prefixed
49 syntax shown above as default.  However, ikiwiki still supports wikis using
50 the older syntax, if the `prefix_directives` option is disabled.
51
52 [[!if test="enabled(listdirectives)" then="""
53 Here is a list of currently available directives in this wiki:
54
55 [[!listdirectives ]]
56 """]]