diff --git a/Doc/perl/l2hinit.perl b/Doc/perl/l2hinit.perl index cd66a032029..35c1d8bf7f8 100644 --- a/Doc/perl/l2hinit.perl +++ b/Doc/perl/l2hinit.perl @@ -33,6 +33,10 @@ $VERBOSITY = 0; $INDEX_COLUMNS = 2; $MODULE_INDEX_COLUMNS = 4; +$HAVE_MODULE_INDEX = 0; +$HAVE_GENERAL_INDEX = 0; +$HAVE_TABLE_OF_CONTENTS = 0; + # A little painful, but lets us clean up the top level directory a little, # and not be tied to the current directory (as far as I can tell). Testing @@ -476,6 +480,9 @@ sub do_cmd_textohtmlmoduleindex { sub add_bbl_and_idx_dummy_commands { my $id = $global{'max_id'}; + if (/[\\]tableofcontents/) { + $HAVE_TABLE_OF_CONTENTS = 1; + } s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo; my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/); @@ -490,6 +497,11 @@ sub add_bbl_and_idx_dummy_commands { $CUSTOM_BUTTONS .= ('' . get_my_icon('modules') . ''); + $HAVE_MODULE_INDEX = 1; + $HAVE_GENERAL_INDEX = 1; + } + elsif (scalar(@parts) == 2) { + $HAVE_GENERAL_INDEX = 1; } else { $CUSTOM_BUTTONS .= get_my_icon('blank'); @@ -554,6 +566,7 @@ sub set_depth_levels { # This is added to get rid of the long comment that follows the # doctype declaration; MSIE5 on NT4 SP4 barfs on it and drops the # content of the page. +$MY_PARTIAL_HEADER = ''; sub make_head_and_body { my($title, $body) = @_; $body = " $body" unless ($body eq ''); @@ -579,20 +592,38 @@ sub make_head_and_body { $DTDcomment = "\n"; } + if ($MY_PARTIAL_HEADER eq '') { + $STYLESHEET = $FILE.".css" unless $STYLESHEET; + $MY_PARTIAL_HEADER = join('', + ($CHARSET && $HTML_VERSION ge "2.1" + ? ('\n") + : ''), + ($BASE ? "\n" : ''), + "\n", + "\n", + ($HAVE_TABLE_OF_CONTENTS + ? ('' + . "\n") + : ''), + ($HAVE_GENERAL_INDEX + ? '' + : ''), + # disable for now -- Mozilla doesn't do well with multiple indexes + # ($HAVE_MODULE_INDEX + # ? '' + # . "\n" + # : ''), + $more_links_mark); + } - $STYLESHEET = $FILE.".css" unless $STYLESHEET; if (!$charset && $CHARSET) { $charset = $CHARSET; $charset =~ s/_/\-/go; } join('', ($DOCTYPE ? $DTDcomment : '' ) - ,"\n\n", $title, "\n" - , &meta_information($title) - , ($CHARSET && $HTML_VERSION ge "2.1" ? - "\n" - : "" ) - , ($BASE ? "\n" : "" ) - , "" - , $more_links_mark - , "\n\n"); + , "\n\n", $title, "\n" + , &meta_information($title) + , $MY_PARTIAL_HEADER + , "\n\n"); } 1; # This must be the last line