> I need to produce both a PDF and a HTML document from the same
>
> template.
> Is there are reason you cannot use two separate templates? You can call both
> from one CGI script or perl script.

Well I could, but basically I've got a really long document containing
blanks that are populated by answers to a questionnaire, and so when
it comes time for changes to be made to the document and/or
questionnaire it'd be nicer to maintain one single document.

Perhaps I could use wrappers and blocks for things like headings, and
get the format (latex or html) from a CGI query param, and set the
various wrappers accordingly, e.g.

[% BLOCK html_section %]<h2>[% content %]</h2>[% END %]
[% BLOCK latex_section %]\section{[% content %]}[% END %]
...
[% USE q = CGI %]
[% format = q.param('format') %]
[% IF format == 'html' %]
  [% section = html_section %]
[% ELSE %]
  [% section = latex_section %]
[% END %]
...
[% WRAPPER section %]Some Section Title[% END %]

I'll have to try this when I'm back in the office... I just thought of
it now while reading the docs. Please let me know if I'm too
sleep-deprived to make any sense ;)

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to