Generating Bratislava.pm.org using Template Toolkit - TT
Bratislava.pm.org is stored as a static html page on server. But HTML
files are generated using
This Perl module allows to add special tags to a text file that are then parsed.
By default the tags are
[% %], but can be easily changed, to
<? ?>, by setting
[% TAGS <? ?> %].
Standard usage of Template Toolkit is in MVC frameworks, where it is used as a View that can generate XML, plain text, PDF, ... and of course HTML.
Except the direct usage in Perl script, Template Toolkit can be used also
from command line. Using
tpage we can convert files that have
TT tags (
.tt2) to a destination file (
ttree we can convert the whole file tree.
Templates that are used to generate Bratislava.pm.org are located in
Here we can find two files -
tt.cfg + three
The processing to HTML is done using "
ttree -f tt.cfg". This
command will take all
.tt2 files and transforms them to
+ copies all the rest of the files to html/.
html/ folder is defined as
svn:external pointing to Subversion repository.
This way we can work on templates commit them, see the result and the changes that will
be made to the real site can be seen using "
svn diff". Final commit
in html/ is made when everything
is as it should be.
22. Apr 2008