On Sep 3, 2007, at 12:53 AM, Andy Wardley wrote:
> So if you, or anyone else has got things they'd like to change
> about T::P, trivial or otherwise, then now is a very good time to
> speak up!
We have what I think is a clever extension to allow TT to process
templates that needs pre-translation. This might be moot with TT3,
but all the same ... I didn't send it years ago because at the time
T::P was such a mess that we didn't actually sub-classed it but just
copied that module and made the changes. Earlier this year I gave
it another spin and made the changes a little easier to read (it's
just a few lines now).
Specifically we use it to automatically translate .pod templates to
html to be served (with the outer style wrapper, as per my mail
earlier).
In our provider configuration we have
EXTENSIONS => [ { extension => "pod", translator =>
Combust::Template::Translator::POD->new() } ]
Then in our provider class we add a little magic to fetch() to in
addition to looking for "foo.html" (html is our template extension
filename) also look for "foo.pod" and use the translator on it. The
neat thing here is that we can still serve the raw pod files, too --
and if we put in a real foo.html file the .pod file will be ignored.
https://svn.develooper.com/combust/trunk/lib/Combust/Template/
Provider.pm
Examples in action:
http://dev.perl.org/perl6/doc/design/apo/A12.html
http://dev.perl.org/perl6/doc/design/apo/A12.pod
Templates etc (svn.perl.org login required) in:
http://svn.perl.org/perl.org/docs/live/dev/
http://svn.perl.org/perl.org/docs/live/shared/
- ask
--
http://develooper.com/ - http://askask.com/
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates