From: Gurusamy Sarathy Date: Wed, 23 Sep 1998 10:46:06 +0000 (+0000) Subject: make Pod/Html.pm handle the --title option properly (as suggested X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d011ffae9b6ac96eccec8dfa1493f37cf4d66ff6;p=p5sagit%2Fp5-mst-13.2.git make Pod/Html.pm handle the --title option properly (as suggested by gml4410@ggr.co.uk) p4raw-id: //depot/perl@1853 --- diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 5d2e07b..2a90e1d 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -300,18 +300,20 @@ sub pod2html { open(HTML, ">$htmlfile") || die "$0: cannot open $htmlfile file for output: $!\n"; - # put a title in the HTML file - $title = ''; - TITLE_SEARCH: { - for (my $i = 0; $i < @poddata; $i++) { - if ($poddata[$i] =~ /^=head1\s*NAME\b/m) { - for my $para ( @poddata[$i, $i+1] ) { - last TITLE_SEARCH if ($title) = $para =~ /(\S+\s+-+.*\S)/s; - } - } + # put a title in the HTML file if one wasn't specified + if ($title eq '') { + TITLE_SEARCH: { + for (my $i = 0; $i < @poddata; $i++) { + if ($poddata[$i] =~ /^=head1\s*NAME\b/m) { + for my $para ( @poddata[$i, $i+1] ) { + last TITLE_SEARCH + if ($title) = $para =~ /(\S+\s+-+.*\S)/s; + } + } - } - } + } + } + } if (!$title and $podfile =~ /\.pod$/) { # probably a split pod so take first =head[12] as title for (my $i = 0; $i < @poddata; $i++) {