List Info

Thread: custom filters and chaining




custom filters and chaining
user name
2006-05-23 23:14:45
I have two questions regarding the use of filters.  I use the Template Toolkit via ttree rather than writing custom Perl code that uses the underlying modules.  First question: Is it possible to define and use custom filters via ttree?  I'm hoping to avoid having to customize and rebuild my installation of TT.
 
Second question: I can't quite figure out the syntax for chaining filters.  I would like to replace:
 
[% FILTER indent("\t") %]
[% FILTER wrap(95) %]
[% FILTER html_entity %]
A long block of raw text to be converted to HTML, wrapped, and indented...
[% END %]
[% END %]
[% END %]
 
With:
 
[% FILTER html_entity | wrap(95) | indent("\t") %]
...
 
The rather short explanation of filter chaining in the documentation seems to imply ;(to me, at least) that this is possible.  However, I get a syntax error that complains about the "|" after the first filter (html_entity).
 
Either solution, a custom filter that encapsulates a few others, or the ability to chain, would sure save me a lot of typing...
 
Thanks!
 
Dustin
 
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )