in reply to Re: POD translation to HTML bug? (pod2html)
in thread POD translation to HTML bug?
What am I talking about?
I tried to use existing command tools to add POD info to a technical web-site. As a consequence, pod2html, a a command line tool, seemed to be the right choice. No programming, no trouble.
That worked fine until I wanted to integrate these pages into the look-and-feel of the rest of the site. This is when I discovered 1) output of pod2html is XHTML, not HTML, 2) some elements, aka <dt>, are not properly closed in exceptional circumstances.
What do I want to do?
Certainly not a full file processing.
Basically, remove the xml declaration <?xml ... ?>, replace the XHTML DOCTYPE by the HTML DOCTYPE, retrieve important information from <head> block to adapt it to the site rules, add my standard header at the beginning of the <body> block and my standard footer before the </body> tag.
As can be seen, this does not require a full XML parser.
Workaround as of today
I have written a very small Perl script reading a faulty XHTML file and looking for <dt> tags. If a <dd> tag is seen without a previous </dt> tag, the missing tag is inserted right before <dd> tag.
Just needs a simple state automaton.
Now, my transformation becomes:
pod2html perl-file-with-pod.pm | checkdt | adapt-to-site-look -o outpu +tfile.html
Suggestions
I'll have a look at XML::Twig and XML::LibXML if basic features XML::Parser give too complex a code.
Bug fix
Fixing a bug is always a good thing. Since this one has been exposed to the light, it should be fixed, all the most if it is easy.
Thanks to all for the information;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: POD translation to HTML bug? (pod2html)
by Anonymous Monk on Dec 06, 2013 at 11:35 UTC | |
by ajl52 (Novice) on Dec 07, 2013 at 14:19 UTC | |
by Anonymous Monk on Dec 07, 2013 at 23:19 UTC |