Ask Bjoern Hansen <ask-LxHg3dlN6iy+XT7JhA+gdA@xxxxxxxxxxxxxxxx> writes:
> We would like to have our system look for .pod files in addition to
> the regular .html template file; and if found then convert it into a
> template (with page.title set to =head1 NAME etc).
>
> I'd like it to search the search path so trying to load file.html
> would go like /path1/file.html, /path1/file.pod, /path2/file.html,
> /path2/file.pod. Preferably it should only look for .pod files on
> the "root" template and not on PROCESS or INCLUDE directives used in
> the templates.
Is it important that /path1/file.pod is tested *before*
/path2/file.html? Otherwise it could perhaps be done like that:
- PROCESS file.html
- CATCH 'file' errors (or the returncode from $tt->process, if you
run this from perl)
- in the error block: INSERT file.pod into a TT variable
[% pod = INSERT file.pod %]
and POD::POM -> View this TT variable
Caveat:
I don't actually understand where the POD plugin does its
parsing. The doc says '[% USE Pod(podfile) %]' and I can't
see whether it is calling Pod::POM::parsefile (which would
fail) or Pod::POM::parse (which would probably Do The Right
Thing). Maybe I've screwed up my TT installation...
This procedure would also avoid searching for .pod files in all other
TT directives.
> Hacking Template::Provider to look for the files, call a converter
> method to compile a template from the .pod and cache the results next
> to the ordinary parsed templates seems like the best solution. Is
> that right? Any other ideas?
If you want to process /path1/file.pod instead of /path2/file.html if
both exist then I guess you must dive into the provider...
--
Cheers,
haj
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|