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