test_whitespace_eater_unicode(): Make this test Python 2.1 compatible.
[python/dscho.git] / Doc / perl / l2hinit.perl
blob6da39268fddae023a5caff209d72ade703845d22
1 # LaTeX2HTML support base for use with Python documentation.
3 package main;
5 use L2hos;
7 $HTML_VERSION = 4.0;
9 $MAX_LINK_DEPTH = 2;
10 $ADDRESS = '';
12 $NO_FOOTNODE = 1;
13 $NUMBERED_FOOTNOTES = 1;
15 # Python documentation uses section numbers to support references to match
16 # in the printed and online versions.
18 $SHOW_SECTION_NUMBERS = 1;
20 $ICONSERVER = '.';
21 $IMAGE_TYPE = 'gif';
23 # Control where the navigation bars should show up:
24 $TOP_NAVIGATION = 1;
25 $BOTTOM_NAVIGATION = 1;
26 $AUTO_NAVIGATION = 0;
28 $BODYTEXT = '';
29 $CHILDLINE = "\n<p><hr>\n";
30 $VERBOSITY = 0;
32 # default # of columns for the indexes
33 $INDEX_COLUMNS = 2;
34 $MODULE_INDEX_COLUMNS = 4;
36 $HAVE_MODULE_INDEX = 0;
37 $HAVE_GENERAL_INDEX = 0;
38 $HAVE_TABLE_OF_CONTENTS = 0;
40 $AESOP_META_TYPE = 'information';
43 # A little painful, but lets us clean up the top level directory a little,
44 # 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.
50 if (!defined $mydir) {
51 use Cwd;
52 use File::Basename;
53 ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*');
54 chop $mydir; # remove trailing '/'
55 $mydir = getcwd() . "$dd$mydir"
56 unless $mydir =~ s|^/|/|;
58 $LATEX2HTMLSTYLES = "$mydir$envkey$LATEX2HTMLSTYLES";
59 push (@INC, $mydir);
61 ($myrootname, $myrootdir, $myext) = fileparse($mydir, '\..*');
62 chop $myrootdir;
65 # 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.
70 if (defined $ENV{'PAPER'}) {
71 $mytexinputs = "$myrootdir${dd}paper-$ENV{'PAPER'}$envkey";
73 else {
74 $mytexinputs = getcwd() . $envkey;
76 $mytexinputs .= "$myrootdir${dd}texinputs";
79 # Change this variable to change the text added in "About this document...";
80 # this should be an absolute pathname to get it right.
82 $ABOUT_FILE = "$myrootdir${dd}html${dd}stdabout.dat";
85 sub custom_driver_hook {
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.
91 my $file = $_[0];
92 my($jobname, $dir, $ext) = fileparse($file, '\..*');
93 $dir = L2hos->Make_directory_absolute($dir);
94 $dir =~ s/$dd$//;
95 $TEXINPUTS = "$dir$envkey$mytexinputs";
96 print "\nAdding $dir to \$TEXINPUTS\n";
100 $CUSTOM_BUTTONS = '';
102 sub make_nav_sectref($$) {
103 my($label, $title) = @_;
104 if ($title) {
105 if ($title =~ /\<[aA] /) {
106 $title =~ s/\<[aA] /<a class="sectref" /;
108 else {
109 $title = "<span class=\"sectref\">$title</span>";
111 return "<b class=\"navlabel\">$label:</b> $title\n";
113 return '';
116 @my_icon_tags = ();
117 $my_icon_tags{'next'} = 'Next Page';
118 $my_icon_tags{'next_page'} = 'Next Page';
119 $my_icon_tags{'previous'} = 'Previous Page';
120 $my_icon_tags{'previous_page'} = 'Previous Page';
121 $my_icon_tags{'up'} = 'Up One Level';
122 $my_icon_tags{'contents'} = 'Contents';
123 $my_icon_tags{'index'} = 'Index';
124 $my_icon_tags{'modules'} = 'Module Index';
126 @my_icon_names = ();
127 $my_icon_names{'previous_page'} = 'previous';
128 $my_icon_names{'next_page'} = 'next';
130 sub get_my_icon($) {
131 my $name = $_[0];
132 my $text = $my_icon_tags{$name};
133 if ($my_icon_names{$name}) {
134 $name = $my_icon_names{$name};
136 if ($text eq '') {
137 $name = 'blank';
139 my $iconserver = ($ICONSERVER eq '.') ? '' : "$ICONSERVER/";
140 return "<img src='$iconserver$name.$IMAGE_TYPE'\n border='0'"
141 . " height='32' alt='$text' width='32'>";
144 sub use_my_icon($) {
145 my $s = $_[0];
146 if ($s =~ /\<tex2html_([a-z_]+)_visible_mark\>/) {
147 my $r = get_my_icon($1);
148 $s =~ s/\<tex2html_[a-z_]+_visible_mark\>/$r/;
150 return $s;
153 sub make_nav_panel() {
154 my $s;
155 my $BLANK_ICON = get_my_icon('blank');
156 $NEXT = $NEXT_TITLE ? use_my_icon("$NEXT") : $BLANK_ICON;
157 $UP = $UP_TITLE ? use_my_icon("$UP") : $BLANK_ICON;
158 $PREVIOUS = $PREVIOUS_TITLE ? use_my_icon("$PREVIOUS") : $BLANK_ICON;
159 $CONTENTS = use_my_icon("$CONTENTS");
160 $INDEX = $INDEX ? use_my_icon("$INDEX") : $BLANK_ICON;
161 if (!$CUSTOM_BUTTONS) {
162 $CUSTOM_BUTTONS = $BLANK_ICON;
164 $s = ('<table align="center" width="100%" cellpadding="0" cellspacing="2">'
165 . "\n<tr>"
166 # left-hand side
167 . "\n<td>$PREVIOUS</td>"
168 . "\n<td>$UP</td>"
169 . "\n<td>$NEXT</td>"
170 # title box
171 . "\n<td align=\"center\" width=\"100%\">$t_title</td>"
172 # right-hand side
173 . "\n<td>$CONTENTS</td>"
174 . "\n<td>$CUSTOM_BUTTONS</td>" # module index
175 . "\n<td>$INDEX</td>"
176 . "\n</tr></table>\n"
177 # textual navigation
178 . make_nav_sectref("Previous", $PREVIOUS_TITLE)
179 . make_nav_sectref("Up", $UP_TITLE)
180 . make_nav_sectref("Next", $NEXT_TITLE)
182 # remove these; they are unnecessary and cause errors from validation
183 $s =~ s/ NAME="tex2html\d+"\n */ /g;
184 return $s;
187 sub add_child_links {
188 my $toc = add_real_child_links(@_);
189 $toc =~ s|\s*</[aA]>|</a>|g;
190 $toc =~ s/ NAME=\"tex2html\d+\"\s*href=/ href=/gi;
191 $toc =~ s|</UL>(\s*<BR>)?|</ul>|gi;
192 return $toc;
195 sub get_version_text() {
196 if ($PACKAGE_VERSION ne '' && $t_date) {
197 return ("<span class=\"release-info\">"
198 . "Release $PACKAGE_VERSION$RELEASE_INFO,"
199 . " documentation updated on $t_date.</span>");
201 if ($PACKAGE_VERSION ne '') {
202 return ("<span class=\"release-info\">"
203 . "Release $PACKAGE_VERSION$RELEASE_INFO.</span>");
205 if ($t_date) {
206 return ("<span class=\"release-info\">Documentation released on "
207 . "$t_date.</span>");
209 return '';
213 sub top_navigation_panel() {
214 return "\n"
215 . make_nav_panel()
216 . "<br><hr>\n";
219 sub bot_navigation_panel() {
220 return "\n<p><hr>\n"
221 . make_nav_panel()
222 . "<hr>\n"
223 . get_version_text()
224 . "\n";
227 sub add_link {
228 # Returns a pair (iconic link, textual link)
229 my($icon, $current_file, @link) = @_;
230 my($dummy, $file, $title) = split($delim,
231 $section_info{join(' ',@link)});
232 if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) {
233 my $r = get_my_icon($1);
234 $icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/;
236 if ($title && ($file ne $current_file)) {
237 $title = purify($title);
238 $title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES);
239 return (make_href($file, $icon), make_href($file, "$title"))
241 elsif ($icon eq get_my_icon('up') && $EXTERNAL_UP_LINK) {
242 return (make_href($EXTERNAL_UP_LINK, $icon),
243 make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE"))
245 elsif ($icon eq get_my_icon('previous')
246 && $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) {
247 return (make_href($EXTERNAL_PREV_LINK, $icon),
248 make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE"))
250 elsif ($icon eq get_my_icon('next')
251 && $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) {
252 return (make_href($EXTERNAL_DOWN_LINK, $icon),
253 make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE"))
255 return (&inactive_img($icon), "");
258 sub add_special_link($$$) {
259 my($icon, $file, $current_file) = @_;
260 if ($icon =~ /\<tex2html_([_a-z]+)_visible_mark\>/) {
261 my $r = get_my_icon($1);
262 $icon =~ s/\<tex2html_[_a-z]+_visible_mark\>/$r/;
264 return (($file && ($file ne $current_file))
265 ? make_href($file, $icon)
266 : undef)
269 # The img_tag() function seems only to be called with the parameter
270 # 'anchor_invisible_mark', which we want to turn into ''. Since
271 # replace_icon_marks() is the only interesting caller, and all it really
272 # does is call img_tag(), we can just define the hook alternative to be
273 # a no-op instead.
275 sub replace_icons_hook {}
277 sub do_cmd_arabic {
278 # get rid of that nasty <SPAN CLASS="arabic">...</SPAN>
279 my($ctr, $val, $id, $text) = &read_counter_value($_[0]);
280 return ($val ? farabic($val) : "0") . $text;
284 sub gen_index_id($$) {
285 # this is used to ensure common index key generation and a stable sort
286 my($str, $extra) = @_;
287 sprintf('%s###%s%010d', $str, $extra, ++$global{'max_id'});
290 sub insert_index($$$$$) {
291 my($mark, $datafile, $columns, $letters, $prefix) = @_;
292 my $prog = "$myrootdir/tools/buildindex.py";
293 my $index;
294 if ($letters) {
295 $index = `$prog --columns $columns --letters $datafile`;
297 else {
298 $index = `$prog --columns $columns $datafile`;
300 if (!s/$mark/$prefix$index/) {
301 print "\nCould not locate index mark: $mark";
305 sub add_idx() {
306 print "\nBuilding HTML for the index ...";
307 close(IDXFILE);
308 insert_index($idx_mark, 'index.dat', $INDEX_COLUMNS, 1, '');
312 $idx_module_mark = '<tex2html_idx_module_mark>';
313 $idx_module_title = 'Module Index';
315 sub add_module_idx() {
316 print "\nBuilding HTML for the module index ...";
317 my $key;
318 my $first = 1;
319 my $prevplat = '';
320 my $allthesame = 1;
321 my $prefix = '';
322 foreach $key (keys %Modules) {
323 $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/$1/;
324 my $plat = "$ModulePlatforms{$key}";
325 $plat = ''
326 if ($plat eq $IGNORE_PLATFORM_ANNOTATION);
327 if (!$first) {
328 $allthesame = 0
329 if ($prevplat ne $plat);
331 else { $first = 0; }
332 $prevplat = $plat;
334 open(MODIDXFILE, '>modindex.dat') || die "\n$!\n";
335 foreach $key (keys %Modules) {
336 # dump the line in the data file; just use a dummy seqno field
337 my $nkey = $1;
338 my $moditem = "$Modules{$key}";
339 my $plat = '';
340 $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/$1/;
341 if ($ModulePlatforms{$key} && !$allthesame) {
342 $plat = (" <em>(<span class=\"platform\">$ModulePlatforms{$key}"
343 . '</span>)</em>');
345 print MODIDXFILE $moditem . $IDXFILE_FIELD_SEP
346 . "<tt class=\"module\">$key</tt>$plat###\n";
348 close(MODIDXFILE);
350 if ($GLOBAL_MODULE_INDEX) {
351 $prefix = <<MODULE_INDEX_PREFIX;
353 <p> This index only lists modules documented in this manual.
354 The <em class="citetitle"><a href="$GLOBAL_MODULE_INDEX">Global Module
355 Index</a></em> lists all modules that are documented in this set
356 of manuals.</p>
357 MODULE_INDEX_PREFIX
359 if (!$allthesame) {
360 $prefix .= <<PLAT_DISCUSS;
362 <p> Some module names are followed by an annotation indicating what
363 platform they are available on.</p>
365 PLAT_DISCUSS
367 insert_index($idx_module_mark, 'modindex.dat', $MODULE_INDEX_COLUMNS, 0,
368 $prefix);
371 # replace both indexes as needed:
372 sub add_idx_hook {
373 add_idx() if (/$idx_mark/);
374 process_python_state();
375 if ($MODULE_INDEX_FILE) {
376 local ($_);
377 open(MYFILE, "<$MODULE_INDEX_FILE");
378 sysread(MYFILE, $_, 1024*1024);
379 close(MYFILE);
380 add_module_idx();
381 open(MYFILE,">$MODULE_INDEX_FILE");
382 print MYFILE $_;
383 close(MYFILE);
388 # In addition to the standard stuff, add label to allow named node files and
389 # support suppression of the page complete (for HTML Help use).
390 sub do_cmd_tableofcontents {
391 local($_) = @_;
392 $TITLE = $toc_title;
393 $tocfile = $CURRENT_FILE;
394 my($closures, $reopens) = preserve_open_tags();
395 anchor_label('contents', $CURRENT_FILE, $_); # this is added
396 join('', "<BR>\n\\tableofchildlinks[off]", $closures
397 , make_section_heading($toc_title, 'H2'), $toc_mark
398 , $reopens, $_);
400 # In addition to the standard stuff, add label to allow named node files.
401 sub do_cmd_listoffigures {
402 local($_) = @_;
403 $TITLE = $lof_title;
404 $loffile = $CURRENT_FILE;
405 my($closures, $reopens) = preserve_open_tags();
406 anchor_label('lof', $CURRENT_FILE, $_); # this is added
407 join('', "<BR>\n", $closures
408 , make_section_heading($lof_title, 'H2'), $lof_mark
409 , $reopens, $_);
411 # In addition to the standard stuff, add label to allow named node files.
412 sub do_cmd_listoftables {
413 local($_) = @_;
414 $TITLE = $lot_title;
415 $lotfile = $CURRENT_FILE;
416 my($closures, $reopens) = preserve_open_tags();
417 anchor_label('lot', $CURRENT_FILE, $_); # this is added
418 join('', "<BR>\n", $closures
419 , make_section_heading($lot_title, 'H2'), $lot_mark
420 , $reopens, $_);
422 # In addition to the standard stuff, add label to allow named node files.
423 sub do_cmd_textohtmlinfopage {
424 local($_) = @_;
425 if ($INFO) { #
426 anchor_label("about",$CURRENT_FILE,$_); # this is added
428 my $the_version = ''; # and the rest is
429 if ($t_date) { # mostly ours
430 $the_version = ",\n$t_date";
431 if ($PACKAGE_VERSION) {
432 $the_version .= ", Release $PACKAGE_VERSION$RELEASE_INFO";
435 my $about;
436 open(ABOUT, "<$ABOUT_FILE") || die "\n$!\n";
437 sysread(ABOUT, $about, 1024*1024);
438 close(ABOUT);
439 $_ = (($INFO == 1)
440 ? join('',
441 $close_all,
442 "<strong>$t_title</strong>$the_version\n",
443 $about,
444 $open_all, $_)
445 : join('', $close_all, $INFO,"\n", $open_all, $_));
449 # $idx_mark will be replaced with the real index at the end
450 sub do_cmd_textohtmlindex {
451 local($_) = @_;
452 $TITLE = $idx_title;
453 $idxfile = $CURRENT_FILE;
454 if (%index_labels) { make_index_labels(); }
455 if (($SHORT_INDEX) && (%index_segment)) { make_preindex(); }
456 else { $preindex = ''; }
457 my $heading = make_section_heading($idx_title, 'h2') . $idx_mark;
458 my($pre, $post) = minimize_open_tags($heading);
459 anchor_label('genindex',$CURRENT_FILE,$_); # this is added
460 return "<br>\n" . $pre . $_;
463 $MODULE_INDEX_FILE = '';
465 # $idx_module_mark will be replaced with the real index at the end
466 sub do_cmd_textohtmlmoduleindex {
467 local($_) = @_;
468 $TITLE = $idx_module_title;
469 anchor_label('modindex', $CURRENT_FILE, $_);
470 $MODULE_INDEX_FILE = "$CURRENT_FILE";
471 $_ = ('<p>' . make_section_heading($idx_module_title, 'h2')
472 . $idx_module_mark . $_);
473 return $_;
476 # The bibliography and the index should be treated as separate
477 # sections in their own HTML files. The \bibliography{} command acts
478 # as a sectioning command that has the desired effect. But when the
479 # bibliography is constructed manually using the thebibliography
480 # environment, or when using the theindex environment it is not
481 # possible to use the normal sectioning mechanism. This subroutine
482 # inserts a \bibliography{} or a dummy \textohtmlindex command just
483 # before the appropriate environments to force sectioning.
485 # XXX This *assumes* that if there are two {theindex} environments,
486 # the first is the module index and the second is the standard
487 # index. This is sufficient for the current Python documentation,
488 # but that's about it.
490 sub add_bbl_and_idx_dummy_commands {
491 my $id = $global{'max_id'};
493 if (/[\\]tableofcontents/) {
494 $HAVE_TABLE_OF_CONTENTS = 1;
496 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
497 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo;
498 my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
499 if (scalar(@parts) == 3) {
500 # Be careful to re-write the string in place, since $_ is *not*
501 # returned explicity; *** nasty side-effect dependency! ***
502 print "\nadd_bbl_and_idx_dummy_commands ==> adding general index";
503 print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
504 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
505 . "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
506 s/$rx/\\textohtmlmoduleindex $1 \\textohtmlindex $2/o;
507 # Add a button to the navigation areas:
508 $CUSTOM_BUTTONS .= ('<a href="modindex.html" title="Module Index">'
509 . get_my_icon('modules')
510 . '</a>');
511 $HAVE_MODULE_INDEX = 1;
512 $HAVE_GENERAL_INDEX = 1;
514 elsif (scalar(@parts) == 2) {
515 print "\nadd_bbl_and_idx_dummy_commands ==> adding general index";
516 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
517 s/$rx/\\textohtmlindex $1/o;
518 $HAVE_GENERAL_INDEX = 1;
520 elsif (scalar(@parts) == 1) {
521 print "\nadd_bbl_and_idx_dummy_commands ==> no index found";
522 $CUSTOM_BUTTONS .= get_my_icon('blank');
523 $global{'max_id'} = $id; # not sure why....
524 s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
525 s/[\\]printindex/\\textohtmlindex /o;
527 else {
528 die "\n\nBad number of index environments!\n\n";
530 #----------------------------------------------------------------------
531 lib_add_bbl_and_idx_dummy_commands()
532 if defined(&lib_add_bbl_and_idx_dummy_commands);
535 # The bibliographic references, the appendices, the lists of figures
536 # and tables etc. must appear in the contents table at the same level
537 # as the outermost sectioning command. This subroutine finds what is
538 # the outermost level and sets the above to the same level;
540 sub set_depth_levels {
541 # Sets $outermost_level
542 my $level;
543 #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH
544 foreach $level ("part", "chapter", "section", "subsection",
545 "subsubsection", "paragraph") {
546 last if (($outermost_level) = /\\($level)$delimiter_rx/);
548 $level = ($outermost_level ? $section_commands{$outermost_level} :
549 do {$outermost_level = 'section'; 3;});
551 #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given
552 if ($REL_DEPTH && $MAX_SPLIT_DEPTH) {
553 $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH;
554 } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 };
556 %unnumbered_section_commands = ('tableofcontents' => $level,
557 'listoffigures' => $level,
558 'listoftables' => $level,
559 'bibliography' => $level,
560 'textohtmlindex' => $level,
561 'textohtmlmoduleindex' => $level);
562 $section_headings{'textohtmlmoduleindex'} = 'h1';
564 %section_commands = (%unnumbered_section_commands,
565 %section_commands);
567 make_sections_rx();
571 # This changes the markup used for {verbatim} environments, and is the
572 # best way I've found that ensures the <dl> goes on the outside of the
573 # <pre>...</pre>.
575 # Note that this *must* be done in the init file, not the python.perl
576 # style support file. The %declarations must be set before
577 # initialize() is called in the main LaTeX2HTML script (which happens
578 # before style files are loaded).
580 %declarations = ('preform' => '<div class="verbatim"><pre></pre></div>',
581 %declarations);
584 # This is added to get rid of the long comment that follows the
585 # doctype declaration; MSIE5 on NT4 SP4 barfs on it and drops the
586 # content of the page.
587 $MY_PARTIAL_HEADER = '';
588 sub make_head_and_body($$) {
589 my($title, $body) = @_;
590 $body = " $body" unless ($body eq '');
591 my $DTDcomment = '';
592 my($version, $isolanguage) = ($HTML_VERSION, 'EN');
593 my %isolanguages = ( 'english', 'EN' , 'USenglish', 'EN.US'
594 , 'original', 'EN' , 'german' , 'DE'
595 , 'austrian', 'DE.AT', 'french' , 'FR'
596 , 'spanish', 'ES');
597 $isolanguage = $isolanguages{$default_language};
598 $isolanguage = 'EN' unless $isolanguage;
599 $title = &purify($title,1);
600 eval("\$title = ". $default_title ) unless ($title);
602 # allow user-modification of the <TITLE> tag; thanks Dan Young
603 if (defined &custom_TITLE_hook) {
604 $title = &custom_TITLE_hook($title, $toc_sec_title);
607 if ($DOCTYPE =~ /\/\/[\w\.]+\s*$/) { # language spec included
608 $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE\">\n";
609 } else {
610 $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE//"
611 . ($ISO_LANGUAGE ? $ISO_LANGUAGE : $isolanguage) . "\">\n";
613 if ($MY_PARTIAL_HEADER eq '') {
614 $STYLESHEET = $FILE.".css" unless $STYLESHEET;
615 $MY_PARTIAL_HEADER = join('',
616 ($DOCTYPE ? $DTDcomment : ''),
617 "<html>\n<head>\n",
618 ($BASE ? "<base href=\"$BASE\">\n" : ''),
619 "<link rel=\"STYLESHEET\" href=\"$STYLESHEET\" type='text/css'>\n",
620 ($FAVORITES_ICON
621 ? ('<link rel="SHORTCUT ICON" href="' . "$FAVORITES_ICON\">\n")
622 : ''),
623 ($EXTERNAL_UP_LINK
624 ? ('<link rel="start" href="' . "$EXTERNAL_UP_LINK\""
625 . ($EXTERNAL_UP_TITLE ? " title='$EXTERNAL_UP_TITLE'" : '')
626 . ">\n")
627 : ''),
628 "<link rel=\"first\" href=\"$FILE.html\"",
629 ($t_title ? " title='$t_title'" : ''),
630 ">\n",
631 ($HAVE_TABLE_OF_CONTENTS
632 ? ('<link rel="contents" href="contents.html" title="Contents">'
633 . ($HAVE_GENERAL_INDEX ? "\n" : ''))
634 : ''),
635 ($HAVE_GENERAL_INDEX
636 ? '<link rel="index" href="genindex.html" title="Index">' . "\n"
637 : ''),
638 # disable for now -- Mozilla doesn't do well with multiple indexes
639 # ($HAVE_MODULE_INDEX
640 # ? '<link rel="index" href="modindex.html" title="Module Index">'
641 # . "\n"
642 # : ''),
643 ($INFO
644 # XXX We can do this with the Python tools since the About...
645 # page always gets copied to about.html, even when we use the
646 # generated node###.html page names. Won't work with the
647 # rest of the Python doc tools.
648 ? ("<link rel='last' href='about.html'"
649 . " title='About this document...'>\n"
650 . "<link rel='help' href='about.html'"
651 . " title='About this document...'>\n")
652 : ''),
653 $more_links_mark,
654 "\n",
655 ($CHARSET && $HTML_VERSION ge "2.1"
656 ? ('<meta http-equiv="Content-Type" content="text/html; '
657 . "charset=$CHARSET\">\n")
658 : ''),
659 ($AESOP_META_TYPE
660 ? "<meta name='aesop' content='$AESOP_META_TYPE'>\n" : ''));
662 if (!$charset && $CHARSET) {
663 $charset = $CHARSET;
664 $charset =~ s/_/\-/go;
666 join('',
667 $MY_PARTIAL_HEADER,
668 &meta_information($title),
669 "<title>", $title, "</title>\n</head>\n<body$body>");
672 1; # This must be the last line