Commit f3bdd271 authored by Fred Drake's avatar Fred Drake

Some updates to allow ../tools/mkhowto to add various bits to the

supplemental l2h initialization file it creates and still get all the
right behavior.  In particular, it can change the image type and icon
location and not get inconsistent results.

Some code to help suppress various navigational pages; this might be
interesting when generating HTML to create HTML Help documents, since
the navigation support creates confusing hits in the full text
search.  HTML Help also provides a lot of the navigational
infrastructure, so duplicating it makes it more tedious to use.
parent ba01b0a0
...@@ -33,7 +33,12 @@ $TOP_NAVIGATION = 1; ...@@ -33,7 +33,12 @@ $TOP_NAVIGATION = 1;
$BOTTOM_NAVIGATION = 1; $BOTTOM_NAVIGATION = 1;
$AUTO_NAVIGATION = 0; $AUTO_NAVIGATION = 0;
$BODYTEXT = 'bgcolor="#ffffff"'; $SUPPRESS_CONTENTS = 0;
$SUPPRESS_INDEXES = 0;
# these exactly match the python.org colors
$BODYTEXT = ('bgcolor="#ffffff" text="#000000"'
. ' link="#0000bb" vlink="#551a8b" alink="#ff0000"');
$CHILDLINE = "\n<p><hr>\n"; $CHILDLINE = "\n<p><hr>\n";
$VERBOSITY = 0; $VERBOSITY = 0;
...@@ -86,6 +91,23 @@ sub custom_driver_hook{ ...@@ -86,6 +91,23 @@ sub custom_driver_hook{
print "\nadding $dir to \$TEXINPUTS\n"; print "\nadding $dir to \$TEXINPUTS\n";
} }
# Defining this allows us to remove all table of contents and index
# processing using an init file; this is required to get rid of the
# Table of Contents or we'd get a blank page. Based on a suggestion
# from Ross Moore <ross@ics.mq.edu.au>.
#
# Seems to require a more recent version of LaTeX2HTML than I've
# been using, though.
#
sub preprocess{
if ($SUPPRESS_CONTENTS) {
s/\\(tableofcontents|listof(figures|tables))/\2/g;
}
if ($SUPPRESS_INDEXES) {
s/\\(print|make)index//g;
}
}
sub set_icon_size{ sub set_icon_size{
my($name, $w, $h) = @_; my($name, $w, $h) = @_;
...@@ -95,22 +117,28 @@ sub set_icon_size{ ...@@ -95,22 +117,28 @@ sub set_icon_size{
foreach $name (split(/ /, 'up next previous contents index modules blank')) { foreach $name (split(/ /, 'up next previous contents index modules blank')) {
set_icon_size($name, 32, 32); set_icon_size($name, 32, 32);
} }
# The '_motif' is really annoying, and makes the HTML larger with no value sub adjust_icon_information{
# added, so strip it off: # The '_motif' is really annoying, and makes the HTML larger with no value
foreach $name (keys %icons) { # added, so strip it off:
my $icon = $icons{$name}; foreach $name (keys %icons) {
# Strip off the wasteful '_motif': my $icon = $icons{$name};
$icon =~ s/_motif//; # Strip off the wasteful '_motif':
# Change the greyed-out icons to be blank: $icon =~ s/_motif//;
$icon =~ s/[a-z]*_gr/blank/; # Change the greyed-out icons to be blank:
$icons{$name} = $icon; $icon =~ s/[a-z]*_gr[.]/blank./;
# make sure we're using the latest $IMAGE_TYPE
$icon =~ s/[.](gif|png)$/.$IMAGE_TYPE/;
$icons{$name} = $icon;
}
$icons{'blank'} = 'blank.' . $IMAGE_TYPE;
$CUSTOM_BUTTONS = '';
$BLANK_ICON = "\n<td>" . img_tag('blank.' . $IMAGE_TYPE) . "</td>";
$BLANK_ICON =~ s/alt="blank"/alt=""/;
$NAV_BGCOLOR = " bgcolor=\"#99CCFF\"";
} }
$icons{'blank'} = 'blank.' . $IMAGE_TYPE; adjust_icon_information();
$CUSTOM_BUTTONS = '';
$BLANK_ICON = "\n<td>" . img_tag('blank.' . $IMAGE_TYPE) . "</td>";
$BLANK_ICON =~ s/alt="blank"/alt=""/;
$NAV_BGCOLOR = " bgcolor=\"#99CCFF\"";
sub make_nav_sectref{ sub make_nav_sectref{
my($label,$title) = @_; my($label,$title) = @_;
...@@ -127,17 +155,23 @@ sub make_nav_panel{ ...@@ -127,17 +155,23 @@ sub make_nav_panel{
. "\n<tr>" . "\n<tr>"
. "\n<td>$NEXT</td>" . "\n<td>$NEXT</td>"
. "\n<td>$UP</td>" . "\n<td>$UP</td>"
. "\n<td>$PREVIOUS</td>" . "\n<td>$PREVIOUS</td>";
. "\n<td align=center$NAV_BGCOLOR width=\"100%\">" if ($SUPPRESS_CONTENTS && $SUPPRESS_INDEXES) {
. "\n <b class=title>$t_title</b></td>" $s .= ("\n<td align=right$NAV_BGCOLOR width=\"100%\">"
. ($CONTENTS ? "\n<td>$CONTENTS</td>" : $BLANK_ICON) . "\n <b class=title>$t_title\&nbsp;\&nbsp;\&nbsp;</b></td>");
. "\n<td>$CUSTOM_BUTTONS</td>" # module index }
. ($INDEX ? "\n<td>$INDEX</td>" : $BLANK_ICON) else {
. "\n</tr></table>" $s .= ("\n<td align=center$NAV_BGCOLOR width=\"100%\">"
#. "<hr>" . "\n <b class=title>$t_title</b></td>"
. make_nav_sectref("Next", $NEXT_TITLE) . ($CONTENTS ? "\n<td>$CONTENTS</td>" : $BLANK_ICON)
. make_nav_sectref("Up", $UP_TITLE) . "\n<td>$CUSTOM_BUTTONS</td>" # module index
. make_nav_sectref("Previous", $PREVIOUS_TITLE); . ($INDEX ? "\n<td>$INDEX</td>" : $BLANK_ICON));
}
$s .= ("\n</tr></table>"
. make_nav_sectref("Next", $NEXT_TITLE)
. make_nav_sectref("Up", $UP_TITLE)
. make_nav_sectref("Previous", $PREVIOUS_TITLE));
# remove these; they are unnecessary and cause error from validation
$s =~ s/ NAME="tex2html\d+"\n//g; $s =~ s/ NAME="tex2html\d+"\n//g;
return $s; return $s;
} }
...@@ -320,9 +354,13 @@ sub add_idx_hook{ ...@@ -320,9 +354,13 @@ sub add_idx_hook{
} }
# In addition to the standard stuff, add label to allow named node files. # In addition to the standard stuff, add label to allow named node files and
# support suppression of the page complete (for HTML Help use).
sub do_cmd_tableofcontents { sub do_cmd_tableofcontents {
local($_) = @_; local($_) = @_;
# if ($SUPPRESS_CONTENTS) {
# return $_;
# }
$TITLE = $toc_title; $TITLE = $toc_title;
$tocfile = $CURRENT_FILE; $tocfile = $CURRENT_FILE;
my($closures,$reopens) = preserve_open_tags(); my($closures,$reopens) = preserve_open_tags();
...@@ -416,29 +454,31 @@ sub add_bbl_and_idx_dummy_commands { ...@@ -416,29 +454,31 @@ sub add_bbl_and_idx_dummy_commands {
my $id = $global{'max_id'}; my $id = $global{'max_id'};
s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; 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 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo;
#if ($bbl_cnt == 1)
;
#}
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# (FLD) This was added # (FLD) This was added
my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/); if ($SUPPRESS_INDEXES) {
if (scalar(@parts) == 3) { $CUSTOM_BUTTONS .= img_tag('blank.' . $IMAGE_TYPE);
# Be careful to re-write the string in place, since $_ is *not*
# returned explicity; *** nasty side-effect dependency! ***
print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
. "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
s/$rx/\\textohtmlmoduleindex \1 \\textohtmlindex \2/o;
# Add a button to the navigation areas:
$CUSTOM_BUTTONS .= ("<a\n href=\"modindex.html\">"
. img_tag('modules.'.$IMAGE_TYPE) . "</a>");
} }
else { else {
$CUSTOM_BUTTONS .= img_tag('blank.' . $IMAGE_TYPE); my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
$global{'max_id'} = $id; # not sure why.... if (scalar(@parts) == 3) {
s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o; # Be careful to re-write the string in place, since $_ is *not*
s/[\\]printindex/\\textohtmlindex /o; # returned explicity; *** nasty side-effect dependency! ***
print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
. "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
s/$rx/\\textohtmlmoduleindex \1 \\textohtmlindex \2/o;
# Add a button to the navigation areas:
$CUSTOM_BUTTONS .= ("<a\n href=\"modindex.html\">"
. img_tag('modules.'.$IMAGE_TYPE) . "</a>");
}
else {
$CUSTOM_BUTTONS .= img_tag('blank.' . $IMAGE_TYPE);
$global{'max_id'} = $id; # not sure why....
s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
s/[\\]printindex/\\textohtmlindex /o;
}
} }
#---------------------------------------------------------------------- #----------------------------------------------------------------------
lib_add_bbl_and_idx_dummy_commands() lib_add_bbl_and_idx_dummy_commands()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment