Chunk Tag Filters
From Chunk Java Template Engine
(Created page with "Chunk includes several useful filters right out of the box. == alternate(<oddoutput>,<evenoutput>) == When tag value is odd, output <oddoutput> - when even, output <evenoutput>....")
Newer edit →
Revision as of 16:53, 18 November 2013
Chunk includes several useful filters right out of the box.
Contents |
alternate(<oddoutput>,<evenoutput>)
When tag value is odd, output <oddoutput> - when even, output <evenoutput>.
capitalize
Uppercase the first letter of each word. Leave case of other characters intact. See #title.
Alias: cap
indent(<howmany>[,indentstring])
Indent each line of the input by <howmany>. Default indentstring is a space.
length
Outputs the size of a LIST or OBJECT, or the length of a STRING input.
Alias: len
lower
Convert text to lowercase. Honors Java locale settings.
Alias: lc
ondefined(<output>)
Output <output> when tag value is defined. Note that a tag value of null becomes the empty string, which is considered defined. To be undefined, the tag label must not exist in the tag table at all.
onempty(<output>)
For undefined or empty (ie empty string or only whitespace) values, output the given <output>, otherwise let the tag value pass through.
== onmatch(/<regex/,<output>[,/<regex2>/,<output2>[,...]])[nomatch(<nomatchoutput>)] Don't use this. Really. Use {.if (...)} {.elseIf (...)} {.else} {/if} instead. Far more readable.
reverse
Reverse a LIST.
s/<regex>/<replace>/
Perl-style regular expression search and replace.
slice([from]:[to][:step])
Subset a list using python-style slice notation.
sprintf(<format>)
The classic formatter.
title
Uppercase the first letter of each word, and lowercase all other characters. See #capitalize.
type
Output STRING, LIST, OBJECT, CHUNK or NULL per the tag value.
upper
Convert text to uppercase. Honors Java locale settings.
Alias: uc