Skip Menu |

This queue is for tickets about the PodSimplify CPAN distribution.

Report information
The Basics
Id: 71021
Status: new
Priority: 0/
Queue: PodSimplify

People
Owner: Nobody in particular
Requestors: CFABER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Added --nohtmlheader option to Pod::Html and pod2html
Currently pod2html and Pod::Html always generate HTML headers and footers. This is annoying when trying to embed the output in some other HTML document. The attached patches introduce the --nohtmlheader option which allows you to omit the HTML header and footer.
Subject: pod2html-nohtmlheader.patch
--- pod2html 2011-04-26 10:12:57.000000000 -0600 +++ pod2html 2011-09-16 09:57:14.951982991 -0600 @@ -12,7 +12,7 @@ pod2html --help --htmlroot=<name> --infile=<name> --outfile=<name> --podpath=<name>:...:<name> --podroot=<name> --libpods=<name>:...:<name> --recurse --norecurse --verbose - --index --noindex --title=<name> + --index --noindex --title=<name> --nohtmlheader =head1 DESCRIPTION
Subject: Pod-Html-nohtmlheader.patch
--- Pod/Html.pm 2011-01-19 16:54:31.538836980 -0700 +++ Pod/Html.pm 2011-01-19 22:16:46.718837016 -0700 @@ -3,7 +3,7 @@ require Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); -$VERSION = 1.09; +$VERSION = 1.10; @ISA = qw(Exporter); @EXPORT = qw(pod2html htmlify); @EXPORT_OK = qw(anchorify); @@ -83,6 +83,10 @@ Creates header and footer blocks containing the text of the C<NAME> section. By default, no headers are generated. +=item nohtmlheader + +Omit HTML header and footers from output + =item help --help @@ -251,7 +255,7 @@ use vars qw($Ignore); # need to localize it later. my(%Items_Named, @Items_Seen); -my($Title, $Header); +my($Title, $Header, $HtmlHeader); my $Top; my $Paragraph; @@ -312,6 +316,7 @@ @Items_Seen = (); # for multiples of the same item in perlfunc %Items_Named = (); $Header = 0; # produce block header/footer + $HtmlHeader = 1; # produce HTML header/foot blocks $Title = ''; # title to give the pod(s) $Top = 1; # true if we are at the top of the doc. used # to prevent the first <hr /> directive. @@ -474,6 +479,7 @@ </table> END_OF_BLOCK +if($HtmlHeader){ print HTML <<END_OF_HEAD; <?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -485,8 +491,11 @@ </head> <body$bodystyle> -$block END_OF_HEAD +} + +print HTML $block if $block; + # load/reload/validate/cache %Pages and %Items get_cache($Dircache, $Itemcache, \@Podpath, $Podroot, $Recurse); @@ -612,13 +621,15 @@ print HTML "<p><a href=\"#__index__\"><small>$Backlink</small></a></p>\n" if $Doindex and $index and $Backlink; + print HTML $block if $block; + +if($HtmlHeader){ print HTML <<END_OF_TAIL; -$block </body> </html> END_OF_TAIL - +} # close the html file close(HTML); @@ -648,6 +659,7 @@ in podpath stem (default is /). --[no]index - generate an index at the top of the resulting html (default behaviour). + --nohtmlheader - disable printing of standard html headers/footers --infile - filename for the pod to convert (input taken from stdin by default). --libpods - colon-separated list of pages to search for =item pod @@ -672,33 +684,34 @@ } sub parse_command_line { - my ($opt_backlink,$opt_cachedir,$opt_css,$opt_flush,$opt_header,$opt_help, - $opt_htmldir,$opt_htmlroot,$opt_index,$opt_infile,$opt_libpods, + my ($opt_backlink,$opt_cachedir,$opt_css,$opt_flush,$opt_header,$opt_nohtmlheader, + $opt_help,$opt_htmldir,$opt_htmlroot,$opt_index,$opt_infile,$opt_libpods, $opt_netscape,$opt_outfile,$opt_podpath,$opt_podroot,$opt_quiet, $opt_recurse,$opt_title,$opt_verbose,$opt_hiddendirs); unshift @ARGV, split ' ', $Config{pod2html} if $Config{pod2html}; my $result = GetOptions( - 'backlink=s' => \$opt_backlink, - 'cachedir=s' => \$opt_cachedir, - 'css=s' => \$opt_css, - 'flush' => \$opt_flush, - 'header!' => \$opt_header, - 'help' => \$opt_help, - 'hiddendirs!'=> \$opt_hiddendirs, - 'htmldir=s' => \$opt_htmldir, - 'htmlroot=s' => \$opt_htmlroot, - 'index!' => \$opt_index, - 'infile=s' => \$opt_infile, - 'libpods=s' => \$opt_libpods, - 'netscape!' => \$opt_netscape, - 'outfile=s' => \$opt_outfile, - 'podpath=s' => \$opt_podpath, - 'podroot=s' => \$opt_podroot, - 'quiet!' => \$opt_quiet, - 'recurse!' => \$opt_recurse, - 'title=s' => \$opt_title, - 'verbose!' => \$opt_verbose, + 'backlink=s' => \$opt_backlink, + 'cachedir=s' => \$opt_cachedir, + 'css=s' => \$opt_css, + 'flush' => \$opt_flush, + 'header!' => \$opt_header, + 'help' => \$opt_help, + 'hiddendirs!' => \$opt_hiddendirs, + 'htmldir=s' => \$opt_htmldir, + 'htmlroot=s' => \$opt_htmlroot, + 'index!' => \$opt_index, + 'infile=s' => \$opt_infile, + 'libpods=s' => \$opt_libpods, + 'netscape!' => \$opt_netscape, + 'outfile=s' => \$opt_outfile, + 'podpath=s' => \$opt_podpath, + 'podroot=s' => \$opt_podroot, + 'quiet!' => \$opt_quiet, + 'recurse!' => \$opt_recurse, + 'title=s' => \$opt_title, + 'verbose!' => \$opt_verbose, + 'nohtmlheader'=> \$opt_nohtmlheader, ); usage("-", "invalid parameters") if not $result; @@ -712,6 +725,7 @@ $Cachedir = $opt_cachedir if defined $opt_cachedir; $Css = $opt_css if defined $opt_css; $Header = $opt_header if defined $opt_header; + $HtmlHeader = 0 if defined $opt_nohtmlheader; $Htmldir = $opt_htmldir if defined $opt_htmldir; $Htmlroot = $opt_htmlroot if defined $opt_htmlroot; $Doindex = $opt_index if defined $opt_index;