Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a219b41

Browse files
committed
Add better support for Mozilla's use of <link> elements.
1 parent 15e0353 commit a219b41

1 file changed

Lines changed: 41 additions & 10 deletions

File tree

Doc/perl/l2hinit.perl

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ package main;
3333
$INDEX_COLUMNS = 2;
3434
$MODULE_INDEX_COLUMNS = 4;
3535

36+
$HAVE_MODULE_INDEX = 0;
37+
$HAVE_GENERAL_INDEX = 0;
38+
$HAVE_TABLE_OF_CONTENTS = 0;
39+
3640

3741
# A little painful, but lets us clean up the top level directory a little,
3842
# and not be tied to the current directory (as far as I can tell). Testing
@@ -476,6 +480,9 @@ sub do_cmd_textohtmlmoduleindex {
476480
sub add_bbl_and_idx_dummy_commands {
477481
my $id = $global{'max_id'};
478482

483+
if (/[\\]tableofcontents/) {
484+
$HAVE_TABLE_OF_CONTENTS = 1;
485+
}
479486
s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
480487
s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo;
481488
my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
@@ -490,6 +497,11 @@ sub add_bbl_and_idx_dummy_commands {
490497
$CUSTOM_BUTTONS .= ('<a href="modindex.html" title="Module Index">'
491498
. get_my_icon('modules')
492499
. '</a>');
500+
$HAVE_MODULE_INDEX = 1;
501+
$HAVE_GENERAL_INDEX = 1;
502+
}
503+
elsif (scalar(@parts) == 2) {
504+
$HAVE_GENERAL_INDEX = 1;
493505
}
494506
else {
495507
$CUSTOM_BUTTONS .= get_my_icon('blank');
@@ -554,6 +566,7 @@ sub set_depth_levels {
554566
# This is added to get rid of the long comment that follows the
555567
# doctype declaration; MSIE5 on NT4 SP4 barfs on it and drops the
556568
# content of the page.
569+
$MY_PARTIAL_HEADER = '';
557570
sub make_head_and_body {
558571
my($title, $body) = @_;
559572
$body = " $body" unless ($body eq '');
@@ -579,20 +592,38 @@ sub make_head_and_body {
579592
$DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE//"
580593
. ($ISO_LANGUAGE ? $ISO_LANGUAGE : $isolanguage) . "\">\n";
581594
}
595+
if ($MY_PARTIAL_HEADER eq '') {
596+
$STYLESHEET = $FILE.".css" unless $STYLESHEET;
597+
$MY_PARTIAL_HEADER = join('',
598+
($CHARSET && $HTML_VERSION ge "2.1"
599+
? ('<meta http-equiv="Content-Type" content="text/html; '
600+
. "charset=$charset\">\n")
601+
: ''),
602+
($BASE ? "<base href=\"$BASE\">\n" : ''),
603+
"<link rel=\"STYLESHEET\" href=\"$STYLESHEET\">\n",
604+
"<link rel=\"first\" href=\"$FILE.html\">\n",
605+
($HAVE_TABLE_OF_CONTENTS
606+
? ('<link rel="contents" href="contents.html" title="Contents">'
607+
. "\n")
608+
: ''),
609+
($HAVE_GENERAL_INDEX
610+
? '<link rel="index" href="genindex.html" title="Index">'
611+
: ''),
612+
# disable for now -- Mozilla doesn't do well with multiple indexes
613+
# ($HAVE_MODULE_INDEX
614+
# ? '<link rel="index" href="modindex.html" title="Module Index">'
615+
# . "\n"
616+
# : ''),
617+
$more_links_mark);
618+
}
582619

583-
$STYLESHEET = $FILE.".css" unless $STYLESHEET;
584620
if (!$charset && $CHARSET) { $charset = $CHARSET; $charset =~ s/_/\-/go; }
585621

586622
join('', ($DOCTYPE ? $DTDcomment : '' )
587-
,"<html>\n<head>\n<title>", $title, "</title>\n"
588-
, &meta_information($title)
589-
, ($CHARSET && $HTML_VERSION ge "2.1" ?
590-
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$charset\">\n"
591-
: "" )
592-
, ($BASE ? "<base href=\"$BASE\">\n" : "" )
593-
, "<link rel=\"STYLESHEET\" href=\"$STYLESHEET\">"
594-
, $more_links_mark
595-
, "\n</head>\n<body$body>");
623+
, "<html>\n<head>\n<title>", $title, "</title>\n"
624+
, &meta_information($title)
625+
, $MY_PARTIAL_HEADER
626+
, "\n</head>\n<body$body>");
596627
}
597628

598629
1; # This must be the last line

0 commit comments

Comments
 (0)