HTML::Template::Filter::TT2 - Template Toolkit 2 syntax for HTML::Template
Version 0.03
use HTML::Template::Filter::TT2; my $tmpl = HTML::Template->new(filter => \&ht_tt2_filter, ...);
This HTML::Template filter allows you to use a subset of the Template Toolkit 2 syntax, which is much less verbose than the default syntax. This is not an emulation of TT2, so you're still limited to the usual HTML::Template semantics. Also, in order to keep the filter fast and simple, the [% end %] must be written with the block name. See below for details.
HTML::Template
[% end %]
Here is the syntax recognised by this module.
Simple interpolation:
[% variable %]
Interpolation with default value:
[% variable :default %]
Interpolation with filter (i.e. a HTML::Template escape mode):
[% variable |filter %]
Interpolation with default value and filter:
[% variable :default |filter %]
[% if condition %] ... [% else %] ... [end_if %]
The difference with the actual TT2 syntax is that you must use end_if instead of end
end_if
end
[% loop loop-name %] ... [% end_loop %]
As for the if statement, you must use end_loop instead of end.
if
end_loop
Exports the ht_tt2_filter function by default.
ht_tt2_filter
Pass a reference to this function to the filter parameter when calling HTML::Template->new()
filter
HTML::Template->new()
Sébastien Aperghis-Tramoni, <sebastien at aperghis.net>
<sebastien at aperghis.net>
HTML::Template, Template::Toolkit
Please report any bugs or feature requests to bug-html-template-filter-tt2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Template-Filter-TT2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-html-template-filter-tt2 at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc HTML::Template::Filter::TT2
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/HTML-Template-Filter-TT2
CPAN Ratings
http://cpanratings.perl.org/d/HTML-Template-Filter-TT2
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Template-Filter-TT2
Search CPAN
http://search.cpan.org/dist/HTML-Template-Filter-TT2
Copyright 2007 Sébastien Aperghis-Tramoni, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Template::Filter::TT2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Template::Filter::TT2
CPAN shell
perl -MCPAN -e shell install HTML::Template::Filter::TT2
For more information on module installation, please visit the detailed CPAN module installation guide.