@@ -33,7 +33,12 @@ package main;
3333$BOTTOM_NAVIGATION = 1;
3434$AUTO_NAVIGATION = 0;
3535
36- $BODYTEXT = ' bgcolor="#ffffff"' ;
36+ $SUPPRESS_CONTENTS = 0;
37+ $SUPPRESS_INDEXES = 0;
38+
39+ # these exactly match the python.org colors
40+ $BODYTEXT = (' bgcolor="#ffffff" text="#000000"'
41+ . ' link="#0000bb" vlink="#551a8b" alink="#ff0000"' );
3742$CHILDLINE = " \n <p><hr>\n " ;
3843$VERBOSITY = 0;
3944
@@ -86,6 +91,23 @@ sub custom_driver_hook{
8691 print " \n adding $dir to \$ TEXINPUTS\n " ;
8792}
8893
94+ # Defining this allows us to remove all table of contents and index
95+ # processing using an init file; this is required to get rid of the
96+ # Table of Contents or we'd get a blank page. Based on a suggestion
97+ # from Ross Moore <[email protected] >.98+ #
99+ # Seems to require a more recent version of LaTeX2HTML than I've
100+ # been using, though.
101+ #
102+ sub preprocess{
103+ if ($SUPPRESS_CONTENTS ) {
104+ s /\\ (tableofcontents|listof(figures|tables))/ \2 / g ;
105+ }
106+ if ($SUPPRESS_INDEXES ) {
107+ s /\\ (print|make)index// g ;
108+ }
109+ }
110+
89111
90112sub set_icon_size{
91113 my ($name , $w , $h ) = @_ ;
@@ -95,22 +117,28 @@ sub set_icon_size{
95117foreach $name (split (/ / , ' up next previous contents index modules blank' )) {
96118 set_icon_size($name , 32, 32);
97119}
98- # The '_motif' is really annoying, and makes the HTML larger with no value
99- # added, so strip it off:
100- foreach $name (keys %icons ) {
101- my $icon = $icons {$name };
102- # Strip off the wasteful '_motif':
103- $icon =~ s / _motif// ;
104- # Change the greyed-out icons to be blank:
105- $icon =~ s / [a-z]*_gr/ blank/ ;
106- $icons {$name } = $icon ;
120+ sub adjust_icon_information{
121+ # The '_motif' is really annoying, and makes the HTML larger with no value
122+ # added, so strip it off:
123+ foreach $name (keys %icons ) {
124+ my $icon = $icons {$name };
125+ # Strip off the wasteful '_motif':
126+ $icon =~ s / _motif// ;
127+ # Change the greyed-out icons to be blank:
128+ $icon =~ s / [a-z]*_gr[.]/ blank./ ;
129+ # make sure we're using the latest $IMAGE_TYPE
130+ $icon =~ s / [.](gif|png)$/ .$IMAGE_TYPE / ;
131+ $icons {$name } = $icon ;
132+ }
133+ $icons {' blank' } = ' blank.' . $IMAGE_TYPE ;
134+
135+ $CUSTOM_BUTTONS = ' ' ;
136+ $BLANK_ICON = " \n <td>" . img_tag(' blank.' . $IMAGE_TYPE ) . " </td>" ;
137+ $BLANK_ICON =~ s / alt="blank"/ alt=""/ ;
138+ $NAV_BGCOLOR = " bgcolor=\" #99CCFF\" " ;
107139}
108- $icons { ' blank ' } = ' blank. ' . $IMAGE_TYPE ;
140+ adjust_icon_information() ;
109141
110- $CUSTOM_BUTTONS = ' ' ;
111- $BLANK_ICON = " \n <td>" . img_tag(' blank.' . $IMAGE_TYPE ) . " </td>" ;
112- $BLANK_ICON =~ s / alt="blank"/ alt=""/ ;
113- $NAV_BGCOLOR = " bgcolor=\" #99CCFF\" " ;
114142
115143sub make_nav_sectref{
116144 my ($label ,$title ) = @_ ;
@@ -127,17 +155,23 @@ sub make_nav_panel{
127155 . " \n <tr>"
128156 . " \n <td>$NEXT </td>"
129157 . " \n <td>$UP </td>"
130- . " \n <td>$PREVIOUS </td>"
131- . " \n <td align=center$NAV_BGCOLOR width=\" 100%\" >"
132- . " \n <b class=title>$t_title </b></td>"
133- . ($CONTENTS ? " \n <td>$CONTENTS </td>" : $BLANK_ICON )
134- . " \n <td>$CUSTOM_BUTTONS </td>" # module index
135- . ($INDEX ? " \n <td>$INDEX </td>" : $BLANK_ICON )
136- . " \n </tr></table>"
137- # . "<hr>"
138- . make_nav_sectref(" Next" , $NEXT_TITLE )
139- . make_nav_sectref(" Up" , $UP_TITLE )
140- . make_nav_sectref(" Previous" , $PREVIOUS_TITLE );
158+ . " \n <td>$PREVIOUS </td>" ;
159+ if ($SUPPRESS_CONTENTS && $SUPPRESS_INDEXES ) {
160+ $s .= (" \n <td align=right$NAV_BGCOLOR width=\" 100%\" >"
161+ . " \n <b class=title>$t_title \& nbsp;\& nbsp;\& nbsp;</b></td>" );
162+ }
163+ else {
164+ $s .= (" \n <td align=center$NAV_BGCOLOR width=\" 100%\" >"
165+ . " \n <b class=title>$t_title </b></td>"
166+ . ($CONTENTS ? " \n <td>$CONTENTS </td>" : $BLANK_ICON )
167+ . " \n <td>$CUSTOM_BUTTONS </td>" # module index
168+ . ($INDEX ? " \n <td>$INDEX </td>" : $BLANK_ICON ));
169+ }
170+ $s .= (" \n </tr></table>"
171+ . make_nav_sectref(" Next" , $NEXT_TITLE )
172+ . make_nav_sectref(" Up" , $UP_TITLE )
173+ . make_nav_sectref(" Previous" , $PREVIOUS_TITLE ));
174+ # remove these; they are unnecessary and cause error from validation
141175 $s =~ s / NAME="tex2html\d +"\n // g ;
142176 return $s ;
143177}
@@ -320,9 +354,13 @@ sub add_idx_hook{
320354}
321355
322356
323- # In addition to the standard stuff, add label to allow named node files.
357+ # In addition to the standard stuff, add label to allow named node files and
358+ # support suppression of the page complete (for HTML Help use).
324359sub do_cmd_tableofcontents {
325360 local ($_ ) = @_ ;
361+ # if ($SUPPRESS_CONTENTS) {
362+ # return $_;
363+ # }
326364 $TITLE = $toc_title ;
327365 $tocfile = $CURRENT_FILE ;
328366 my ($closures ,$reopens ) = preserve_open_tags();
@@ -416,29 +454,31 @@ sub add_bbl_and_idx_dummy_commands {
416454 my $id = $global {' max_id' };
417455
418456 s / ([\\ ]begin\s *$O\d +$C\s *thebibliography)/ $bbl_cnt ++; $1 / eg ;
419- s / ([\\ ]begin\s *$O\d +$C\s *thebibliography)/ $id ++; "\\ bibliography$O$id$C$O$id$C $1 "/ geo
420- # if ($bbl_cnt == 1)
421- ;
422- # }
457+ s / ([\\ ]begin\s *$O\d +$C\s *thebibliography)/ $id ++; "\\ bibliography$O$id$C$O$id$C $1 "/ geo ;
423458 # ----------------------------------------------------------------------
424459 # (FLD) This was added
425- my (@parts ) = split (/ \\ begin\s *$O \d +$C \s *theindex/ );
426- if (scalar (@parts ) == 3) {
427- # Be careful to re-write the string in place, since $_ is *not*
428- # returned explicity; *** nasty side-effect dependency! ***
429- print " \n add_bbl_and_idx_dummy_commands ==> adding module index" ;
430- my $rx = " ([\\\\ ]begin\\ s*$O \\ d+$C \\ s*theindex[\\ s\\ S]*)"
431- . " ([\\\\ ]begin\\ s*$O \\ d+$C \\ s*theindex)" ;
432- s / $rx/ \\ textohtmlmoduleindex \1 \\ textohtmlindex \2 / o ;
433- # Add a button to the navigation areas:
434- $CUSTOM_BUTTONS .= (" <a\n href=\" modindex.html\" >"
435- . img_tag(' modules.' .$IMAGE_TYPE ) . " </a>" );
460+ if ($SUPPRESS_INDEXES ) {
461+ $CUSTOM_BUTTONS .= img_tag(' blank.' . $IMAGE_TYPE );
436462 }
437463 else {
438- $CUSTOM_BUTTONS .= img_tag(' blank.' . $IMAGE_TYPE );
439- $global {' max_id' } = $id ; # not sure why....
440- s / ([\\ ]begin\s *$O\d +$C\s *theindex)/ \\ textohtmlindex $1 / o ;
441- s / [\\ ]printindex/ \\ textohtmlindex / o ;
464+ my (@parts ) = split (/ \\ begin\s *$O \d +$C \s *theindex/ );
465+ if (scalar (@parts ) == 3) {
466+ # Be careful to re-write the string in place, since $_ is *not*
467+ # returned explicity; *** nasty side-effect dependency! ***
468+ print " \n add_bbl_and_idx_dummy_commands ==> adding module index" ;
469+ my $rx = " ([\\\\ ]begin\\ s*$O \\ d+$C \\ s*theindex[\\ s\\ S]*)"
470+ . " ([\\\\ ]begin\\ s*$O \\ d+$C \\ s*theindex)" ;
471+ s / $rx/ \\ textohtmlmoduleindex \1 \\ textohtmlindex \2 / o ;
472+ # Add a button to the navigation areas:
473+ $CUSTOM_BUTTONS .= (" <a\n href=\" modindex.html\" >"
474+ . img_tag(' modules.' .$IMAGE_TYPE ) . " </a>" );
475+ }
476+ else {
477+ $CUSTOM_BUTTONS .= img_tag(' blank.' . $IMAGE_TYPE );
478+ $global {' max_id' } = $id ; # not sure why....
479+ s / ([\\ ]begin\s *$O\d +$C\s *theindex)/ \\ textohtmlindex $1 / o ;
480+ s / [\\ ]printindex/ \\ textohtmlindex / o ;
481+ }
442482 }
443483 # ----------------------------------------------------------------------
444484 lib_add_bbl_and_idx_dummy_commands()
0 commit comments