diff options
author | Unknown Contributor <hansm@euronet.nl> | 1997-05-06 00:28:06 +0200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-05-08 00:00:00 +1200 |
commit | be173d55224d502f8f43b651987d3769cef41280 (patch) | |
tree | 37532baf1109f6ea58fb9a6338d529d8dd29f44b /lib/Pod | |
parent | c0e1ccf0a4885cd7426ea5414ca3ce958817877e (diff) | |
download | perl-be173d55224d502f8f43b651987d3769cef41280.tar.gz |
Three bugs in pod2html
I had three problems with the pod2html distributed with perl 5.00399:
1. The HTML code generated begins with a series of hyperlinks to all
sections of the file. Pod directives occurring in the section
titles (=head directives) were not translated.
2. C<foo()> sets translates to <CODE>foo</CODE> -- the () disappear.
3. Perlpod promises that example code gets typeset with tab stops
every 8 columns. HTML makes no such promise, hence pod2html must
expand tabs.
The first three hunks of the patch below solve #1, hunk 4 fixes a
call to &process_text with the wrong number of args, hunk 5 solves #3
and hunk 6 solves #2.x
p5p-msgid: 199705052228.AAA25351@mail.euronet.nl
Diffstat (limited to 'lib/Pod')
-rw-r--r-- | lib/Pod/Html.pm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index a00d21057b..aaefc3cdac 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -712,6 +712,10 @@ sub scan_headings { my($sections, @data) = @_; my($tag, $which_head, $title, $listdepth, $index); + # here we need local $ignore = 0; + # unfortunately, we can't have it, because $ignore is lexical + $ignore = 0; + $listdepth = 0; $index = ""; @@ -732,7 +736,8 @@ sub scan_headings { $listdepth = $which_head; $index .= "\n" . ("\t" x $listdepth) . "<LI>" . - "<A HREF=\"#" . htmlify(0,$title) . "\">$title</A>"; + "<A HREF=\"#" . htmlify(0,$title) . "\">" . + process_text(\$title, 0) . "</A>"; } } @@ -744,6 +749,8 @@ sub scan_headings { # get rid of bogus lists $index =~ s,\t*<UL>\s*</UL>\n,,g; + $ignore = 1; # retore old value; + return $index; } @@ -803,7 +810,7 @@ sub process_head { print HTML "<HR>\n" unless $listlevel || $top; print HTML "<H$level>"; # unless $listlevel; #print HTML "<H$level>" unless $listlevel; - my $convert = $heading; process_text(\$convert); + my $convert = $heading; process_text(\$convert, 0); print HTML '<A NAME="' . htmlify(0,$heading) . "\">$convert</A>"; print HTML "</H$level>"; # unless $listlevel; print HTML "\n"; @@ -998,7 +1005,12 @@ sub process_text { $rest = $$text; if ($rest =~ /^\s+/) { # preformatted text, no pod directives - $rest =~ s/\n+\Z//; + $rest =~ s/\n+\Z//; + $rest =~ s#.*# + my $line = $&; + 1 while $line =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e; + $line; + #eg; $rest =~ s/&/&/g; $rest =~ s/</</g; @@ -1364,7 +1376,7 @@ sub process_C { $s1 = $str; $s1 =~ s/\([^()]*\)//g; # delete parentheses - $str = $s2 = $s1; + $s2 = $s1; $s1 =~ s/\W//g; # delete bogus characters # if there was a pod file that we found earlier with an appropriate |