Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 1 | # LaTeX2HTML support base for use with Python documentation. |
Fred Drake | 41814bc | 1998-05-11 18:23:35 +0000 | [diff] [blame] | 2 | |
| 3 | package main; |
| 4 | |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 5 | use L2hos; |
| 6 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 7 | $HTML_VERSION = 4.01; |
| 8 | $LOWER_CASE_TAGS = 1; |
| 9 | $NO_FRENCH_QUOTES = 1; |
| 10 | |
| 11 | # '' in \code{...} is still converted, so we can't use this yet. |
| 12 | #$USE_CURLY_QUOTES = 1; |
| 13 | |
| 14 | # Force Unicode support to be loaded; request UTF-8 output. |
| 15 | do_require_extension('unicode'); |
| 16 | do_require_extension('utf8'); |
| 17 | $HTML_OPTIONS = 'utf8'; |
Fred Drake | 28e7b4c | 1998-10-20 18:14:20 +0000 | [diff] [blame] | 18 | |
Fred Drake | 6aa5d48 | 1998-08-11 03:14:50 +0000 | [diff] [blame] | 19 | $MAX_LINK_DEPTH = 2; |
Fred Drake | d757165 | 1998-04-23 20:06:24 +0000 | [diff] [blame] | 20 | $ADDRESS = ''; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 21 | |
Fred Drake | e194beb | 1998-05-19 19:38:49 +0000 | [diff] [blame] | 22 | $NO_FOOTNODE = 1; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 23 | $NUMBERED_FOOTNOTES = 1; |
| 24 | |
| 25 | # Python documentation uses section numbers to support references to match |
| 26 | # in the printed and online versions. |
| 27 | # |
| 28 | $SHOW_SECTION_NUMBERS = 1; |
| 29 | |
Fred Drake | 15a159c | 2002-10-01 15:20:20 +0000 | [diff] [blame] | 30 | $ICONSERVER = '.'; |
Fred Drake | f730fc3 | 2000-08-31 07:19:07 +0000 | [diff] [blame] | 31 | $IMAGE_TYPE = 'gif'; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 32 | |
Fred Drake | 6aa5d48 | 1998-08-11 03:14:50 +0000 | [diff] [blame] | 33 | # Control where the navigation bars should show up: |
| 34 | $TOP_NAVIGATION = 1; |
| 35 | $BOTTOM_NAVIGATION = 1; |
| 36 | $AUTO_NAVIGATION = 0; |
| 37 | |
Fred Drake | 1681627 | 2000-09-16 20:40:44 +0000 | [diff] [blame] | 38 | $BODYTEXT = ''; |
Fred Drake | 0739c44 | 2003-09-04 22:16:45 +0000 | [diff] [blame] | 39 | $CHILDLINE = "\n<p><br /></p><hr class='online-navigation' />\n"; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 40 | $VERBOSITY = 0; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 41 | |
Fred Drake | 4d10b43 | 1998-08-07 20:51:58 +0000 | [diff] [blame] | 42 | # default # of columns for the indexes |
Fred Drake | aa3f9fb | 1998-08-07 19:52:37 +0000 | [diff] [blame] | 43 | $INDEX_COLUMNS = 2; |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 44 | $MODULE_INDEX_COLUMNS = 4; |
Fred Drake | aa3f9fb | 1998-08-07 19:52:37 +0000 | [diff] [blame] | 45 | |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 46 | $HAVE_MODULE_INDEX = 0; |
| 47 | $HAVE_GENERAL_INDEX = 0; |
| 48 | $HAVE_TABLE_OF_CONTENTS = 0; |
| 49 | |
Fred Drake | e03e1fe | 2002-04-05 17:34:50 +0000 | [diff] [blame] | 50 | $AESOP_META_TYPE = 'information'; |
| 51 | |
Fred Drake | c9f2c14 | 1998-03-11 12:08:21 +0000 | [diff] [blame] | 52 | |
Fred Drake | db34a1e | 1998-03-10 23:02:57 +0000 | [diff] [blame] | 53 | # A little painful, but lets us clean up the top level directory a little, |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 54 | # and not be tied to the current directory (as far as I can tell). Testing |
| 55 | # an existing definition of $mydir is needed since it cannot be computed when |
| 56 | # run under mkhowto with recent versions of LaTeX2HTML, since this file is |
| 57 | # not read directly by LaTeX2HTML any more. mkhowto is required to prepend |
| 58 | # the required definition at the top of the actual input file. |
Fred Drake | db34a1e | 1998-03-10 23:02:57 +0000 | [diff] [blame] | 59 | # |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 60 | if (!defined $mydir) { |
| 61 | use Cwd; |
| 62 | use File::Basename; |
| 63 | ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*'); |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 64 | chop $mydir; # remove trailing '/' |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 65 | $mydir = getcwd() . "$dd$mydir" |
| 66 | unless $mydir =~ s|^/|/|; |
| 67 | } |
Fred Drake | db34a1e | 1998-03-10 23:02:57 +0000 | [diff] [blame] | 68 | $LATEX2HTMLSTYLES = "$mydir$envkey$LATEX2HTMLSTYLES"; |
Fred Drake | b3a3ed8 | 1998-07-24 22:17:34 +0000 | [diff] [blame] | 69 | push (@INC, $mydir); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 70 | |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 71 | ($myrootname, $myrootdir, $myext) = fileparse($mydir, '\..*'); |
| 72 | chop $myrootdir; |
| 73 | |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 74 | |
Fred Drake | a4565b0 | 1998-05-15 17:14:17 +0000 | [diff] [blame] | 75 | # Hackish way to get the appropriate paper-*/ directory into $TEXINPUTS; |
| 76 | # pass in the paper size (a4 or letter) as the environment variable PAPER |
| 77 | # to add the right directory. If not given, the current directory is |
| 78 | # added instead for use with HOWTO processing. |
| 79 | # |
| 80 | if (defined $ENV{'PAPER'}) { |
| 81 | $mytexinputs = "$myrootdir${dd}paper-$ENV{'PAPER'}$envkey"; |
| 82 | } |
| 83 | else { |
| 84 | $mytexinputs = getcwd() . $envkey; |
| 85 | } |
| 86 | $mytexinputs .= "$myrootdir${dd}texinputs"; |
| 87 | |
| 88 | |
Fred Drake | b35f2b7 | 1999-09-23 16:53:09 +0000 | [diff] [blame] | 89 | # Change this variable to change the text added in "About this document..."; |
| 90 | # this should be an absolute pathname to get it right. |
| 91 | # |
| 92 | $ABOUT_FILE = "$myrootdir${dd}html${dd}stdabout.dat"; |
| 93 | |
| 94 | |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 95 | sub custom_driver_hook { |
Fred Drake | a4565b0 | 1998-05-15 17:14:17 +0000 | [diff] [blame] | 96 | # |
| 97 | # This adds the directory of the main input file to $TEXINPUTS; it |
| 98 | # seems to be sufficiently general that it should be fine for HOWTO |
| 99 | # processing. |
| 100 | # |
Fred Drake | cc2e48d | 2003-09-27 16:04:23 +0000 | [diff] [blame] | 101 | # XXX This still isn't quite right; we should actually be inserting |
| 102 | # $mytexinputs just before any empty entry in TEXINPUTS is one |
| 103 | # exists instead of just concatenating the pieces like we do here. |
| 104 | # |
Fred Drake | 73c5b660 | 2002-10-24 16:36:05 +0000 | [diff] [blame] | 105 | my $file = $_[0]; |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 106 | my($jobname, $dir, $ext) = fileparse($file, '\..*'); |
| 107 | $dir = L2hos->Make_directory_absolute($dir); |
Fred Drake | a4565b0 | 1998-05-15 17:14:17 +0000 | [diff] [blame] | 108 | $dir =~ s/$dd$//; |
| 109 | $TEXINPUTS = "$dir$envkey$mytexinputs"; |
Fred Drake | cc2e48d | 2003-09-27 16:04:23 +0000 | [diff] [blame] | 110 | # Push everything into $TEXINPUTS since LaTeX2HTML doesn't pick |
Georg Brandl | 7eb4b7d | 2005-07-22 21:49:32 +0000 | [diff] [blame] | 111 | # this up on its own; we clear $ENV{'TEXINPUTS'} so the value set |
Fred Drake | cc2e48d | 2003-09-27 16:04:23 +0000 | [diff] [blame] | 112 | # for this by the main LaTeX2HTML script doesn't contain duplicate |
| 113 | # directories. |
| 114 | if ($ENV{'TEXINPUTS'}) { |
| 115 | $TEXINPUTS .= "$envkey$ENV{'TEXINPUTS'}"; |
| 116 | $ENV{'TEXINPUTS'} = undef; |
| 117 | } |
| 118 | print "\nSetting \$TEXINPUTS to $TEXINPUTS\n"; |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 119 | |
| 120 | # Not sure why we need to deal with this both here and at the top, |
| 121 | # but this is needed to actually make it work. |
| 122 | do_require_extension('utf8'); |
| 123 | $charset = $utf8_str; |
| 124 | $CHARSET = $utf8_str; |
| 125 | $USE_UTF = 1; |
Fred Drake | 191439a | 1999-09-22 19:50:51 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Fred Drake | a4565b0 | 1998-05-15 17:14:17 +0000 | [diff] [blame] | 128 | |
Fred Drake | 3f26af7 | 2004-01-13 23:43:58 +0000 | [diff] [blame] | 129 | # $CUSTOM_BUTTONS is only used for the module index link. |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 130 | $CUSTOM_BUTTONS = ''; |
Fred Drake | 062bc6e | 1998-08-13 22:03:46 +0000 | [diff] [blame] | 131 | |
Fred Drake | bf8ec3e | 2003-05-02 20:18:01 +0000 | [diff] [blame] | 132 | sub make_nav_sectref($$$) { |
| 133 | my($label, $linktype, $title) = @_; |
Fred Drake | beb27bf | 1999-02-16 17:22:32 +0000 | [diff] [blame] | 134 | if ($title) { |
Fred Drake | 02c7082 | 2000-09-19 15:36:19 +0000 | [diff] [blame] | 135 | if ($title =~ /\<[aA] /) { |
Fred Drake | bf8ec3e | 2003-05-02 20:18:01 +0000 | [diff] [blame] | 136 | $title =~ s/\<[aA] /<a class="sectref" rel="$linktype" /; |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 137 | $title =~ s/ HREF=/ href=/; |
Fred Drake | 02c7082 | 2000-09-19 15:36:19 +0000 | [diff] [blame] | 138 | } |
| 139 | else { |
| 140 | $title = "<span class=\"sectref\">$title</span>"; |
| 141 | } |
Fred Drake | bf8ec3e | 2003-05-02 20:18:01 +0000 | [diff] [blame] | 142 | return "<b class=\"navlabel\">$label:</b>\n$title\n"; |
Fred Drake | beb27bf | 1999-02-16 17:22:32 +0000 | [diff] [blame] | 143 | } |
| 144 | return ''; |
| 145 | } |
| 146 | |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 147 | @my_icon_tags = (); |
| 148 | $my_icon_tags{'next'} = 'Next Page'; |
| 149 | $my_icon_tags{'next_page'} = 'Next Page'; |
| 150 | $my_icon_tags{'previous'} = 'Previous Page'; |
| 151 | $my_icon_tags{'previous_page'} = 'Previous Page'; |
| 152 | $my_icon_tags{'up'} = 'Up One Level'; |
| 153 | $my_icon_tags{'contents'} = 'Contents'; |
| 154 | $my_icon_tags{'index'} = 'Index'; |
| 155 | $my_icon_tags{'modules'} = 'Module Index'; |
| 156 | |
Fred Drake | b31d36c | 2001-01-04 15:16:01 +0000 | [diff] [blame] | 157 | @my_icon_names = (); |
| 158 | $my_icon_names{'previous_page'} = 'previous'; |
| 159 | $my_icon_names{'next_page'} = 'next'; |
| 160 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 161 | sub get_my_icon($) { |
Fred Drake | 73c5b660 | 2002-10-24 16:36:05 +0000 | [diff] [blame] | 162 | my $name = $_[0]; |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 163 | my $text = $my_icon_tags{$name}; |
Fred Drake | b31d36c | 2001-01-04 15:16:01 +0000 | [diff] [blame] | 164 | if ($my_icon_names{$name}) { |
| 165 | $name = $my_icon_names{$name}; |
| 166 | } |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 167 | if ($text eq '') { |
| 168 | $name = 'blank'; |
| 169 | } |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 170 | my $iconserver = ($ICONSERVER eq '.') ? '' : "$ICONSERVER/"; |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 171 | return "<img src='$iconserver$name.$IMAGE_TYPE'\n border='0'" |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 172 | . " height='32' alt='$text' width='32' />"; |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 173 | } |
| 174 | |
Fred Drake | 8b34e7c | 2003-05-03 02:07:22 +0000 | [diff] [blame] | 175 | sub unlinkify($) { |
| 176 | my $text = "$_[0]"; |
| 177 | $text =~ s|</[aA]>||; |
| 178 | $text =~ s|<a\s+[^>]*>||i; |
| 179 | return $text; |
| 180 | } |
| 181 | |
| 182 | sub use_icon($$$) { |
| 183 | my($rel,$str,$title) = @_; |
Fred Drake | 3f26af7 | 2004-01-13 23:43:58 +0000 | [diff] [blame] | 184 | if ($str) { |
Fred Drake | 8b34e7c | 2003-05-03 02:07:22 +0000 | [diff] [blame] | 185 | my $s = "$str"; |
| 186 | if ($s =~ /\<tex2html_([a-z_]+)_visible_mark\>/) { |
| 187 | my $r = get_my_icon($1); |
| 188 | $s =~ s/\<tex2html_[a-z_]+_visible_mark\>/$r/; |
| 189 | } |
Fred Drake | e0bdaef | 2004-11-05 06:42:22 +0000 | [diff] [blame] | 190 | $s =~ s/<[aA] /<a rel="$rel" title="$title"\n /; |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 191 | $s =~ s/ HREF=/ href=/; |
Fred Drake | 8b34e7c | 2003-05-03 02:07:22 +0000 | [diff] [blame] | 192 | return $s; |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 193 | } |
Fred Drake | 8b34e7c | 2003-05-03 02:07:22 +0000 | [diff] [blame] | 194 | else { |
| 195 | return get_my_icon('blank'); |
| 196 | } |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 197 | } |
| 198 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 199 | sub make_nav_panel() { |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 200 | my $s; |
Fred Drake | 8b34e7c | 2003-05-03 02:07:22 +0000 | [diff] [blame] | 201 | # new iconic rel iconic page title |
Fred Drake | 216b249 | 2004-09-09 05:13:52 +0000 | [diff] [blame] | 202 | my $next = use_icon('next', $NEXT, unlinkify($NEXT_TITLE)); |
| 203 | my $up = use_icon('parent', $UP, unlinkify($UP_TITLE)); |
| 204 | my $previous = use_icon('prev', $PREVIOUS, unlinkify($PREVIOUS_TITLE)); |
| 205 | my $contents = use_icon('contents', $CONTENTS, 'Table of Contents'); |
| 206 | my $index = use_icon('index', $INDEX, 'Index'); |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 207 | if (!$CUSTOM_BUTTONS) { |
Fred Drake | 8b34e7c | 2003-05-03 02:07:22 +0000 | [diff] [blame] | 208 | $CUSTOM_BUTTONS = get_my_icon('blank'); |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 209 | } |
| 210 | $s = ('<table align="center" width="100%" cellpadding="0" cellspacing="2">' |
| 211 | . "\n<tr>" |
| 212 | # left-hand side |
Fred Drake | 216b249 | 2004-09-09 05:13:52 +0000 | [diff] [blame] | 213 | . "\n<td class='online-navigation'>$previous</td>" |
| 214 | . "\n<td class='online-navigation'>$up</td>" |
| 215 | . "\n<td class='online-navigation'>$next</td>" |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 216 | # title box |
Fred Drake | f730fc3 | 2000-08-31 07:19:07 +0000 | [diff] [blame] | 217 | . "\n<td align=\"center\" width=\"100%\">$t_title</td>" |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 218 | # right-hand side |
Fred Drake | 216b249 | 2004-09-09 05:13:52 +0000 | [diff] [blame] | 219 | . "\n<td class='online-navigation'>$contents</td>" |
Fred Drake | 0739c44 | 2003-09-04 22:16:45 +0000 | [diff] [blame] | 220 | # module index |
| 221 | . "\n<td class='online-navigation'>$CUSTOM_BUTTONS</td>" |
Fred Drake | 216b249 | 2004-09-09 05:13:52 +0000 | [diff] [blame] | 222 | . "\n<td class='online-navigation'>$index</td>" |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 223 | . "\n</tr></table>\n" |
| 224 | # textual navigation |
Fred Drake | 0739c44 | 2003-09-04 22:16:45 +0000 | [diff] [blame] | 225 | . "<div class='online-navigation'>\n" |
Fred Drake | bf8ec3e | 2003-05-02 20:18:01 +0000 | [diff] [blame] | 226 | . make_nav_sectref("Previous", "prev", $PREVIOUS_TITLE) |
| 227 | . make_nav_sectref("Up", "parent", $UP_TITLE) |
| 228 | . make_nav_sectref("Next", "next", $NEXT_TITLE) |
Fred Drake | 0739c44 | 2003-09-04 22:16:45 +0000 | [diff] [blame] | 229 | . "</div>\n" |
Fred Drake | 4640e13 | 2000-07-31 20:13:23 +0000 | [diff] [blame] | 230 | ); |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 231 | # remove these; they are unnecessary and cause errors from validation |
| 232 | $s =~ s/ NAME="tex2html\d+"\n */ /g; |
| 233 | return $s; |
| 234 | } |
| 235 | |
Fred Drake | fb6499f | 2001-10-26 14:16:23 +0000 | [diff] [blame] | 236 | sub add_child_links { |
| 237 | my $toc = add_real_child_links(@_); |
| 238 | $toc =~ s|\s*</[aA]>|</a>|g; |
| 239 | $toc =~ s/ NAME=\"tex2html\d+\"\s*href=/ href=/gi; |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 240 | $toc =~ s|</UL>(\s*<BR( /)?>)?|</ul>|gi; |
Fred Drake | 0739c44 | 2003-09-04 22:16:45 +0000 | [diff] [blame] | 241 | if ($toc =~ / NAME=["']CHILD_LINKS["']/) { |
| 242 | return "<div class='online-navigation'>\n$toc</div>\n"; |
| 243 | } |
Fred Drake | fb6499f | 2001-10-26 14:16:23 +0000 | [diff] [blame] | 244 | return $toc; |
| 245 | } |
| 246 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 247 | sub get_version_text() { |
Fred Drake | 7497bd3 | 2000-10-25 16:18:10 +0000 | [diff] [blame] | 248 | if ($PACKAGE_VERSION ne '' && $t_date) { |
| 249 | return ("<span class=\"release-info\">" |
Fred Drake | dce975c | 2001-06-20 21:31:36 +0000 | [diff] [blame] | 250 | . "Release $PACKAGE_VERSION$RELEASE_INFO," |
Fred Drake | 7497bd3 | 2000-10-25 16:18:10 +0000 | [diff] [blame] | 251 | . " documentation updated on $t_date.</span>"); |
| 252 | } |
| 253 | if ($PACKAGE_VERSION ne '') { |
| 254 | return ("<span class=\"release-info\">" |
Fred Drake | dce975c | 2001-06-20 21:31:36 +0000 | [diff] [blame] | 255 | . "Release $PACKAGE_VERSION$RELEASE_INFO.</span>"); |
Fred Drake | 7497bd3 | 2000-10-25 16:18:10 +0000 | [diff] [blame] | 256 | } |
| 257 | if ($t_date) { |
| 258 | return ("<span class=\"release-info\">Documentation released on " |
| 259 | . "$t_date.</span>"); |
| 260 | } |
| 261 | return ''; |
| 262 | } |
| 263 | |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 264 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 265 | sub top_navigation_panel() { |
Fred Drake | 0c1b253 | 2004-10-29 19:47:52 +0000 | [diff] [blame] | 266 | return "\n<div id='top-navigation-panel' xml:id='top-navigation-panel'>\n" |
Fred Drake | 7497bd3 | 2000-10-25 16:18:10 +0000 | [diff] [blame] | 267 | . make_nav_panel() |
Fred Drake | 11b138f | 2003-09-11 04:14:20 +0000 | [diff] [blame] | 268 | . "<hr /></div>\n"; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 269 | } |
| 270 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 271 | sub bot_navigation_panel() { |
Fred Drake | 0739c44 | 2003-09-04 22:16:45 +0000 | [diff] [blame] | 272 | return "\n<div class='online-navigation'>\n" |
Fred Drake | 859c46a | 2003-09-04 19:30:15 +0000 | [diff] [blame] | 273 | . "<p></p><hr />\n" |
Fred Drake | 7497bd3 | 2000-10-25 16:18:10 +0000 | [diff] [blame] | 274 | . make_nav_panel() |
Fred Drake | 859c46a | 2003-09-04 19:30:15 +0000 | [diff] [blame] | 275 | . "</div>\n" |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 276 | . "<hr />\n" |
Fred Drake | 7497bd3 | 2000-10-25 16:18:10 +0000 | [diff] [blame] | 277 | . get_version_text() |
| 278 | . "\n"; |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | sub add_link { |
| 282 | # Returns a pair (iconic link, textual link) |
| 283 | my($icon, $current_file, @link) = @_; |
| 284 | my($dummy, $file, $title) = split($delim, |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 285 | $section_info{join(' ',@link)}); |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 286 | if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) { |
| 287 | my $r = get_my_icon($1); |
| 288 | $icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/; |
| 289 | } |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 290 | if ($title && ($file ne $current_file)) { |
| 291 | $title = purify($title); |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 292 | $title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES); |
| 293 | return (make_href($file, $icon), make_href($file, "$title")) |
| 294 | } |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 295 | elsif ($icon eq get_my_icon('up') && $EXTERNAL_UP_LINK) { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 296 | return (make_href($EXTERNAL_UP_LINK, $icon), |
| 297 | make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE")) |
| 298 | } |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 299 | elsif ($icon eq get_my_icon('previous') |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 300 | && $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) { |
| 301 | return (make_href($EXTERNAL_PREV_LINK, $icon), |
| 302 | make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE")) |
| 303 | } |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 304 | elsif ($icon eq get_my_icon('next') |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 305 | && $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) { |
| 306 | return (make_href($EXTERNAL_DOWN_LINK, $icon), |
| 307 | make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE")) |
| 308 | } |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 309 | return (&inactive_img($icon), ""); |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 310 | } |
| 311 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 312 | sub add_special_link($$$) { |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 313 | my($icon, $file, $current_file) = @_; |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 314 | if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) { |
| 315 | my $r = get_my_icon($1); |
| 316 | $icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/; |
| 317 | } |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 318 | return (($file && ($file ne $current_file)) |
| 319 | ? make_href($file, $icon) |
| 320 | : undef) |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 321 | } |
| 322 | |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 323 | # The img_tag() function seems only to be called with the parameter |
| 324 | # 'anchor_invisible_mark', which we want to turn into ''. Since |
| 325 | # replace_icon_marks() is the only interesting caller, and all it really |
| 326 | # does is call img_tag(), we can just define the hook alternative to be |
| 327 | # a no-op instead. |
| 328 | # |
| 329 | sub replace_icons_hook {} |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 330 | |
Fred Drake | 50cdd97 | 1999-02-19 23:04:59 +0000 | [diff] [blame] | 331 | sub do_cmd_arabic { |
| 332 | # get rid of that nasty <SPAN CLASS="arabic">...</SPAN> |
Fred Drake | 73c5b660 | 2002-10-24 16:36:05 +0000 | [diff] [blame] | 333 | my($ctr, $val, $id, $text) = &read_counter_value($_[0]); |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 334 | return ($val ? farabic($val) : "0") . $text; |
Fred Drake | 50cdd97 | 1999-02-19 23:04:59 +0000 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 338 | sub gen_index_id($$) { |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 339 | # this is used to ensure common index key generation and a stable sort |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 340 | my($str, $extra) = @_; |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 341 | sprintf('%s###%s%010d', $str, $extra, ++$global{'max_id'}); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 344 | sub insert_index($$$$$) { |
| 345 | my($mark, $datafile, $columns, $letters, $prefix) = @_; |
Fred Drake | 4d10b43 | 1998-08-07 20:51:58 +0000 | [diff] [blame] | 346 | my $prog = "$myrootdir/tools/buildindex.py"; |
| 347 | my $index; |
| 348 | if ($letters) { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 349 | $index = `$prog --columns $columns --letters $datafile`; |
Fred Drake | 4d10b43 | 1998-08-07 20:51:58 +0000 | [diff] [blame] | 350 | } |
| 351 | else { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 352 | $index = `$prog --columns $columns $datafile`; |
Fred Drake | 4d10b43 | 1998-08-07 20:51:58 +0000 | [diff] [blame] | 353 | } |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 354 | if (!s/$mark/$prefix$index/) { |
| 355 | print "\nCould not locate index mark: $mark"; |
| 356 | } |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 357 | } |
| 358 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 359 | sub add_idx() { |
Fred Drake | 9bbdce5 | 1999-01-19 16:30:10 +0000 | [diff] [blame] | 360 | print "\nBuilding HTML for the index ..."; |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 361 | close(IDXFILE); |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 362 | insert_index($idx_mark, 'index.dat', $INDEX_COLUMNS, 1, ''); |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 363 | } |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 364 | |
| 365 | |
| 366 | $idx_module_mark = '<tex2html_idx_module_mark>'; |
| 367 | $idx_module_title = 'Module Index'; |
| 368 | |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 369 | sub add_module_idx() { |
Fred Drake | 9bbdce5 | 1999-01-19 16:30:10 +0000 | [diff] [blame] | 370 | print "\nBuilding HTML for the module index ..."; |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 371 | my $key; |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 372 | my $first = 1; |
| 373 | my $prevplat = ''; |
| 374 | my $allthesame = 1; |
| 375 | my $prefix = ''; |
| 376 | foreach $key (keys %Modules) { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 377 | $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/$1/; |
| 378 | my $plat = "$ModulePlatforms{$key}"; |
| 379 | $plat = '' |
| 380 | if ($plat eq $IGNORE_PLATFORM_ANNOTATION); |
| 381 | if (!$first) { |
| 382 | $allthesame = 0 |
| 383 | if ($prevplat ne $plat); |
| 384 | } |
| 385 | else { $first = 0; } |
| 386 | $prevplat = $plat; |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 387 | } |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 388 | open(MODIDXFILE, '>modindex.dat') || die "\n$!\n"; |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 389 | foreach $key (keys %Modules) { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 390 | # dump the line in the data file; just use a dummy seqno field |
| 391 | my $nkey = $1; |
| 392 | my $moditem = "$Modules{$key}"; |
| 393 | my $plat = ''; |
| 394 | $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/$1/; |
| 395 | if ($ModulePlatforms{$key} && !$allthesame) { |
| 396 | $plat = (" <em>(<span class=\"platform\">$ModulePlatforms{$key}" |
| 397 | . '</span>)</em>'); |
| 398 | } |
| 399 | print MODIDXFILE $moditem . $IDXFILE_FIELD_SEP |
Fred Drake | dce975c | 2001-06-20 21:31:36 +0000 | [diff] [blame] | 400 | . "<tt class=\"module\">$key</tt>$plat###\n"; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 401 | } |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 402 | close(MODIDXFILE); |
Fred Drake | 42181db | 2001-01-09 22:02:10 +0000 | [diff] [blame] | 403 | |
| 404 | if ($GLOBAL_MODULE_INDEX) { |
| 405 | $prefix = <<MODULE_INDEX_PREFIX; |
| 406 | |
| 407 | <p> This index only lists modules documented in this manual. |
| 408 | The <em class="citetitle"><a href="$GLOBAL_MODULE_INDEX">Global Module |
| 409 | Index</a></em> lists all modules that are documented in this set |
| 410 | of manuals.</p> |
| 411 | MODULE_INDEX_PREFIX |
| 412 | } |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 413 | if (!$allthesame) { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 414 | $prefix .= <<PLAT_DISCUSS; |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 415 | |
| 416 | <p> Some module names are followed by an annotation indicating what |
| 417 | platform they are available on.</p> |
| 418 | |
| 419 | PLAT_DISCUSS |
| 420 | } |
| 421 | insert_index($idx_module_mark, 'modindex.dat', $MODULE_INDEX_COLUMNS, 0, |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 422 | $prefix); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 423 | } |
| 424 | |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 425 | # replace both indexes as needed: |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 426 | sub add_idx_hook { |
Fred Drake | b3a3ed8 | 1998-07-24 22:17:34 +0000 | [diff] [blame] | 427 | add_idx() if (/$idx_mark/); |
Fred Drake | 2383f6d | 1999-03-02 16:00:37 +0000 | [diff] [blame] | 428 | process_python_state(); |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 429 | if ($MODULE_INDEX_FILE) { |
| 430 | local ($_); |
| 431 | open(MYFILE, "<$MODULE_INDEX_FILE"); |
| 432 | sysread(MYFILE, $_, 1024*1024); |
| 433 | close(MYFILE); |
| 434 | add_module_idx(); |
| 435 | open(MYFILE,">$MODULE_INDEX_FILE"); |
| 436 | print MYFILE $_; |
| 437 | close(MYFILE); |
| 438 | } |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 439 | } |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 440 | |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 441 | |
Fred Drake | 191439a | 1999-09-22 19:50:51 +0000 | [diff] [blame] | 442 | # In addition to the standard stuff, add label to allow named node files and |
| 443 | # support suppression of the page complete (for HTML Help use). |
Fred Drake | 095f817 | 2003-06-27 18:26:01 +0000 | [diff] [blame] | 444 | $MY_CONTENTS_PAGE = ''; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 445 | sub do_cmd_tableofcontents { |
| 446 | local($_) = @_; |
| 447 | $TITLE = $toc_title; |
| 448 | $tocfile = $CURRENT_FILE; |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 449 | my($closures, $reopens) = preserve_open_tags(); |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 450 | anchor_label('contents', $CURRENT_FILE, $_); # this is added |
Fred Drake | 095f817 | 2003-06-27 18:26:01 +0000 | [diff] [blame] | 451 | $MY_CONTENTS_PAGE = "$CURRENT_FILE"; |
Fred Drake | e0bdaef | 2004-11-05 06:42:22 +0000 | [diff] [blame] | 452 | join('', "\\tableofchildlinks[off]", $closures |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 453 | , make_section_heading($toc_title, 'h2'), $toc_mark |
| 454 | , $reopens, $_); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 455 | } |
| 456 | # In addition to the standard stuff, add label to allow named node files. |
| 457 | sub do_cmd_listoffigures { |
| 458 | local($_) = @_; |
| 459 | $TITLE = $lof_title; |
| 460 | $loffile = $CURRENT_FILE; |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 461 | my($closures, $reopens) = preserve_open_tags(); |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 462 | anchor_label('lof', $CURRENT_FILE, $_); # this is added |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 463 | join('', "<br />\n", $closures |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 464 | , make_section_heading($lof_title, 'h2'), $lof_mark |
| 465 | , $reopens, $_); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 466 | } |
| 467 | # In addition to the standard stuff, add label to allow named node files. |
| 468 | sub do_cmd_listoftables { |
| 469 | local($_) = @_; |
| 470 | $TITLE = $lot_title; |
| 471 | $lotfile = $CURRENT_FILE; |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 472 | my($closures, $reopens) = preserve_open_tags(); |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 473 | anchor_label('lot', $CURRENT_FILE, $_); # this is added |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 474 | join('', "<br />\n", $closures |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 475 | , make_section_heading($lot_title, 'h2'), $lot_mark |
| 476 | , $reopens, $_); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 477 | } |
| 478 | # In addition to the standard stuff, add label to allow named node files. |
| 479 | sub do_cmd_textohtmlinfopage { |
| 480 | local($_) = @_; |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 481 | if ($INFO) { # |
| 482 | anchor_label("about",$CURRENT_FILE,$_); # this is added |
| 483 | } # |
| 484 | my $the_version = ''; # and the rest is |
| 485 | if ($t_date) { # mostly ours |
| 486 | $the_version = ",\n$t_date"; |
| 487 | if ($PACKAGE_VERSION) { |
| 488 | $the_version .= ", Release $PACKAGE_VERSION$RELEASE_INFO"; |
| 489 | } |
Fred Drake | 15796f7 | 1998-11-30 19:25:47 +0000 | [diff] [blame] | 490 | } |
Fred Drake | 9443dc3 | 2001-08-10 20:12:09 +0000 | [diff] [blame] | 491 | my $about; |
| 492 | open(ABOUT, "<$ABOUT_FILE") || die "\n$!\n"; |
| 493 | sysread(ABOUT, $about, 1024*1024); |
| 494 | close(ABOUT); |
Fred Drake | 15796f7 | 1998-11-30 19:25:47 +0000 | [diff] [blame] | 495 | $_ = (($INFO == 1) |
Fred Drake | b35f2b7 | 1999-09-23 16:53:09 +0000 | [diff] [blame] | 496 | ? join('', |
| 497 | $close_all, |
| 498 | "<strong>$t_title</strong>$the_version\n", |
Fred Drake | 9443dc3 | 2001-08-10 20:12:09 +0000 | [diff] [blame] | 499 | $about, |
Fred Drake | b35f2b7 | 1999-09-23 16:53:09 +0000 | [diff] [blame] | 500 | $open_all, $_) |
| 501 | : join('', $close_all, $INFO,"\n", $open_all, $_)); |
Fred Drake | 15796f7 | 1998-11-30 19:25:47 +0000 | [diff] [blame] | 502 | $_; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 503 | } |
| 504 | |
Fred Drake | c6f3c8b | 2004-08-19 01:37:48 +0000 | [diff] [blame] | 505 | $GENERAL_INDEX_FILE = ''; |
| 506 | $MODULE_INDEX_FILE = ''; |
| 507 | |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 508 | # $idx_mark will be replaced with the real index at the end |
| 509 | sub do_cmd_textohtmlindex { |
| 510 | local($_) = @_; |
| 511 | $TITLE = $idx_title; |
| 512 | $idxfile = $CURRENT_FILE; |
Fred Drake | c6f3c8b | 2004-08-19 01:37:48 +0000 | [diff] [blame] | 513 | $GENERAL_INDEX_FILE = "$CURRENT_FILE"; |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 514 | if (%index_labels) { make_index_labels(); } |
| 515 | if (($SHORT_INDEX) && (%index_segment)) { make_preindex(); } |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 516 | else { $preindex = ''; } |
Fred Drake | 235e6b1 | 1998-03-27 05:19:43 +0000 | [diff] [blame] | 517 | my $heading = make_section_heading($idx_title, 'h2') . $idx_mark; |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 518 | my($pre, $post) = minimize_open_tags($heading); |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 519 | anchor_label('genindex',$CURRENT_FILE,$_); # this is added |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 520 | return "<br />\n" . $pre . $_; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | # $idx_module_mark will be replaced with the real index at the end |
| 524 | sub do_cmd_textohtmlmoduleindex { |
| 525 | local($_) = @_; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 526 | $TITLE = $idx_module_title; |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 527 | anchor_label('modindex', $CURRENT_FILE, $_); |
| 528 | $MODULE_INDEX_FILE = "$CURRENT_FILE"; |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 529 | $_ = ('<p></p>' . make_section_heading($idx_module_title, 'h2') |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 530 | . $idx_module_mark . $_); |
| 531 | return $_; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 532 | } |
| 533 | |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 534 | # The bibliography and the index should be treated as separate |
| 535 | # sections in their own HTML files. The \bibliography{} command acts |
| 536 | # as a sectioning command that has the desired effect. But when the |
| 537 | # bibliography is constructed manually using the thebibliography |
| 538 | # environment, or when using the theindex environment it is not |
| 539 | # possible to use the normal sectioning mechanism. This subroutine |
| 540 | # inserts a \bibliography{} or a dummy \textohtmlindex command just |
| 541 | # before the appropriate environments to force sectioning. |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 542 | |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 543 | # XXX This *assumes* that if there are two {theindex} environments, |
| 544 | # the first is the module index and the second is the standard |
| 545 | # index. This is sufficient for the current Python documentation, |
| 546 | # but that's about it. |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 547 | |
| 548 | sub add_bbl_and_idx_dummy_commands { |
Fred Drake | 1191692 | 1998-04-02 22:30:57 +0000 | [diff] [blame] | 549 | my $id = $global{'max_id'}; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 550 | |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 551 | if (/[\\]tableofcontents/) { |
| 552 | $HAVE_TABLE_OF_CONTENTS = 1; |
| 553 | } |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 554 | s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; |
Fred Drake | 191439a | 1999-09-22 19:50:51 +0000 | [diff] [blame] | 555 | s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo; |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 556 | my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/); |
| 557 | if (scalar(@parts) == 3) { |
| 558 | # Be careful to re-write the string in place, since $_ is *not* |
| 559 | # returned explicity; *** nasty side-effect dependency! *** |
Fred Drake | bb7775a | 2001-12-04 17:03:54 +0000 | [diff] [blame] | 560 | print "\nadd_bbl_and_idx_dummy_commands ==> adding general index"; |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 561 | print "\nadd_bbl_and_idx_dummy_commands ==> adding module index"; |
| 562 | my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)" |
| 563 | . "([\\\\]begin\\s*$O\\d+$C\\s*theindex)"; |
Fred Drake | 73c5b660 | 2002-10-24 16:36:05 +0000 | [diff] [blame] | 564 | s/$rx/\\textohtmlmoduleindex $1 \\textohtmlindex $2/o; |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 565 | # Add a button to the navigation areas: |
Fred Drake | aaa2385 | 2000-09-14 22:20:41 +0000 | [diff] [blame] | 566 | $CUSTOM_BUTTONS .= ('<a href="modindex.html" title="Module Index">' |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 567 | . get_my_icon('modules') |
Fred Drake | aaa2385 | 2000-09-14 22:20:41 +0000 | [diff] [blame] | 568 | . '</a>'); |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 569 | $HAVE_MODULE_INDEX = 1; |
| 570 | $HAVE_GENERAL_INDEX = 1; |
| 571 | } |
| 572 | elsif (scalar(@parts) == 2) { |
Fred Drake | bb7775a | 2001-12-04 17:03:54 +0000 | [diff] [blame] | 573 | print "\nadd_bbl_and_idx_dummy_commands ==> adding general index"; |
| 574 | my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex)"; |
Fred Drake | 73c5b660 | 2002-10-24 16:36:05 +0000 | [diff] [blame] | 575 | s/$rx/\\textohtmlindex $1/o; |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 576 | $HAVE_GENERAL_INDEX = 1; |
Fred Drake | 1191692 | 1998-04-02 22:30:57 +0000 | [diff] [blame] | 577 | } |
Fred Drake | bb7775a | 2001-12-04 17:03:54 +0000 | [diff] [blame] | 578 | elsif (scalar(@parts) == 1) { |
| 579 | print "\nadd_bbl_and_idx_dummy_commands ==> no index found"; |
Fred Drake | d18722b | 2001-01-02 22:08:48 +0000 | [diff] [blame] | 580 | $CUSTOM_BUTTONS .= get_my_icon('blank'); |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 581 | $global{'max_id'} = $id; # not sure why.... |
| 582 | s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o; |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 583 | s/[\\]printindex/\\textohtmlindex /o; |
Fred Drake | bb7775a | 2001-12-04 17:03:54 +0000 | [diff] [blame] | 584 | } |
| 585 | else { |
| 586 | die "\n\nBad number of index environments!\n\n"; |
| 587 | } |
Fred Drake | 1191692 | 1998-04-02 22:30:57 +0000 | [diff] [blame] | 588 | #---------------------------------------------------------------------- |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 589 | lib_add_bbl_and_idx_dummy_commands() |
Fred Drake | 1191692 | 1998-04-02 22:30:57 +0000 | [diff] [blame] | 590 | if defined(&lib_add_bbl_and_idx_dummy_commands); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 591 | } |
| 592 | |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 593 | # The bibliographic references, the appendices, the lists of figures |
| 594 | # and tables etc. must appear in the contents table at the same level |
| 595 | # as the outermost sectioning command. This subroutine finds what is |
| 596 | # the outermost level and sets the above to the same level; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 597 | |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 598 | sub set_depth_levels { |
| 599 | # Sets $outermost_level |
Fred Drake | 1191692 | 1998-04-02 22:30:57 +0000 | [diff] [blame] | 600 | my $level; |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 601 | #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH |
| 602 | foreach $level ("part", "chapter", "section", "subsection", |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 603 | "subsubsection", "paragraph") { |
| 604 | last if (($outermost_level) = /\\($level)$delimiter_rx/); |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 605 | } |
| 606 | $level = ($outermost_level ? $section_commands{$outermost_level} : |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 607 | do {$outermost_level = 'section'; 3;}); |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 608 | |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 609 | #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 610 | if ($REL_DEPTH && $MAX_SPLIT_DEPTH) { |
| 611 | $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH; |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 612 | } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 }; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 613 | |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 614 | %unnumbered_section_commands = ('tableofcontents' => $level, |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 615 | 'listoffigures' => $level, |
| 616 | 'listoftables' => $level, |
| 617 | 'bibliography' => $level, |
| 618 | 'textohtmlindex' => $level, |
| 619 | 'textohtmlmoduleindex' => $level); |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 620 | $section_headings{'textohtmlmoduleindex'} = 'h1'; |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 621 | |
Fred Drake | 64bdc24 | 1998-04-17 02:14:12 +0000 | [diff] [blame] | 622 | %section_commands = (%unnumbered_section_commands, |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 623 | %section_commands); |
Fred Drake | 1191692 | 1998-04-02 22:30:57 +0000 | [diff] [blame] | 624 | |
| 625 | make_sections_rx(); |
Fred Drake | 13210ed | 1998-03-17 06:28:05 +0000 | [diff] [blame] | 626 | } |
Fred Drake | bc7101d | 1998-03-06 21:18:55 +0000 | [diff] [blame] | 627 | |
| 628 | |
Fred Drake | 1072e46 | 1998-04-12 02:16:34 +0000 | [diff] [blame] | 629 | # This changes the markup used for {verbatim} environments, and is the |
Fred Drake | 95474f9 | 1999-02-09 18:45:50 +0000 | [diff] [blame] | 630 | # best way I've found that ensures the <dl> goes on the outside of the |
Fred Drake | 1072e46 | 1998-04-12 02:16:34 +0000 | [diff] [blame] | 631 | # <pre>...</pre>. |
| 632 | # |
| 633 | # Note that this *must* be done in the init file, not the python.perl |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 634 | # style support file. The %declarations must be set before |
| 635 | # initialize() is called in the main LaTeX2HTML script (which happens |
| 636 | # before style files are loaded). |
Fred Drake | 1072e46 | 1998-04-12 02:16:34 +0000 | [diff] [blame] | 637 | # |
Fred Drake | 8a5e679 | 2002-04-15 18:41:31 +0000 | [diff] [blame] | 638 | %declarations = ('preform' => '<div class="verbatim"><pre></pre></div>', |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 639 | %declarations); |
Fred Drake | 1072e46 | 1998-04-12 02:16:34 +0000 | [diff] [blame] | 640 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 641 | |
Fred Drake | dcb16ac | 2004-11-10 07:48:17 +0000 | [diff] [blame] | 642 | # This is a modified version of what's provided by LaTeX2HTML; see the |
| 643 | # comment on the middle stanza for an explanation of why we keep our |
| 644 | # own version. |
| 645 | # |
| 646 | # This routine must be called once on the text only, |
| 647 | # else it will "eat up" sensitive constructs. |
| 648 | sub text_cleanup { |
| 649 | # MRO: replaced $* with /m |
| 650 | s/(\s*\n){3,}/\n\n/gom; # Replace consecutive blank lines with one |
| 651 | s/<(\/?)P>\s*(\w)/<$1P>\n$2/gom; # clean up paragraph starts and ends |
| 652 | s/$O\d+$C//go; # Get rid of bracket id's |
| 653 | s/$OP\d+$CP//go; # Get rid of processed bracket id's |
| 654 | s/(<!)?--?(>)?/(length($1) || length($2)) ? "$1--$2" : "-"/ge; |
| 655 | # Spacing commands |
| 656 | s/\\( |$)/ /go; |
| 657 | #JKR: There should be no more comments in the source now. |
| 658 | #s/([^\\]?)%/$1/go; # Remove the comment character |
| 659 | # Cannot treat \, as a command because , is a delimiter ... |
| 660 | s/\\,/ /go; |
| 661 | # Replace tilde's with non-breaking spaces |
| 662 | s/ *~/ /g; |
| 663 | |
| 664 | # This is why we have this copy of this routine; the following |
| 665 | # isn't so desirable as the author/maintainers of LaTeX2HTML seem |
| 666 | # to think. It's not commented out in the main script, so we have |
| 667 | # to override the whole thing. In particular, we don't want empty |
| 668 | # table cells to disappear. |
| 669 | |
| 670 | ### DANGEROUS ?? ### |
| 671 | # remove redundant (not <P></P>) empty tags, incl. with attributes |
| 672 | #s/\n?<([^PD >][^>]*)>\s*<\/\1>//g; |
| 673 | #s/\n?<([^PD >][^>]*)>\s*<\/\1>//g; |
| 674 | # remove redundant empty tags (not </P><P> or <TD> or <TH>) |
| 675 | #s/<\/(TT|[^PTH][A-Z]+)><\1>//g; |
| 676 | #s/<([^PD ]+)(\s[^>]*)?>\n*<\/\1>//g; |
| 677 | |
| 678 | #JCL(jcl-hex) |
| 679 | # Replace ^^ special chars (according to p.47 of the TeX book) |
| 680 | # Useful when coming from the .aux file (german umlauts, etc.) |
| 681 | s/\^\^([^0-9a-f])/chr((64+ord($1))&127)/ge; |
| 682 | s/\^\^([0-9a-f][0-9a-f])/chr(hex($1))/ge; |
| 683 | } |
| 684 | |
Fred Drake | bf8ec3e | 2003-05-02 20:18:01 +0000 | [diff] [blame] | 685 | # This is used to map the link rel attributes LaTeX2HTML uses to those |
| 686 | # currently recommended by the W3C. |
| 687 | sub custom_REL_hook { |
| 688 | my($rel,$junk) = @_; |
| 689 | return 'parent' if $rel eq 'up'; |
| 690 | return 'prev' if $rel eq 'previous'; |
| 691 | return $rel; |
| 692 | } |
| 693 | |
Fred Drake | c568173 | 2000-09-12 20:13:04 +0000 | [diff] [blame] | 694 | # This is added to get rid of the long comment that follows the |
| 695 | # doctype declaration; MSIE5 on NT4 SP4 barfs on it and drops the |
| 696 | # content of the page. |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 697 | $MY_PARTIAL_HEADER = ''; |
Fred Drake | f547863 | 2002-05-23 17:59:16 +0000 | [diff] [blame] | 698 | sub make_head_and_body($$) { |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 699 | my($title, $body) = @_; |
Fred Drake | 1681627 | 2000-09-16 20:40:44 +0000 | [diff] [blame] | 700 | $body = " $body" unless ($body eq ''); |
Fred Drake | 85d14c9 | 2000-07-31 17:53:45 +0000 | [diff] [blame] | 701 | my $DTDcomment = ''; |
| 702 | my($version, $isolanguage) = ($HTML_VERSION, 'EN'); |
| 703 | my %isolanguages = ( 'english', 'EN' , 'USenglish', 'EN.US' |
| 704 | , 'original', 'EN' , 'german' , 'DE' |
| 705 | , 'austrian', 'DE.AT', 'french' , 'FR' |
| 706 | , 'spanish', 'ES'); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 707 | $isolanguage = $isolanguages{$default_language}; |
| 708 | $isolanguage = 'EN' unless $isolanguage; |
| 709 | $title = &purify($title,1); |
| 710 | eval("\$title = ". $default_title ) unless ($title); |
| 711 | |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 712 | # allow user-modification of the <title> tag; thanks Dan Young |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 713 | if (defined &custom_TITLE_hook) { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 714 | $title = &custom_TITLE_hook($title, $toc_sec_title); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 715 | } |
| 716 | |
| 717 | if ($DOCTYPE =~ /\/\/[\w\.]+\s*$/) { # language spec included |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 718 | $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE\">\n"; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 719 | } else { |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 720 | $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE//" |
| 721 | . ($ISO_LANGUAGE ? $ISO_LANGUAGE : $isolanguage) . "\">\n"; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 722 | } |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 723 | if ($MY_PARTIAL_HEADER eq '') { |
Fred Drake | 0384be3 | 2004-11-05 05:06:08 +0000 | [diff] [blame] | 724 | my $favicon = ''; |
| 725 | if ($FAVORITES_ICON) { |
| 726 | my($myname, $mydir, $myext) = fileparse($FAVORITES_ICON, '\..*'); |
| 727 | my $favtype = ''; |
| 728 | if ($myext eq '.gif' || $myext eq '.png') { |
| 729 | $myext =~ s/^[.]//; |
| 730 | $favtype = " type=\"image/$myext\""; |
| 731 | } |
| 732 | $favicon = ( |
| 733 | "\n<link rel=\"SHORTCUT ICON\" href=\"$FAVORITES_ICON\"" |
| 734 | . "$favtype />"); |
| 735 | } |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 736 | $STYLESHEET = $FILE.".css" unless $STYLESHEET; |
| 737 | $MY_PARTIAL_HEADER = join('', |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 738 | ($DOCTYPE ? $DTDcomment : ''), |
Fred Drake | 98b2576 | 2003-05-02 18:21:22 +0000 | [diff] [blame] | 739 | "<html>\n<head>", |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 740 | ($BASE ? "\n<base href=\"$BASE\" />" : ''), |
| 741 | "\n<link rel=\"STYLESHEET\" href=\"$STYLESHEET\" type='text/css'", |
| 742 | " />", |
Fred Drake | 0384be3 | 2004-11-05 05:06:08 +0000 | [diff] [blame] | 743 | $favicon, |
Fred Drake | 2394900 | 2002-10-30 21:51:18 +0000 | [diff] [blame] | 744 | ($EXTERNAL_UP_LINK |
Fred Drake | 98b2576 | 2003-05-02 18:21:22 +0000 | [diff] [blame] | 745 | ? ("\n<link rel='start' href='" . $EXTERNAL_UP_LINK |
| 746 | . ($EXTERNAL_UP_TITLE ? |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 747 | "' title='$EXTERNAL_UP_TITLE' />" : "' />")) |
Fred Drake | 2394900 | 2002-10-30 21:51:18 +0000 | [diff] [blame] | 748 | : ''), |
Fred Drake | 98b2576 | 2003-05-02 18:21:22 +0000 | [diff] [blame] | 749 | "\n<link rel=\"first\" href=\"$FILE.html\"", |
Fred Drake | 2394900 | 2002-10-30 21:51:18 +0000 | [diff] [blame] | 750 | ($t_title ? " title='$t_title'" : ''), |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 751 | ' />', |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 752 | ($HAVE_TABLE_OF_CONTENTS |
Fred Drake | 095f817 | 2003-06-27 18:26:01 +0000 | [diff] [blame] | 753 | ? ("\n<link rel='contents' href='$MY_CONTENTS_PAGE'" |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 754 | . ' title="Contents" />') |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 755 | : ''), |
| 756 | ($HAVE_GENERAL_INDEX |
Fred Drake | c6f3c8b | 2004-08-19 01:37:48 +0000 | [diff] [blame] | 757 | ? ("\n<link rel='index' href='$GENERAL_INDEX_FILE'" |
| 758 | . " title='Index' />") |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 759 | : ''), |
| 760 | # disable for now -- Mozilla doesn't do well with multiple indexes |
| 761 | # ($HAVE_MODULE_INDEX |
Fred Drake | c6f3c8b | 2004-08-19 01:37:48 +0000 | [diff] [blame] | 762 | # ? ("<link rel="index" href='$MODULE_INDEX_FILE'" |
| 763 | # . " title='Module Index' />\n") |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 764 | # : ''), |
Fred Drake | 2394900 | 2002-10-30 21:51:18 +0000 | [diff] [blame] | 765 | ($INFO |
| 766 | # XXX We can do this with the Python tools since the About... |
| 767 | # page always gets copied to about.html, even when we use the |
| 768 | # generated node###.html page names. Won't work with the |
| 769 | # rest of the Python doc tools. |
Fred Drake | 98b2576 | 2003-05-02 18:21:22 +0000 | [diff] [blame] | 770 | ? ("\n<link rel='last' href='about.html'" |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 771 | . " title='About this document...' />" |
Fred Drake | 98b2576 | 2003-05-02 18:21:22 +0000 | [diff] [blame] | 772 | . "\n<link rel='help' href='about.html'" |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 773 | . " title='About this document...' />") |
Fred Drake | 2394900 | 2002-10-30 21:51:18 +0000 | [diff] [blame] | 774 | : ''), |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 775 | $more_links_mark, |
Fred Drake | 0e2e687 | 2002-10-30 19:55:23 +0000 | [diff] [blame] | 776 | "\n", |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 777 | ($CHARSET && $HTML_VERSION ge "2.1" |
| 778 | ? ('<meta http-equiv="Content-Type" content="text/html; ' |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 779 | . "charset=$CHARSET\" />\n") |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 780 | : ''), |
| 781 | ($AESOP_META_TYPE |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 782 | ? "<meta name='aesop' content='$AESOP_META_TYPE' />\n" : '')); |
Fred Drake | a219b41 | 2001-10-22 16:57:49 +0000 | [diff] [blame] | 783 | } |
Fred Drake | 0e2e687 | 2002-10-30 19:55:23 +0000 | [diff] [blame] | 784 | if (!$charset && $CHARSET) { |
| 785 | $charset = $CHARSET; |
| 786 | $charset =~ s/_/\-/go; |
| 787 | } |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 788 | join('', |
| 789 | $MY_PARTIAL_HEADER, |
Fred Drake | dd3d6a0 | 2002-10-30 17:00:58 +0000 | [diff] [blame] | 790 | "<title>", $title, "</title>\n</head>\n<body$body>"); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 791 | } |
| 792 | |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 793 | sub replace_morelinks { |
| 794 | $more_links =~ s/ REL=/ rel=/g; |
| 795 | $more_links =~ s/ HREF=/ href=/g; |
Fred Drake | e0bdaef | 2004-11-05 06:42:22 +0000 | [diff] [blame] | 796 | $more_links =~ s/<LINK /<link /g; |
| 797 | $more_links =~ s/">/" \/>/g; |
Fred Drake | 2fc88a6 | 2003-08-05 03:45:37 +0000 | [diff] [blame] | 798 | $_ =~ s/$more_links_mark/$more_links/e; |
| 799 | } |
| 800 | |
Fred Drake | 7a55642 | 2003-09-04 22:21:17 +0000 | [diff] [blame] | 801 | 1; # This must be the last line |