Warning: Declaration of action_plugin_stratatemplatery::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php on line 24
Warning: Declaration of action_plugin_editx::register(&$contr) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/editx/action.php on line 18
Warning: Declaration of action_plugin_templatery::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/templatery/action.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/auth.php on line 430
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/Action/Export.php on line 103
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/Action/Export.php on line 103
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nielsvantol/public_html/dragonseye/rpwiki/lib/plugins/stratatemplatery/action.php:35) in /usr/home/nielsvantol/public_html/dragonseye/rpwiki/inc/Action/Export.php on line 103
====== Templatery ======
The templatery plugin offers the ability to write a template, and have it included in other pages with filled in fields.
===== Example =====
==== The anatomy of a template ====
Defining a template is very simple:
This starts a new template. The template can optionally have a name ('example' in this case).
Hello, my name is: @@name@@
A piece of text with a field called 'name'.
I'm a member of @@organisation@@.
A conditional piece of text. If the field 'organisation' is present, this will be displayed. If the field is not defined, the whole piece won't be used.
Finishes the template.
==== The actual template ====
The template will end up looking like this:
Hello, my name is: @@Name@@
I'm a member of @@Organisation@@.
==== Using the template ====
**You use the template with**
{{template>wiki:templatery#example|name=Brend|organisation=University of Twente}}
This tells the wiki to use the template [[wiki:templatery#example|wiki:templatery#example]].
If you do not have a full name, but something like %%{{template>test}}%% the wiki will look in the [[template:]] namespace for the template.
**Looks like this**
{{template>wiki:templatery#example|name=Brend|organisation=University of Twente}}
===== Using parameters =====
A template can have both named and numbered parameters.
==== Numbered parameters ====
Parameters can be numbered:
0 = @@0@@, 1 = @@1@@
{{template>wiki:templatery#numbered
|Alpha
|beta
}}
You can freely mix numbered and named parameters.
==== Default values ====
Parameters can be numbered:
@@a|Default value for a@@ & @@B|Default value for b@@
{{template>wiki:templatery#defaults
|a=Alpha
}}
===== Conditionals =====
You can have conditional pieces of template:
Text if a is set. a = @@a@@
Text if a is **not** set. a = @@A@@
**With A set**
{{template>wiki:templatery#conditionals|A=Alpha}}
**With A unset**
{{template>wiki:templatery#conditionals}}
==== Inline Conditionals ====
Conditionals will be block-level if possible and will switch to inline if necessary.
This is useful, for example, if you have them in a list item.
You can force a conditional to be inline by prefixing it with a ''*''.
* Test with @@a@@
Some <*if B>//@@B@@// value of B.
{{template>wiki:templatery#inlineconditionals
|A=strawberries
|B=tomato
}}
===== Templates in Templates =====
You can include a template in a template. This allows you to reuse templates.
If you dot this, you use %%{{template>name of template|inside=outside}}%%. The variables assignments are used to remap variables from outside the template to inside the template. Any variable not mentioned is available under it's old name.
0 = @@0@@
{{template>wiki:templatery#recursion
|0=1
|1=2
|2=3
|3=4
}}
{{template>wiki:templatery#recursion
|Alpha
|Beta
|Gamma
|Delta
}}