[Templates] PDF and HTML output

Stewart Heckenberg stewart.heckenberg@gmail.com
Wed, 8 Aug 2007 14:48:03 +1000


G'day,

I've been reading the TT docs for the last couple of days and had a
scan of the mailing list archives, but thought I'd ask my questions
here and risk the flames:

I need to produce both a PDF and a HTML document from the same
template. I've been looking at the filters, but not sure if this is
the right option, as HTML tags are different to LaTeX directives, so
specifying formatting like headings and paragraphs isn't as
straightforward, and I'm thinking I should perhaps just keep the
template as a HTML file, and use something like PDF::FromHTML to
produce the PDF version.

I also need to fill in blanks on the template using multiple forms,
and so I'm thinking I should keep everything (both questions and
answers) in the one big template, using something like:

[% IF questions %]
What is your name? [% CGI.textfield('name') %]
[% END %]
[% IF answers %]
You said your name was [% CGI.param('name') %]
[% END %]
[% IF questions....

etc.

and so to display all the questions I set questions=1 and to display
all the answers (after the form is submitted) I set answers=1.

Any pointers would be much appreciated -- I'm really keen to start
using the full potential of TT and not just hacking away if there's a
better way to do things :)

Kind regards,
Stew