| 1 | <h2>Comments</h2> |
| 2 | <pre><code class="language-tt2">[%# this entire directive is ignored no |
| 3 | matter how many lines it wraps onto |
| 4 | %] |
| 5 | [% # this is a comment |
| 6 | theta = 20 # so is this |
| 7 | rho = 30 # <aol>me too!</aol> |
| 8 | %] |
| 9 | </code></pre> |
| 10 | |
| 11 | <h2>Variables</h2> |
| 12 | <pre><code class="language-tt2">[% text %] |
| 13 | [% article.title %] |
| 14 | [%= eat.whitespace.left %] |
| 15 | [% eat.whitespace.right =%] |
| 16 | [%= eat.whitespace.both =%] |
| 17 | [% object.method() %]</code></pre> |
| 18 | |
| 19 | |
| 20 | <h2>Conditionals and Loops</h2> |
| 21 | <pre><code class="language-tt2">[% IF foo = bar %] |
| 22 | this |
| 23 | [% ELSE %] |
| 24 | that |
| 25 | [% END %] |
| 26 | [% FOREACH post IN q.listPosts(lingua = "de") %] |
| 27 | <a href="[% post.permalink %]">[% post.title | html %]</a> |
| 28 | [% END %]</code></pre> |
| 29 | |
| 30 | <h2>Multiple Directives</h2> |
| 31 | <pre><code class="language-tt2">[% IF title; |
| 32 | INCLUDE header; |
| 33 | ELSE; |
| 34 | INCLUDE other/header title="Some Other Title"; |
| 35 | END |
| 36 | %]</code></pre> |
| 37 | |
| 38 | <h2>Operators</h2> |
| 39 | <pre><code class="language-tt2">[% FOREACH post IN q.listPosts(lingua => 'de') %] |
| 40 | [% post.title | myfilter(foo = "bar") %] |
| 41 | [% END %]</code></pre> |
| 42 | |
| 43 | <h2>Known Limitations</h2> |
| 44 | <ul> |
| 45 | <li><a href="http://template-toolkit.org/docs/manual/Syntax.html#section_Outline_Tags"> |
| 46 | Outline tags</a> are not supported.</li> |
| 47 | <li>The arguments to |
| 48 | <a href="http://template-toolkit.org/docs/manual/Directives.html#section_TAGS">TAGS</a> |
| 49 | are usually misinterpreted</li> |
| 50 | <li>In TT2, you can use keywords as identifiers where this is |
| 51 | unambiguous. But these keywords will be highlighted as keywords, not |
| 52 | as variables here.</li> |
| 53 | <li>The |
| 54 | <a href="http://template-toolkit.org/docs/manual/Config.html#section_ANYCASE">ANYCASE</a> |
| 55 | option is not supported.</li> |
| 56 | <li> |
| 57 | Any number of backslashes in front of dollar signs inside of double quoted |
| 58 | strings are ignored since the behavior of Template Toolkit 2.26 seems to be |
| 59 | inconsistent. |
| 60 | </li> |
| 61 | </ul> |