From e0f138939ac28fffc7b06bea23950f5dd6a72f37 Mon Sep 17 00:00:00 2001 From: Zefram Date: Sat, 25 Feb 2012 19:19:06 +0000 Subject: [PATCH] update perlfunc.html generator The format of the individual function HTML files has changed. The index generator needs to update to successfully extract the NAME sections. Fixes [perl #107870]. --- installhtml | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/installhtml b/installhtml index 0208cc8..6375ced 100644 --- a/installhtml +++ b/installhtml @@ -291,14 +291,11 @@ sub parse_command_line { sub create_index { my($html, $dir) = @_; (my $pod = $dir) =~ s,^.*/,,; - my(@files, @filedata, @index, $file); - my($lcp1,$lcp2); - # get the list of .html files in this directory opendir(DIR, $dir) || die "$0: error opening directory $dir for reading: $!\n"; - @files = sort(grep(/\.html?$/, readdir(DIR))); + my @files = sort(grep(/\.html?$/, readdir(DIR))); closedir(DIR); open(HTML, ">$html") || @@ -307,40 +304,28 @@ sub create_index { # for each .html file in the directory, extract the index # embedded in the file and throw it into the big index. print HTML "
\n"; - foreach $file (@files) { - $/ = ""; + foreach my $file (@files) { - open(IN, "<$dir/$file") || - die "$0: error opening $dir/$file for input: $!\n"; - @filedata = ; - close(IN); + my $filedata = do { + open(my $in, "<$dir/$file") || + die "$0: error opening $dir/$file for input: $!\n"; + local $/ = undef; + <$in>; + }; # pull out the NAME section - my $name; - ($name) = grep(/name="name"/i, @filedata); - ($lcp1,$lcp2) = ($name =~ m,/H1>\s(\S+)\s[\s-]*(.*?)\s*$,smi); - if (defined $lcp1 and $lcp1 =~ m,^

$,i) { # Uninteresting. Try again. - ($lcp1,$lcp2) = ($name =~ m,/H1>\s

\s*(\S+)\s[\s-]*(.*?)\s*$,smi); - } + my($lcp1, $lcp2) = + ($filedata =~ + m#

NAME

\s*

\s*(\S+)\s+-\s+(\S.*?\S)

#); + defined $lcp1 or die "$0: can't find NAME section in $dir/$file\n"; + my $url= "$pod/$file" ; if ( ! defined $Options{htmlroot} || $Options{htmlroot} eq '' ) { $url = Pod::Html::relativize_url( "$pod/$file", $html ) ; } - if (defined $lcp1) { - print HTML qq(
); - print HTML "$lcp1
$lcp2
\n"; - } - - next; - - @index = grep(/.*/s, - @filedata); - for (@index) { - s/(\s*\s*)/$lcp2/s; - s,#,$dir/$file#,g; - print HTML "$_\n


\n"; - } + print HTML qq(

); + print HTML "$lcp1
$lcp2
\n"; } print HTML "
\n"; -- 1.8.3.1