Pod::Xhtml(3pm) | User Contributed Perl Documentation | Pod::Xhtml(3pm) |
Pod::Xhtml - Generate well-formed XHTML documents from POD format documentation
This module inherits from Pod::Parser, hence you can use this familiar interface:
use Pod::Xhtml; my $parser = new Pod::Xhtml; $parser->parse_from_file( $infile, $outfile ); # or use filehandles instead $parser->parse_from_filehandle($in_fh, $out_fh); # or get the XHTML as a scalar my $parsertoo = new Pod::Xhtml( StringMode => 1 ); $parsertoo->parse_from_file( $infile, $outfile ); my $xhtml = $parsertoo->asString; # or get a reference to the XHTML string my $xhtmlref = $parsertoo->asStringRef; # to parse some other pod file to another output file all you need to do is... $parser->parse_from_file( $anotherinfile, $anotheroutfile );
There are options specific to Pod::Xhtml that you can pass in at construction time, e.g.:
my $parser = new Pod::Xhtml(StringMode => 1, MakeIndex => 0);
See "OPTIONS". For more information also see Pod::Parser which this module inherits from.
TopHeading => 2
and "=head1" will be tagged with h2 tags, "=head3" with h3, and so on.
Note that XHTML doesn't allow for heading tags past h6, so h7 and up will be translated to h6 as necessary.
Default: <p><a href="#TOP" class="toplink">Top</a></p>
This module works with a Pod::Hyperlink::BounceURL link parser and generates hyperlinks as 'a' elements with a class of 'pod_xhtml_bounce_url'. The optional text giving the "node" is enclosed in a 'strong' element with a class of 'pod_xhtml_bounce_url_text'
There's Pod::PXML and Pod::XML, so why do we need Pod::Xhtml? You need an XSLT to transform XML into XHTML and many people don't have the time or inclination to do this. But they want to make sure that the pages they put on their web site are well-formed, they want those pages to use stylesheets easily, and possibly they want to squirt the XHTML through some kind of filter for more processing.
By generating well-formed XHTML straight away we allow anyone to just use the output files as-is. For those who want to use XML tools or transformations they can use the XHTML as a source, because it's a well-formed XML document.
This module outputs well-formed XHTML if the POD is well-formed. To check this you can use something like:
use Pod::Checker; my $syn = podchecker($defaultIn);
If $syn is 0 there are no syntax errors. If it's -1 then no POD was found. Any positive number indicates that that number of errors were found. If the input POD has errors then the output XHTML should be well-formed but will probably omit information, and in addition Pod::Xhtml will emit warnings. Note that Pod::Parser seems to be sensitive to the current setting of $/ so ensure it's the end-of-line character when the parsing is done.
P Kent & Simon Flack <cpan _at_ bbc _dot_ co _dot_ uk>
(c) BBC 2004, 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
2020-05-17 | perl v5.30.0 |