Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
directive_summary [2012-08-01 11:30] – created randersondirective_summary [2013-12-06 14:12] (current) – Fix heading level rspencer
Line 1: Line 1:
-=====Directive Summary===== +====== Directive Summary =====
-  * GET - Evaluate and print a variable or value.<code>+ 
 +  * **GET** - Evaluate and print a variable or value.<code>
 [%   GET variable %]    # 'GET' keyword is optional [%   GET variable %]    # 'GET' keyword is optional
  
Line 9: Line 10:
 [% obj.meth(args) %] [% obj.meth(args) %]
 [%  "value: $var" %]</code> [%  "value: $var" %]</code>
-  * SET - Assign a values to variables.<code>+  * **SET** - Assign a values to variables.<code>
 [% SET variable = value %]    # 'SET' also optional [% SET variable = value %]    # 'SET' also optional
  
Line 19: Line 20:
 hash     = { var => val, var => val, ... } hash     = { var => val, var => val, ... }
 %]</code> %]</code>
-  * DEFAULT - Like SET above, but variables are only set if currently unset (i.e. have no true value).<code>+  * **DEFAULT** - Like SET above, but variables are only set if currently unset (i.e. have no true value).<code>
 [% DEFAULT variable = value %]</code> [% DEFAULT variable = value %]</code>
-  * INSERT - Insert a file without any processing performed on the contents.<code>+  * **INSERT** - Insert a file without any processing performed on the contents.<code>
 [% INSERT legalese.txt %]</code> [% INSERT legalese.txt %]</code>
-  * INCLUDE - Process another template file or block and include the output.  Variables are localised.<code>+  * **INCLUDE** - Process another template file or block and include the output.  Variables are localised.<code>
 [% INCLUDE template %] [% INCLUDE template %]
 [% INCLUDE template  var = val, ... %]</code> [% INCLUDE template  var = val, ... %]</code>
-  * PROCESS - As INCLUDE above, but without localising variables.<code>+  * **PROCESS** - As INCLUDE above, but without localising variables.<code>
 [% PROCESS template %] [% PROCESS template %]
 [% PROCESS template  var = val, ... %]</code> [% PROCESS template  var = val, ... %]</code>
-  * WRAPPER - Process the enclosed block WRAPPER ... END block then INCLUDE the named template, passing the block output in the 'content' variable.<code>+  * **WRAPPER** - Process the enclosed block WRAPPER ... END block then INCLUDE the named template, passing the block output in the 'content' variable.<code>
 [% WRAPPER template %] [% WRAPPER template %]
 content... content...
 [% END %]</code> [% END %]</code>
-  * BLOCK - Define a named template block for subsequent INCLUDE, PROCESS, etc.,<code>+  * **BLOCK** - Define a named template block for subsequent INCLUDE, PROCESS, etc.,<code>
 [% BLOCK template %] [% BLOCK template %]
 content content
 [% END %]</code> [% END %]</code>
-  * FOREACH - Repeat the enclosed FOREACH ... END block for each value in the list.<code>+  * **FOREACH** - Repeat the enclosed FOREACH ... END block for each value in the list.<code>
 [% FOREACH variable = [ val, val, val ] %]    # either [% FOREACH variable = [ val, val, val ] %]    # either
 [% FOREACH variable = list %]                 # or [% FOREACH variable = list %]                 # or
Line 44: Line 45:
 [% variable %] [% variable %]
 [% END %]</code> [% END %]</code>
-  * WHILE - Enclosed WHILE ... END block is processed while condition is true.<code>+  * **WHILE** - Enclosed WHILE ... END block is processed while condition is true.<code>
 [% WHILE condition %] [% WHILE condition %]
 content content
 [% END %]</code> [% END %]</code>
-  * IF / UNLESS / ELSIF / ELSE - Enclosed block is processed if the condition is true / false.<code>+  * **IF / UNLESS / ELSIF / ELSE** - Enclosed block is processed if the condition is true / false.<code>
 [% IF condition %] [% IF condition %]
 content content
Line 61: Line 62:
 content content
 [% END %]</code> [% END %]</code>
-  * SWITCH / CASE - Multi-way switch/case statement.<code>+  * **SWITCH / CASE** - Multi-way switch/case statement.<code>
 [% SWITCH variable %] [% SWITCH variable %]
 [% CASE val1 %] [% CASE val1 %]
Line 70: Line 71:
 content content
 [% END %]</code> [% END %]</code>
-  * MACRO - Define a named macro.<code>+  * **MACRO** - Define a named macro.<code>
 [% MACRO name <directive> %] [% MACRO name <directive> %]
 [% MACRO name(arg1, arg2) <directive> %] [% MACRO name(arg1, arg2) <directive> %]
Line 76: Line 77:
 [% name %] [% name %]
 [% name(val1, val2) %] [% name(val1, val2) %]
-  * FILTER - Process enclosed FILTER ... END block then pipe through a filter.+  * **FILTER** - Process enclosed FILTER ... END block then pipe through a filter.
 [% FILTER name %]                       # either [% FILTER name %]                       # either
 [% FILTER name( params ) %]             # or [% FILTER name( params ) %]             # or
Line 82: Line 83:
 content content
 [% END %]</code> [% END %]</code>
-  * USE Load a "plugin" module, or any regular Perl module if LOAD_PERL option is set.<code>+  * **USE** Load a "plugin" module, or any regular Perl module if LOAD_PERL option is set.<code>
 [% USE name %]                          # either [% USE name %]                          # either
 [% USE name( params ) %]                # or [% USE name( params ) %]                # or
Line 89: Line 90:
 [% name.method %] [% name.method %]
 [% var.method %]</code> [% var.method %]</code>
-  * TRY / THROW / CATCH / FINAL - Exception handling.<code>+  * **TRY / THROW / CATCH / FINAL** - Exception handling.<code>
 [% TRY %] [% TRY %]
 content content
Line 101: Line 102:
 this block is always processed this block is always processed
 [% END %]</code> [% END %]</code>
-  * NEXT - Jump straight to the next item in a FOREACH/WHILE loop.<code>+  * **NEXT** - Jump straight to the next item in a FOREACH/WHILE loop.<code>
 [% NEXT %]</code> [% NEXT %]</code>
-  * LAST - Break out of FOREACH/WHILE loop.<code>+  * **LAST** - Break out of FOREACH/WHILE loop.<code>
 [% LAST %]</code> [% LAST %]</code>
-  * RETURN - Stop processing current template and return to including templates.<code>+  * **RETURN** - Stop processing current template and return to including templates.<code>
 [% RETURN %]</code> [% RETURN %]</code>
-  * STOP - Stop processing all templates and return to caller.<code>+  * **STOP** - Stop processing all templates and return to caller.<code>
 [% STOP %]</code> [% STOP %]</code>
-  * TAGS - Define new tag style or characters (default: [% %]).<code>+  * **TAGS** - Define new tag style or characters (default: [% %]).<code>
 [% TAGS html %] [% TAGS html %]
 [% TAGS <!-- --> %]</code> [% TAGS <!-- --> %]</code>
-  * COMMENTS - Ignored and deleted.<code>+  * **COMMENTS** - Ignored and deleted.<code>
 [% # this is a comment to the end of line [% # this is a comment to the end of line
 foo = 'bar' foo = 'bar'