[Templates] Filters + replace
Sergey Martynoff
sergey@martynoff.info
Fri, 28 Jul 2006 18:16:28 +0400
> I would like a filter that
> - takes the first line and makes it <h2>....</h2>
> - processes the rest in the manner of html_para
>
> A number of ways of hacking thos
> - Is there are filter that does something along these lines
> - is it possible to create my own filter - cant see
> description of how to do it
It's quite easy and documented in Template::Plugin::Filter pod:
http://search.cpan.org/dist/Template-Toolkit/lib/Template/Plugin/Filter.pm
> - I have tried to do [ INCLUDE filename | replace( 'soemregex',
> '<h2>$1</h2> ) but the $1 bit doesnt seem to work
Which version of TT are you using? The $1..$n substitution does work in
latest TT distribution (2.15), but unfortunately is not documented yet.
--
Sergey Martynoff