On Thu, Jul 19, 2001 at 12:16:13AM -0700, Perrin Harkins wrote:
> Is there any simple way to covert POD to pretty HTML with TT?
Use Pod::POM to read the POD source into a tree form and then use
a VIEW to walk it and display accordingly. e.g. define templates
that look something like this:
pod/html/head1:
<h1>[% view.print(item.title) %]</h1>
[% view.print(item.content) %]
pod/html/head2:
<h2>[% view.print(item.title) %]</h2>
[% view.print(item.content) %]
pod/html/over:
<ul>
[% view.print(item.content) %]
</ul>
etc.
Then load the POD into a POM model:
[% USE pod %]
[% pom = pod.parse(podfile) %]
define a VIEW to map elements to above templates:
[% VIEW v prefix="pod/html';
BLOCK list;
view.print(i) FOREACH i = item;
END;
END
%]
note how we also define a generic 'list' block to automatically process each
item in a list.
And then print the POM (or part selected from it) via the view:
[% v.print(pom) %]
In the TT docsrc bundle (abandon hope all ye who enter there!), lib/pod/html/*
contains the template files as above and lib/html/page contains the calling
code to load the POM and render the view.
HTH
A
--
Andy Wardley <[EMAIL PROTECTED]> Signature regenerating. Please remain seated.
<[EMAIL PROTECTED]> For a good time: http://www.kfs.org/~abw/