blob: ce71c89600d69e9cda910e7e4239edb6ac4e7fee [file] [log] [blame]
Fred Drake85d14c92000-07-31 17:53:45 +00001# LaTeX2HTML support base for use with Python documentation.
Fred Drake41814bc1998-05-11 18:23:35 +00002
3package main;
4
Fred Drake85d14c92000-07-31 17:53:45 +00005use L2hos;
6
Fred Drake28e7b4c1998-10-20 18:14:20 +00007$HTML_VERSION = 4.0;
8
Fred Drake6aa5d481998-08-11 03:14:50 +00009$MAX_LINK_DEPTH = 2;
Fred Draked7571651998-04-23 20:06:24 +000010$ADDRESS = '';
Fred Drakebc7101d1998-03-06 21:18:55 +000011
Fred Drakee194beb1998-05-19 19:38:49 +000012$NO_FOOTNODE = 1;
Fred Drakebc7101d1998-03-06 21:18:55 +000013$NUMBERED_FOOTNOTES = 1;
14
15# Python documentation uses section numbers to support references to match
16# in the printed and online versions.
17#
18$SHOW_SECTION_NUMBERS = 1;
19
Fred Drake15a159c2002-10-01 15:20:20 +000020$ICONSERVER = '.';
Fred Drakef730fc32000-08-31 07:19:07 +000021$IMAGE_TYPE = 'gif';
Fred Drakebc7101d1998-03-06 21:18:55 +000022
Fred Drake6aa5d481998-08-11 03:14:50 +000023# Control where the navigation bars should show up:
24$TOP_NAVIGATION = 1;
25$BOTTOM_NAVIGATION = 1;
26$AUTO_NAVIGATION = 0;
27
Fred Drake16816272000-09-16 20:40:44 +000028$BODYTEXT = '';
Fred Drake0739c442003-09-04 22:16:45 +000029$CHILDLINE = "\n<p><br /></p><hr class='online-navigation' />\n";
Fred Drakebc7101d1998-03-06 21:18:55 +000030$VERBOSITY = 0;
Fred Drakebc7101d1998-03-06 21:18:55 +000031
Fred Drake4d10b431998-08-07 20:51:58 +000032# default # of columns for the indexes
Fred Drakeaa3f9fb1998-08-07 19:52:37 +000033$INDEX_COLUMNS = 2;
Fred Drake2383f6d1999-03-02 16:00:37 +000034$MODULE_INDEX_COLUMNS = 4;
Fred Drakeaa3f9fb1998-08-07 19:52:37 +000035
Fred Drakea219b412001-10-22 16:57:49 +000036$HAVE_MODULE_INDEX = 0;
37$HAVE_GENERAL_INDEX = 0;
38$HAVE_TABLE_OF_CONTENTS = 0;
39
Fred Drakee03e1fe2002-04-05 17:34:50 +000040$AESOP_META_TYPE = 'information';
41
Fred Drakec9f2c141998-03-11 12:08:21 +000042
Fred Drakedb34a1e1998-03-10 23:02:57 +000043# A little painful, but lets us clean up the top level directory a little,
Fred Drake85d14c92000-07-31 17:53:45 +000044# and not be tied to the current directory (as far as I can tell). Testing
45# an existing definition of $mydir is needed since it cannot be computed when
46# run under mkhowto with recent versions of LaTeX2HTML, since this file is
47# not read directly by LaTeX2HTML any more. mkhowto is required to prepend
48# the required definition at the top of the actual input file.
Fred Drakedb34a1e1998-03-10 23:02:57 +000049#
Fred Drake85d14c92000-07-31 17:53:45 +000050if (!defined $mydir) {
51 use Cwd;
52 use File::Basename;
53 ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*');
Fred Drake7a556422003-09-04 22:21:17 +000054 chop $mydir; # remove trailing '/'
Fred Drake85d14c92000-07-31 17:53:45 +000055 $mydir = getcwd() . "$dd$mydir"
56 unless $mydir =~ s|^/|/|;
57}
Fred Drakedb34a1e1998-03-10 23:02:57 +000058$LATEX2HTMLSTYLES = "$mydir$envkey$LATEX2HTMLSTYLES";
Fred Drakeb3a3ed81998-07-24 22:17:34 +000059push (@INC, $mydir);
Fred Drakebc7101d1998-03-06 21:18:55 +000060
Fred Drake235e6b11998-03-27 05:19:43 +000061($myrootname, $myrootdir, $myext) = fileparse($mydir, '\..*');
62chop $myrootdir;
63
Fred Drakebc7101d1998-03-06 21:18:55 +000064
Fred Drakea4565b01998-05-15 17:14:17 +000065# Hackish way to get the appropriate paper-*/ directory into $TEXINPUTS;
66# pass in the paper size (a4 or letter) as the environment variable PAPER
67# to add the right directory. If not given, the current directory is
68# added instead for use with HOWTO processing.
69#
70if (defined $ENV{'PAPER'}) {
71 $mytexinputs = "$myrootdir${dd}paper-$ENV{'PAPER'}$envkey";
72}
73else {
74 $mytexinputs = getcwd() . $envkey;
75}
76$mytexinputs .= "$myrootdir${dd}texinputs";
77
78
Fred Drakeb35f2b71999-09-23 16:53:09 +000079# Change this variable to change the text added in "About this document...";
80# this should be an absolute pathname to get it right.
81#
82$ABOUT_FILE = "$myrootdir${dd}html${dd}stdabout.dat";
83
84
Fred Drake85d14c92000-07-31 17:53:45 +000085sub custom_driver_hook {
Fred Drakea4565b01998-05-15 17:14:17 +000086 #
87 # This adds the directory of the main input file to $TEXINPUTS; it
88 # seems to be sufficiently general that it should be fine for HOWTO
89 # processing.
90 #
Fred Drakecc2e48d2003-09-27 16:04:23 +000091 # XXX This still isn't quite right; we should actually be inserting
92 # $mytexinputs just before any empty entry in TEXINPUTS is one
93 # exists instead of just concatenating the pieces like we do here.
94 #
Fred Drake73c5b6602002-10-24 16:36:05 +000095 my $file = $_[0];
Fred Drake85d14c92000-07-31 17:53:45 +000096 my($jobname, $dir, $ext) = fileparse($file, '\..*');
97 $dir = L2hos->Make_directory_absolute($dir);
Fred Drakea4565b01998-05-15 17:14:17 +000098 $dir =~ s/$dd$//;
99 $TEXINPUTS = "$dir$envkey$mytexinputs";
Fred Drakecc2e48d2003-09-27 16:04:23 +0000100 # Push everything into $TEXINPUTS since LaTeX2HTML doesn't pick
101 # this up on it's own; we clear $ENV{'TEXINPUTS'} so the value set
102 # for this by the main LaTeX2HTML script doesn't contain duplicate
103 # directories.
104 if ($ENV{'TEXINPUTS'}) {
105 $TEXINPUTS .= "$envkey$ENV{'TEXINPUTS'}";
106 $ENV{'TEXINPUTS'} = undef;
107 }
108 print "\nSetting \$TEXINPUTS to $TEXINPUTS\n";
Fred Drake191439a1999-09-22 19:50:51 +0000109}
110
Fred Drakea4565b01998-05-15 17:14:17 +0000111
Fred Drake3f26af72004-01-13 23:43:58 +0000112# $CUSTOM_BUTTONS is only used for the module index link.
Fred Drake85d14c92000-07-31 17:53:45 +0000113$CUSTOM_BUTTONS = '';
Fred Drake062bc6e1998-08-13 22:03:46 +0000114
Fred Drakebf8ec3e2003-05-02 20:18:01 +0000115sub make_nav_sectref($$$) {
116 my($label, $linktype, $title) = @_;
Fred Drakebeb27bf1999-02-16 17:22:32 +0000117 if ($title) {
Fred Drake02c70822000-09-19 15:36:19 +0000118 if ($title =~ /\<[aA] /) {
Fred Drakebf8ec3e2003-05-02 20:18:01 +0000119 $title =~ s/\<[aA] /<a class="sectref" rel="$linktype" /;
Fred Drake2fc88a62003-08-05 03:45:37 +0000120 $title =~ s/ HREF=/ href=/;
Fred Drake02c70822000-09-19 15:36:19 +0000121 }
122 else {
123 $title = "<span class=\"sectref\">$title</span>";
124 }
Fred Drakebf8ec3e2003-05-02 20:18:01 +0000125 return "<b class=\"navlabel\">$label:</b>\n$title\n";
Fred Drakebeb27bf1999-02-16 17:22:32 +0000126 }
127 return '';
128}
129
Fred Draked18722b2001-01-02 22:08:48 +0000130@my_icon_tags = ();
131$my_icon_tags{'next'} = 'Next Page';
132$my_icon_tags{'next_page'} = 'Next Page';
133$my_icon_tags{'previous'} = 'Previous Page';
134$my_icon_tags{'previous_page'} = 'Previous Page';
135$my_icon_tags{'up'} = 'Up One Level';
136$my_icon_tags{'contents'} = 'Contents';
137$my_icon_tags{'index'} = 'Index';
138$my_icon_tags{'modules'} = 'Module Index';
139
Fred Drakeb31d36c2001-01-04 15:16:01 +0000140@my_icon_names = ();
141$my_icon_names{'previous_page'} = 'previous';
142$my_icon_names{'next_page'} = 'next';
143
Fred Drakef5478632002-05-23 17:59:16 +0000144sub get_my_icon($) {
Fred Drake73c5b6602002-10-24 16:36:05 +0000145 my $name = $_[0];
Fred Draked18722b2001-01-02 22:08:48 +0000146 my $text = $my_icon_tags{$name};
Fred Drakeb31d36c2001-01-04 15:16:01 +0000147 if ($my_icon_names{$name}) {
148 $name = $my_icon_names{$name};
149 }
Fred Draked18722b2001-01-02 22:08:48 +0000150 if ($text eq '') {
151 $name = 'blank';
152 }
Fred Drake85d14c92000-07-31 17:53:45 +0000153 my $iconserver = ($ICONSERVER eq '.') ? '' : "$ICONSERVER/";
Fred Drakedd3d6a02002-10-30 17:00:58 +0000154 return "<img src='$iconserver$name.$IMAGE_TYPE'\n border='0'"
Fred Drake2fc88a62003-08-05 03:45:37 +0000155 . " height='32' alt='$text' width='32' />";
Fred Drake85d14c92000-07-31 17:53:45 +0000156}
157
Fred Drake8b34e7c2003-05-03 02:07:22 +0000158sub unlinkify($) {
159 my $text = "$_[0]";
160 $text =~ s|</[aA]>||;
161 $text =~ s|<a\s+[^>]*>||i;
162 return $text;
163}
164
165sub use_icon($$$) {
166 my($rel,$str,$title) = @_;
Fred Drake3f26af72004-01-13 23:43:58 +0000167 if ($str) {
Fred Drake8b34e7c2003-05-03 02:07:22 +0000168 my $s = "$str";
169 if ($s =~ /\<tex2html_([a-z_]+)_visible_mark\>/) {
170 my $r = get_my_icon($1);
171 $s =~ s/\<tex2html_[a-z_]+_visible_mark\>/$r/;
172 }
173 $s =~ s/<[aA] /<a rel="$rel" title="$title" \n /;
Fred Drake2fc88a62003-08-05 03:45:37 +0000174 $s =~ s/ HREF=/ href=/;
Fred Drake8b34e7c2003-05-03 02:07:22 +0000175 return $s;
Fred Draked18722b2001-01-02 22:08:48 +0000176 }
Fred Drake8b34e7c2003-05-03 02:07:22 +0000177 else {
178 return get_my_icon('blank');
179 }
Fred Drake13210ed1998-03-17 06:28:05 +0000180}
181
Fred Drakef5478632002-05-23 17:59:16 +0000182sub make_nav_panel() {
Fred Drake85d14c92000-07-31 17:53:45 +0000183 my $s;
Fred Drake8b34e7c2003-05-03 02:07:22 +0000184 # new iconic rel iconic page title
Fred Drake216b2492004-09-09 05:13:52 +0000185 my $next = use_icon('next', $NEXT, unlinkify($NEXT_TITLE));
186 my $up = use_icon('parent', $UP, unlinkify($UP_TITLE));
187 my $previous = use_icon('prev', $PREVIOUS, unlinkify($PREVIOUS_TITLE));
188 my $contents = use_icon('contents', $CONTENTS, 'Table of Contents');
189 my $index = use_icon('index', $INDEX, 'Index');
Fred Drake85d14c92000-07-31 17:53:45 +0000190 if (!$CUSTOM_BUTTONS) {
Fred Drake8b34e7c2003-05-03 02:07:22 +0000191 $CUSTOM_BUTTONS = get_my_icon('blank');
Fred Drake85d14c92000-07-31 17:53:45 +0000192 }
193 $s = ('<table align="center" width="100%" cellpadding="0" cellspacing="2">'
194 . "\n<tr>"
195 # left-hand side
Fred Drake216b2492004-09-09 05:13:52 +0000196 . "\n<td class='online-navigation'>$previous</td>"
197 . "\n<td class='online-navigation'>$up</td>"
198 . "\n<td class='online-navigation'>$next</td>"
Fred Drake85d14c92000-07-31 17:53:45 +0000199 # title box
Fred Drakef730fc32000-08-31 07:19:07 +0000200 . "\n<td align=\"center\" width=\"100%\">$t_title</td>"
Fred Drake85d14c92000-07-31 17:53:45 +0000201 # right-hand side
Fred Drake216b2492004-09-09 05:13:52 +0000202 . "\n<td class='online-navigation'>$contents</td>"
Fred Drake0739c442003-09-04 22:16:45 +0000203 # module index
204 . "\n<td class='online-navigation'>$CUSTOM_BUTTONS</td>"
Fred Drake216b2492004-09-09 05:13:52 +0000205 . "\n<td class='online-navigation'>$index</td>"
Fred Drake85d14c92000-07-31 17:53:45 +0000206 . "\n</tr></table>\n"
207 # textual navigation
Fred Drake0739c442003-09-04 22:16:45 +0000208 . "<div class='online-navigation'>\n"
Fred Drakebf8ec3e2003-05-02 20:18:01 +0000209 . make_nav_sectref("Previous", "prev", $PREVIOUS_TITLE)
210 . make_nav_sectref("Up", "parent", $UP_TITLE)
211 . make_nav_sectref("Next", "next", $NEXT_TITLE)
Fred Drake0739c442003-09-04 22:16:45 +0000212 . "</div>\n"
Fred Drake4640e132000-07-31 20:13:23 +0000213 );
Fred Drake85d14c92000-07-31 17:53:45 +0000214 # remove these; they are unnecessary and cause errors from validation
215 $s =~ s/ NAME="tex2html\d+"\n */ /g;
216 return $s;
217}
218
Fred Drakefb6499f2001-10-26 14:16:23 +0000219sub add_child_links {
220 my $toc = add_real_child_links(@_);
221 $toc =~ s|\s*</[aA]>|</a>|g;
222 $toc =~ s/ NAME=\"tex2html\d+\"\s*href=/ href=/gi;
Fred Drake2fc88a62003-08-05 03:45:37 +0000223 $toc =~ s|</UL>(\s*<BR( /)?>)?|</ul>|gi;
Fred Drake0739c442003-09-04 22:16:45 +0000224 if ($toc =~ / NAME=["']CHILD_LINKS["']/) {
225 return "<div class='online-navigation'>\n$toc</div>\n";
226 }
Fred Drakefb6499f2001-10-26 14:16:23 +0000227 return $toc;
228}
229
Fred Drakef5478632002-05-23 17:59:16 +0000230sub get_version_text() {
Fred Drake7497bd32000-10-25 16:18:10 +0000231 if ($PACKAGE_VERSION ne '' && $t_date) {
232 return ("<span class=\"release-info\">"
Fred Drakedce975c2001-06-20 21:31:36 +0000233 . "Release $PACKAGE_VERSION$RELEASE_INFO,"
Fred Drake7497bd32000-10-25 16:18:10 +0000234 . " documentation updated on $t_date.</span>");
235 }
236 if ($PACKAGE_VERSION ne '') {
237 return ("<span class=\"release-info\">"
Fred Drakedce975c2001-06-20 21:31:36 +0000238 . "Release $PACKAGE_VERSION$RELEASE_INFO.</span>");
Fred Drake7497bd32000-10-25 16:18:10 +0000239 }
240 if ($t_date) {
241 return ("<span class=\"release-info\">Documentation released on "
242 . "$t_date.</span>");
243 }
244 return '';
245}
246
Fred Drake85d14c92000-07-31 17:53:45 +0000247
Fred Drakef5478632002-05-23 17:59:16 +0000248sub top_navigation_panel() {
Fred Drake0c1b2532004-10-29 19:47:52 +0000249 return "\n<div id='top-navigation-panel' xml:id='top-navigation-panel'>\n"
Fred Drake7497bd32000-10-25 16:18:10 +0000250 . make_nav_panel()
Fred Drake11b138f2003-09-11 04:14:20 +0000251 . "<hr /></div>\n";
Fred Drakebc7101d1998-03-06 21:18:55 +0000252}
253
Fred Drakef5478632002-05-23 17:59:16 +0000254sub bot_navigation_panel() {
Fred Drake0739c442003-09-04 22:16:45 +0000255 return "\n<div class='online-navigation'>\n"
Fred Drake859c46a2003-09-04 19:30:15 +0000256 . "<p></p><hr />\n"
Fred Drake7497bd32000-10-25 16:18:10 +0000257 . make_nav_panel()
Fred Drake859c46a2003-09-04 19:30:15 +0000258 . "</div>\n"
Fred Drake2fc88a62003-08-05 03:45:37 +0000259 . "<hr />\n"
Fred Drake7497bd32000-10-25 16:18:10 +0000260 . get_version_text()
261 . "\n";
Fred Drake64bdc241998-04-17 02:14:12 +0000262}
263
264sub add_link {
265 # Returns a pair (iconic link, textual link)
266 my($icon, $current_file, @link) = @_;
267 my($dummy, $file, $title) = split($delim,
Fred Drake7a556422003-09-04 22:21:17 +0000268 $section_info{join(' ',@link)});
Fred Draked18722b2001-01-02 22:08:48 +0000269 if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) {
270 my $r = get_my_icon($1);
271 $icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/;
272 }
Fred Drake64bdc241998-04-17 02:14:12 +0000273 if ($title && ($file ne $current_file)) {
274 $title = purify($title);
Fred Drake7a556422003-09-04 22:21:17 +0000275 $title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES);
276 return (make_href($file, $icon), make_href($file, "$title"))
277 }
Fred Draked18722b2001-01-02 22:08:48 +0000278 elsif ($icon eq get_my_icon('up') && $EXTERNAL_UP_LINK) {
Fred Drake7a556422003-09-04 22:21:17 +0000279 return (make_href($EXTERNAL_UP_LINK, $icon),
280 make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE"))
281 }
Fred Draked18722b2001-01-02 22:08:48 +0000282 elsif ($icon eq get_my_icon('previous')
Fred Drake7a556422003-09-04 22:21:17 +0000283 && $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) {
284 return (make_href($EXTERNAL_PREV_LINK, $icon),
285 make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE"))
286 }
Fred Draked18722b2001-01-02 22:08:48 +0000287 elsif ($icon eq get_my_icon('next')
Fred Drake7a556422003-09-04 22:21:17 +0000288 && $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) {
289 return (make_href($EXTERNAL_DOWN_LINK, $icon),
290 make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE"))
291 }
Fred Drake85d14c92000-07-31 17:53:45 +0000292 return (&inactive_img($icon), "");
Fred Drake64bdc241998-04-17 02:14:12 +0000293}
294
Fred Drakef5478632002-05-23 17:59:16 +0000295sub add_special_link($$$) {
Fred Drake64bdc241998-04-17 02:14:12 +0000296 my($icon, $file, $current_file) = @_;
Fred Draked18722b2001-01-02 22:08:48 +0000297 if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) {
298 my $r = get_my_icon($1);
299 $icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/;
300 }
Fred Drake85d14c92000-07-31 17:53:45 +0000301 return (($file && ($file ne $current_file))
302 ? make_href($file, $icon)
303 : undef)
Fred Drake64bdc241998-04-17 02:14:12 +0000304}
305
Fred Drake85d14c92000-07-31 17:53:45 +0000306# The img_tag() function seems only to be called with the parameter
307# 'anchor_invisible_mark', which we want to turn into ''. Since
308# replace_icon_marks() is the only interesting caller, and all it really
309# does is call img_tag(), we can just define the hook alternative to be
310# a no-op instead.
311#
312sub replace_icons_hook {}
Fred Drakebc7101d1998-03-06 21:18:55 +0000313
Fred Drake50cdd971999-02-19 23:04:59 +0000314sub do_cmd_arabic {
315 # get rid of that nasty <SPAN CLASS="arabic">...</SPAN>
Fred Drake73c5b6602002-10-24 16:36:05 +0000316 my($ctr, $val, $id, $text) = &read_counter_value($_[0]);
Fred Drake85d14c92000-07-31 17:53:45 +0000317 return ($val ? farabic($val) : "0") . $text;
Fred Drake50cdd971999-02-19 23:04:59 +0000318}
319
320
Fred Drakef5478632002-05-23 17:59:16 +0000321sub gen_index_id($$) {
Fred Drakebc7101d1998-03-06 21:18:55 +0000322 # this is used to ensure common index key generation and a stable sort
Fred Drakef5478632002-05-23 17:59:16 +0000323 my($str, $extra) = @_;
Fred Drake64bdc241998-04-17 02:14:12 +0000324 sprintf('%s###%s%010d', $str, $extra, ++$global{'max_id'});
Fred Drakebc7101d1998-03-06 21:18:55 +0000325}
326
Fred Drakef5478632002-05-23 17:59:16 +0000327sub insert_index($$$$$) {
328 my($mark, $datafile, $columns, $letters, $prefix) = @_;
Fred Drake4d10b431998-08-07 20:51:58 +0000329 my $prog = "$myrootdir/tools/buildindex.py";
330 my $index;
331 if ($letters) {
Fred Drake7a556422003-09-04 22:21:17 +0000332 $index = `$prog --columns $columns --letters $datafile`;
Fred Drake4d10b431998-08-07 20:51:58 +0000333 }
334 else {
Fred Drake7a556422003-09-04 22:21:17 +0000335 $index = `$prog --columns $columns $datafile`;
Fred Drake4d10b431998-08-07 20:51:58 +0000336 }
Fred Drakec5681732000-09-12 20:13:04 +0000337 if (!s/$mark/$prefix$index/) {
338 print "\nCould not locate index mark: $mark";
339 }
Fred Drake64bdc241998-04-17 02:14:12 +0000340}
341
Fred Drakef5478632002-05-23 17:59:16 +0000342sub add_idx() {
Fred Drake9bbdce51999-01-19 16:30:10 +0000343 print "\nBuilding HTML for the index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000344 close(IDXFILE);
Fred Drake2383f6d1999-03-02 16:00:37 +0000345 insert_index($idx_mark, 'index.dat', $INDEX_COLUMNS, 1, '');
Fred Drake13210ed1998-03-17 06:28:05 +0000346}
Fred Drakebc7101d1998-03-06 21:18:55 +0000347
348
349$idx_module_mark = '<tex2html_idx_module_mark>';
350$idx_module_title = 'Module Index';
351
Fred Drakef5478632002-05-23 17:59:16 +0000352sub add_module_idx() {
Fred Drake9bbdce51999-01-19 16:30:10 +0000353 print "\nBuilding HTML for the module index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000354 my $key;
Fred Drake2383f6d1999-03-02 16:00:37 +0000355 my $first = 1;
356 my $prevplat = '';
357 my $allthesame = 1;
358 my $prefix = '';
359 foreach $key (keys %Modules) {
Fred Drake7a556422003-09-04 22:21:17 +0000360 $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/$1/;
361 my $plat = "$ModulePlatforms{$key}";
362 $plat = ''
363 if ($plat eq $IGNORE_PLATFORM_ANNOTATION);
364 if (!$first) {
365 $allthesame = 0
366 if ($prevplat ne $plat);
367 }
368 else { $first = 0; }
369 $prevplat = $plat;
Fred Drake2383f6d1999-03-02 16:00:37 +0000370 }
Fred Drake64bdc241998-04-17 02:14:12 +0000371 open(MODIDXFILE, '>modindex.dat') || die "\n$!\n";
Fred Drake235e6b11998-03-27 05:19:43 +0000372 foreach $key (keys %Modules) {
Fred Drake7a556422003-09-04 22:21:17 +0000373 # dump the line in the data file; just use a dummy seqno field
374 my $nkey = $1;
375 my $moditem = "$Modules{$key}";
376 my $plat = '';
377 $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/$1/;
378 if ($ModulePlatforms{$key} && !$allthesame) {
379 $plat = (" <em>(<span class=\"platform\">$ModulePlatforms{$key}"
380 . '</span>)</em>');
381 }
382 print MODIDXFILE $moditem . $IDXFILE_FIELD_SEP
Fred Drakedce975c2001-06-20 21:31:36 +0000383 . "<tt class=\"module\">$key</tt>$plat###\n";
Fred Drakebc7101d1998-03-06 21:18:55 +0000384 }
Fred Drake235e6b11998-03-27 05:19:43 +0000385 close(MODIDXFILE);
Fred Drake42181db2001-01-09 22:02:10 +0000386
387 if ($GLOBAL_MODULE_INDEX) {
388 $prefix = <<MODULE_INDEX_PREFIX;
389
390<p> This index only lists modules documented in this manual.
391 The <em class="citetitle"><a href="$GLOBAL_MODULE_INDEX">Global Module
392 Index</a></em> lists all modules that are documented in this set
393 of manuals.</p>
394MODULE_INDEX_PREFIX
395 }
Fred Drake2383f6d1999-03-02 16:00:37 +0000396 if (!$allthesame) {
Fred Drake7a556422003-09-04 22:21:17 +0000397 $prefix .= <<PLAT_DISCUSS;
Fred Drake2383f6d1999-03-02 16:00:37 +0000398
399<p> Some module names are followed by an annotation indicating what
400platform they are available on.</p>
401
402PLAT_DISCUSS
403 }
404 insert_index($idx_module_mark, 'modindex.dat', $MODULE_INDEX_COLUMNS, 0,
Fred Drake7a556422003-09-04 22:21:17 +0000405 $prefix);
Fred Drakebc7101d1998-03-06 21:18:55 +0000406}
407
Fred Drake235e6b11998-03-27 05:19:43 +0000408# replace both indexes as needed:
Fred Drake85d14c92000-07-31 17:53:45 +0000409sub add_idx_hook {
Fred Drakeb3a3ed81998-07-24 22:17:34 +0000410 add_idx() if (/$idx_mark/);
Fred Drake2383f6d1999-03-02 16:00:37 +0000411 process_python_state();
Fred Drakec5681732000-09-12 20:13:04 +0000412 if ($MODULE_INDEX_FILE) {
413 local ($_);
414 open(MYFILE, "<$MODULE_INDEX_FILE");
415 sysread(MYFILE, $_, 1024*1024);
416 close(MYFILE);
417 add_module_idx();
418 open(MYFILE,">$MODULE_INDEX_FILE");
419 print MYFILE $_;
420 close(MYFILE);
421 }
Fred Drake235e6b11998-03-27 05:19:43 +0000422}
Fred Drakebc7101d1998-03-06 21:18:55 +0000423
Fred Drakebc7101d1998-03-06 21:18:55 +0000424
Fred Drake191439a1999-09-22 19:50:51 +0000425# In addition to the standard stuff, add label to allow named node files and
426# support suppression of the page complete (for HTML Help use).
Fred Drake095f8172003-06-27 18:26:01 +0000427$MY_CONTENTS_PAGE = '';
Fred Drakebc7101d1998-03-06 21:18:55 +0000428sub do_cmd_tableofcontents {
429 local($_) = @_;
430 $TITLE = $toc_title;
431 $tocfile = $CURRENT_FILE;
Fred Drakef5478632002-05-23 17:59:16 +0000432 my($closures, $reopens) = preserve_open_tags();
Fred Drake7a556422003-09-04 22:21:17 +0000433 anchor_label('contents', $CURRENT_FILE, $_); # this is added
Fred Drake095f8172003-06-27 18:26:01 +0000434 $MY_CONTENTS_PAGE = "$CURRENT_FILE";
Fred Drake2fc88a62003-08-05 03:45:37 +0000435 join('', "<br />\n\\tableofchildlinks[off]", $closures
Fred Drake7a556422003-09-04 22:21:17 +0000436 , make_section_heading($toc_title, 'h2'), $toc_mark
437 , $reopens, $_);
Fred Drakebc7101d1998-03-06 21:18:55 +0000438}
439# In addition to the standard stuff, add label to allow named node files.
440sub do_cmd_listoffigures {
441 local($_) = @_;
442 $TITLE = $lof_title;
443 $loffile = $CURRENT_FILE;
Fred Drakef5478632002-05-23 17:59:16 +0000444 my($closures, $reopens) = preserve_open_tags();
Fred Drake7a556422003-09-04 22:21:17 +0000445 anchor_label('lof', $CURRENT_FILE, $_); # this is added
Fred Drake2fc88a62003-08-05 03:45:37 +0000446 join('', "<br />\n", $closures
Fred Drake7a556422003-09-04 22:21:17 +0000447 , make_section_heading($lof_title, 'h2'), $lof_mark
448 , $reopens, $_);
Fred Drakebc7101d1998-03-06 21:18:55 +0000449}
450# In addition to the standard stuff, add label to allow named node files.
451sub do_cmd_listoftables {
452 local($_) = @_;
453 $TITLE = $lot_title;
454 $lotfile = $CURRENT_FILE;
Fred Drakef5478632002-05-23 17:59:16 +0000455 my($closures, $reopens) = preserve_open_tags();
Fred Drake7a556422003-09-04 22:21:17 +0000456 anchor_label('lot', $CURRENT_FILE, $_); # this is added
Fred Drake2fc88a62003-08-05 03:45:37 +0000457 join('', "<br />\n", $closures
Fred Drake7a556422003-09-04 22:21:17 +0000458 , make_section_heading($lot_title, 'h2'), $lot_mark
459 , $reopens, $_);
Fred Drakebc7101d1998-03-06 21:18:55 +0000460}
461# In addition to the standard stuff, add label to allow named node files.
462sub do_cmd_textohtmlinfopage {
463 local($_) = @_;
Fred Drake7a556422003-09-04 22:21:17 +0000464 if ($INFO) { #
465 anchor_label("about",$CURRENT_FILE,$_); # this is added
466 } #
467 my $the_version = ''; # and the rest is
468 if ($t_date) { # mostly ours
469 $the_version = ",\n$t_date";
470 if ($PACKAGE_VERSION) {
471 $the_version .= ", Release $PACKAGE_VERSION$RELEASE_INFO";
472 }
Fred Drake15796f71998-11-30 19:25:47 +0000473 }
Fred Drake9443dc32001-08-10 20:12:09 +0000474 my $about;
475 open(ABOUT, "<$ABOUT_FILE") || die "\n$!\n";
476 sysread(ABOUT, $about, 1024*1024);
477 close(ABOUT);
Fred Drake15796f71998-11-30 19:25:47 +0000478 $_ = (($INFO == 1)
Fred Drakeb35f2b71999-09-23 16:53:09 +0000479 ? join('',
480 $close_all,
481 "<strong>$t_title</strong>$the_version\n",
Fred Drake9443dc32001-08-10 20:12:09 +0000482 $about,
Fred Drakeb35f2b71999-09-23 16:53:09 +0000483 $open_all, $_)
484 : join('', $close_all, $INFO,"\n", $open_all, $_));
Fred Drake15796f71998-11-30 19:25:47 +0000485 $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000486}
487
Fred Drakec6f3c8b2004-08-19 01:37:48 +0000488$GENERAL_INDEX_FILE = '';
489$MODULE_INDEX_FILE = '';
490
Fred Drakebc7101d1998-03-06 21:18:55 +0000491# $idx_mark will be replaced with the real index at the end
492sub do_cmd_textohtmlindex {
493 local($_) = @_;
494 $TITLE = $idx_title;
495 $idxfile = $CURRENT_FILE;
Fred Drakec6f3c8b2004-08-19 01:37:48 +0000496 $GENERAL_INDEX_FILE = "$CURRENT_FILE";
Fred Drake235e6b11998-03-27 05:19:43 +0000497 if (%index_labels) { make_index_labels(); }
498 if (($SHORT_INDEX) && (%index_segment)) { make_preindex(); }
Fred Drakebc7101d1998-03-06 21:18:55 +0000499 else { $preindex = ''; }
Fred Drake235e6b11998-03-27 05:19:43 +0000500 my $heading = make_section_heading($idx_title, 'h2') . $idx_mark;
Fred Drakef5478632002-05-23 17:59:16 +0000501 my($pre, $post) = minimize_open_tags($heading);
Fred Drake7a556422003-09-04 22:21:17 +0000502 anchor_label('genindex',$CURRENT_FILE,$_); # this is added
Fred Drake2fc88a62003-08-05 03:45:37 +0000503 return "<br />\n" . $pre . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000504}
505
506# $idx_module_mark will be replaced with the real index at the end
507sub do_cmd_textohtmlmoduleindex {
508 local($_) = @_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000509 $TITLE = $idx_module_title;
Fred Drakec5681732000-09-12 20:13:04 +0000510 anchor_label('modindex', $CURRENT_FILE, $_);
511 $MODULE_INDEX_FILE = "$CURRENT_FILE";
Fred Drake2fc88a62003-08-05 03:45:37 +0000512 $_ = ('<p></p>' . make_section_heading($idx_module_title, 'h2')
Fred Drakec5681732000-09-12 20:13:04 +0000513 . $idx_module_mark . $_);
514 return $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000515}
516
Fred Drakec5681732000-09-12 20:13:04 +0000517# The bibliography and the index should be treated as separate
518# sections in their own HTML files. The \bibliography{} command acts
519# as a sectioning command that has the desired effect. But when the
520# bibliography is constructed manually using the thebibliography
521# environment, or when using the theindex environment it is not
522# possible to use the normal sectioning mechanism. This subroutine
523# inserts a \bibliography{} or a dummy \textohtmlindex command just
524# before the appropriate environments to force sectioning.
Fred Drakebc7101d1998-03-06 21:18:55 +0000525
Fred Drake7a556422003-09-04 22:21:17 +0000526# XXX This *assumes* that if there are two {theindex} environments,
527# the first is the module index and the second is the standard
528# index. This is sufficient for the current Python documentation,
529# but that's about it.
Fred Drakebc7101d1998-03-06 21:18:55 +0000530
531sub add_bbl_and_idx_dummy_commands {
Fred Drake11916921998-04-02 22:30:57 +0000532 my $id = $global{'max_id'};
Fred Drakebc7101d1998-03-06 21:18:55 +0000533
Fred Drakea219b412001-10-22 16:57:49 +0000534 if (/[\\]tableofcontents/) {
535 $HAVE_TABLE_OF_CONTENTS = 1;
536 }
Fred Drakebc7101d1998-03-06 21:18:55 +0000537 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
Fred Drake191439a1999-09-22 19:50:51 +0000538 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo;
Fred Drake85d14c92000-07-31 17:53:45 +0000539 my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
540 if (scalar(@parts) == 3) {
541 # Be careful to re-write the string in place, since $_ is *not*
542 # returned explicity; *** nasty side-effect dependency! ***
Fred Drakebb7775a2001-12-04 17:03:54 +0000543 print "\nadd_bbl_and_idx_dummy_commands ==> adding general index";
Fred Drake85d14c92000-07-31 17:53:45 +0000544 print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
545 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
546 . "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
Fred Drake73c5b6602002-10-24 16:36:05 +0000547 s/$rx/\\textohtmlmoduleindex $1 \\textohtmlindex $2/o;
Fred Drake85d14c92000-07-31 17:53:45 +0000548 # Add a button to the navigation areas:
Fred Drakeaaa23852000-09-14 22:20:41 +0000549 $CUSTOM_BUTTONS .= ('<a href="modindex.html" title="Module Index">'
Fred Draked18722b2001-01-02 22:08:48 +0000550 . get_my_icon('modules')
Fred Drakeaaa23852000-09-14 22:20:41 +0000551 . '</a>');
Fred Drakea219b412001-10-22 16:57:49 +0000552 $HAVE_MODULE_INDEX = 1;
553 $HAVE_GENERAL_INDEX = 1;
554 }
555 elsif (scalar(@parts) == 2) {
Fred Drakebb7775a2001-12-04 17:03:54 +0000556 print "\nadd_bbl_and_idx_dummy_commands ==> adding general index";
557 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
Fred Drake73c5b6602002-10-24 16:36:05 +0000558 s/$rx/\\textohtmlindex $1/o;
Fred Drakea219b412001-10-22 16:57:49 +0000559 $HAVE_GENERAL_INDEX = 1;
Fred Drake11916921998-04-02 22:30:57 +0000560 }
Fred Drakebb7775a2001-12-04 17:03:54 +0000561 elsif (scalar(@parts) == 1) {
562 print "\nadd_bbl_and_idx_dummy_commands ==> no index found";
Fred Draked18722b2001-01-02 22:08:48 +0000563 $CUSTOM_BUTTONS .= get_my_icon('blank');
Fred Drake85d14c92000-07-31 17:53:45 +0000564 $global{'max_id'} = $id; # not sure why....
565 s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
Fred Drake7a556422003-09-04 22:21:17 +0000566 s/[\\]printindex/\\textohtmlindex /o;
Fred Drakebb7775a2001-12-04 17:03:54 +0000567 }
568 else {
569 die "\n\nBad number of index environments!\n\n";
570 }
Fred Drake11916921998-04-02 22:30:57 +0000571 #----------------------------------------------------------------------
Fred Drake64bdc241998-04-17 02:14:12 +0000572 lib_add_bbl_and_idx_dummy_commands()
Fred Drake11916921998-04-02 22:30:57 +0000573 if defined(&lib_add_bbl_and_idx_dummy_commands);
Fred Drakebc7101d1998-03-06 21:18:55 +0000574}
575
Fred Drakec5681732000-09-12 20:13:04 +0000576# The bibliographic references, the appendices, the lists of figures
577# and tables etc. must appear in the contents table at the same level
578# as the outermost sectioning command. This subroutine finds what is
579# the outermost level and sets the above to the same level;
Fred Drakebc7101d1998-03-06 21:18:55 +0000580
Fred Drake13210ed1998-03-17 06:28:05 +0000581sub set_depth_levels {
582 # Sets $outermost_level
Fred Drake11916921998-04-02 22:30:57 +0000583 my $level;
Fred Drake13210ed1998-03-17 06:28:05 +0000584 #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH
585 foreach $level ("part", "chapter", "section", "subsection",
Fred Drake7a556422003-09-04 22:21:17 +0000586 "subsubsection", "paragraph") {
587 last if (($outermost_level) = /\\($level)$delimiter_rx/);
Fred Drake13210ed1998-03-17 06:28:05 +0000588 }
589 $level = ($outermost_level ? $section_commands{$outermost_level} :
Fred Drake7a556422003-09-04 22:21:17 +0000590 do {$outermost_level = 'section'; 3;});
Fred Drakebc7101d1998-03-06 21:18:55 +0000591
Fred Drake13210ed1998-03-17 06:28:05 +0000592 #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given
Fred Drake7a556422003-09-04 22:21:17 +0000593 if ($REL_DEPTH && $MAX_SPLIT_DEPTH) {
594 $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH;
Fred Drake13210ed1998-03-17 06:28:05 +0000595 } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 };
Fred Drakebc7101d1998-03-06 21:18:55 +0000596
Fred Drake64bdc241998-04-17 02:14:12 +0000597 %unnumbered_section_commands = ('tableofcontents' => $level,
Fred Drake7a556422003-09-04 22:21:17 +0000598 'listoffigures' => $level,
599 'listoftables' => $level,
600 'bibliography' => $level,
601 'textohtmlindex' => $level,
602 'textohtmlmoduleindex' => $level);
Fred Drake64bdc241998-04-17 02:14:12 +0000603 $section_headings{'textohtmlmoduleindex'} = 'h1';
Fred Drakebc7101d1998-03-06 21:18:55 +0000604
Fred Drake64bdc241998-04-17 02:14:12 +0000605 %section_commands = (%unnumbered_section_commands,
Fred Drake7a556422003-09-04 22:21:17 +0000606 %section_commands);
Fred Drake11916921998-04-02 22:30:57 +0000607
608 make_sections_rx();
Fred Drake13210ed1998-03-17 06:28:05 +0000609}
Fred Drakebc7101d1998-03-06 21:18:55 +0000610
611
Fred Drake1072e461998-04-12 02:16:34 +0000612# This changes the markup used for {verbatim} environments, and is the
Fred Drake95474f91999-02-09 18:45:50 +0000613# best way I've found that ensures the <dl> goes on the outside of the
Fred Drake1072e461998-04-12 02:16:34 +0000614# <pre>...</pre>.
615#
616# Note that this *must* be done in the init file, not the python.perl
Fred Drakec5681732000-09-12 20:13:04 +0000617# style support file. The %declarations must be set before
618# initialize() is called in the main LaTeX2HTML script (which happens
619# before style files are loaded).
Fred Drake1072e461998-04-12 02:16:34 +0000620#
Fred Drake8a5e6792002-04-15 18:41:31 +0000621%declarations = ('preform' => '<div class="verbatim"><pre></pre></div>',
Fred Drake7a556422003-09-04 22:21:17 +0000622 %declarations);
Fred Drake1072e461998-04-12 02:16:34 +0000623
Fred Drakee15956b2000-04-03 04:51:13 +0000624
Fred Drakebf8ec3e2003-05-02 20:18:01 +0000625# This is used to map the link rel attributes LaTeX2HTML uses to those
626# currently recommended by the W3C.
627sub custom_REL_hook {
628 my($rel,$junk) = @_;
629 return 'parent' if $rel eq 'up';
630 return 'prev' if $rel eq 'previous';
631 return $rel;
632}
633
Fred Drakec5681732000-09-12 20:13:04 +0000634# This is added to get rid of the long comment that follows the
635# doctype declaration; MSIE5 on NT4 SP4 barfs on it and drops the
636# content of the page.
Fred Drakea219b412001-10-22 16:57:49 +0000637$MY_PARTIAL_HEADER = '';
Fred Drakef5478632002-05-23 17:59:16 +0000638sub make_head_and_body($$) {
Fred Drake85d14c92000-07-31 17:53:45 +0000639 my($title, $body) = @_;
Fred Drake16816272000-09-16 20:40:44 +0000640 $body = " $body" unless ($body eq '');
Fred Drake85d14c92000-07-31 17:53:45 +0000641 my $DTDcomment = '';
642 my($version, $isolanguage) = ($HTML_VERSION, 'EN');
643 my %isolanguages = ( 'english', 'EN' , 'USenglish', 'EN.US'
644 , 'original', 'EN' , 'german' , 'DE'
645 , 'austrian', 'DE.AT', 'french' , 'FR'
646 , 'spanish', 'ES');
Fred Drakee15956b2000-04-03 04:51:13 +0000647 $isolanguage = $isolanguages{$default_language};
648 $isolanguage = 'EN' unless $isolanguage;
649 $title = &purify($title,1);
650 eval("\$title = ". $default_title ) unless ($title);
651
Fred Drake2fc88a62003-08-05 03:45:37 +0000652 # allow user-modification of the <title> tag; thanks Dan Young
Fred Drakee15956b2000-04-03 04:51:13 +0000653 if (defined &custom_TITLE_hook) {
Fred Drake7a556422003-09-04 22:21:17 +0000654 $title = &custom_TITLE_hook($title, $toc_sec_title);
Fred Drakee15956b2000-04-03 04:51:13 +0000655 }
656
657 if ($DOCTYPE =~ /\/\/[\w\.]+\s*$/) { # language spec included
Fred Drake7a556422003-09-04 22:21:17 +0000658 $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE\">\n";
Fred Drakee15956b2000-04-03 04:51:13 +0000659 } else {
Fred Drake7a556422003-09-04 22:21:17 +0000660 $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE//"
661 . ($ISO_LANGUAGE ? $ISO_LANGUAGE : $isolanguage) . "\">\n";
Fred Drakee15956b2000-04-03 04:51:13 +0000662 }
Fred Drakea219b412001-10-22 16:57:49 +0000663 if ($MY_PARTIAL_HEADER eq '') {
Fred Drake0384be32004-11-05 05:06:08 +0000664 my $favicon = '';
665 if ($FAVORITES_ICON) {
666 my($myname, $mydir, $myext) = fileparse($FAVORITES_ICON, '\..*');
667 my $favtype = '';
668 if ($myext eq '.gif' || $myext eq '.png') {
669 $myext =~ s/^[.]//;
670 $favtype = " type=\"image/$myext\"";
671 }
672 $favicon = (
673 "\n<link rel=\"SHORTCUT ICON\" href=\"$FAVORITES_ICON\""
674 . "$favtype />");
675 }
Fred Drakea219b412001-10-22 16:57:49 +0000676 $STYLESHEET = $FILE.".css" unless $STYLESHEET;
677 $MY_PARTIAL_HEADER = join('',
Fred Drakedd3d6a02002-10-30 17:00:58 +0000678 ($DOCTYPE ? $DTDcomment : ''),
Fred Drake98b25762003-05-02 18:21:22 +0000679 "<html>\n<head>",
Fred Drake2fc88a62003-08-05 03:45:37 +0000680 ($BASE ? "\n<base href=\"$BASE\" />" : ''),
681 "\n<link rel=\"STYLESHEET\" href=\"$STYLESHEET\" type='text/css'",
682 " />",
Fred Drake0384be32004-11-05 05:06:08 +0000683 $favicon,
Fred Drake23949002002-10-30 21:51:18 +0000684 ($EXTERNAL_UP_LINK
Fred Drake98b25762003-05-02 18:21:22 +0000685 ? ("\n<link rel='start' href='" . $EXTERNAL_UP_LINK
686 . ($EXTERNAL_UP_TITLE ?
Fred Drake2fc88a62003-08-05 03:45:37 +0000687 "' title='$EXTERNAL_UP_TITLE' />" : "' />"))
Fred Drake23949002002-10-30 21:51:18 +0000688 : ''),
Fred Drake98b25762003-05-02 18:21:22 +0000689 "\n<link rel=\"first\" href=\"$FILE.html\"",
Fred Drake23949002002-10-30 21:51:18 +0000690 ($t_title ? " title='$t_title'" : ''),
Fred Drake2fc88a62003-08-05 03:45:37 +0000691 ' />',
Fred Drakea219b412001-10-22 16:57:49 +0000692 ($HAVE_TABLE_OF_CONTENTS
Fred Drake095f8172003-06-27 18:26:01 +0000693 ? ("\n<link rel='contents' href='$MY_CONTENTS_PAGE'"
Fred Drake2fc88a62003-08-05 03:45:37 +0000694 . ' title="Contents" />')
Fred Drakea219b412001-10-22 16:57:49 +0000695 : ''),
696 ($HAVE_GENERAL_INDEX
Fred Drakec6f3c8b2004-08-19 01:37:48 +0000697 ? ("\n<link rel='index' href='$GENERAL_INDEX_FILE'"
698 . " title='Index' />")
Fred Drakea219b412001-10-22 16:57:49 +0000699 : ''),
700 # disable for now -- Mozilla doesn't do well with multiple indexes
701 # ($HAVE_MODULE_INDEX
Fred Drakec6f3c8b2004-08-19 01:37:48 +0000702 # ? ("<link rel="index" href='$MODULE_INDEX_FILE'"
703 # . " title='Module Index' />\n")
Fred Drakea219b412001-10-22 16:57:49 +0000704 # : ''),
Fred Drake23949002002-10-30 21:51:18 +0000705 ($INFO
706 # XXX We can do this with the Python tools since the About...
707 # page always gets copied to about.html, even when we use the
708 # generated node###.html page names. Won't work with the
709 # rest of the Python doc tools.
Fred Drake98b25762003-05-02 18:21:22 +0000710 ? ("\n<link rel='last' href='about.html'"
Fred Drake2fc88a62003-08-05 03:45:37 +0000711 . " title='About this document...' />"
Fred Drake98b25762003-05-02 18:21:22 +0000712 . "\n<link rel='help' href='about.html'"
Fred Drake2fc88a62003-08-05 03:45:37 +0000713 . " title='About this document...' />")
Fred Drake23949002002-10-30 21:51:18 +0000714 : ''),
Fred Drakedd3d6a02002-10-30 17:00:58 +0000715 $more_links_mark,
Fred Drake0e2e6872002-10-30 19:55:23 +0000716 "\n",
Fred Drakedd3d6a02002-10-30 17:00:58 +0000717 ($CHARSET && $HTML_VERSION ge "2.1"
718 ? ('<meta http-equiv="Content-Type" content="text/html; '
Fred Drake2fc88a62003-08-05 03:45:37 +0000719 . "charset=$CHARSET\" />\n")
Fred Drakedd3d6a02002-10-30 17:00:58 +0000720 : ''),
721 ($AESOP_META_TYPE
Fred Drake2fc88a62003-08-05 03:45:37 +0000722 ? "<meta name='aesop' content='$AESOP_META_TYPE' />\n" : ''));
Fred Drakea219b412001-10-22 16:57:49 +0000723 }
Fred Drake0e2e6872002-10-30 19:55:23 +0000724 if (!$charset && $CHARSET) {
725 $charset = $CHARSET;
726 $charset =~ s/_/\-/go;
727 }
Fred Drakef06b9052003-05-02 18:08:16 +0000728 # Remove section number from the title for use in the
729 # <meta name='description' ...> element in the document head.
730 my $metatitle = "$title";
731 $metatitle =~ s/^\d+(\.\d+)*\s*//;
Fred Drake2fc88a62003-08-05 03:45:37 +0000732 $metatitle = meta_information($metatitle);
733 $metatitle =~ s/ NAME=/ name=/g;
734 $metatitle =~ s/ CONTENT=/ content=/g;
Fred Drakef06b9052003-05-02 18:08:16 +0000735
Fred Drakedd3d6a02002-10-30 17:00:58 +0000736 join('',
737 $MY_PARTIAL_HEADER,
Fred Drake2fc88a62003-08-05 03:45:37 +0000738 $metatitle,
Fred Drakedd3d6a02002-10-30 17:00:58 +0000739 "<title>", $title, "</title>\n</head>\n<body$body>");
Fred Drakee15956b2000-04-03 04:51:13 +0000740}
741
Fred Drake2fc88a62003-08-05 03:45:37 +0000742sub replace_morelinks {
743 $more_links =~ s/ REL=/ rel=/g;
744 $more_links =~ s/ HREF=/ href=/g;
745 $_ =~ s/$more_links_mark/$more_links/e;
746}
747
Fred Drake7a556422003-09-04 22:21:17 +00007481; # This must be the last line