blob: 301343b7e6429ff1049267436acab5499aacaf29 [file] [log] [blame]
Fred Drakebc7101d1998-03-06 21:18:55 +00001#LaTeX2HTML Version 96.1 : dot.latex2html-init -*- perl -*-
2#
Fred Drake13210ed1998-03-17 06:28:05 +00003# Significantly revised by Fred L. Drake, Jr. <fdrake@acm.org> for use
4# with the Python documentation.
5#
6# New name to avoid distributing "dot" files with the Python documentation.
7#
Fred Drakebc7101d1998-03-06 21:18:55 +00008
Fred Drake41814bc1998-05-11 18:23:35 +00009package Override;
10
11use Cwd qw(getcwd);
12
13
14package main;
15
Fred Drake28e7b4c1998-10-20 18:14:20 +000016$HTML_VERSION = 4.0;
17
Fred Drake6aa5d481998-08-11 03:14:50 +000018$MAX_LINK_DEPTH = 2;
Fred Draked7571651998-04-23 20:06:24 +000019$ADDRESS = '';
Fred Drakebc7101d1998-03-06 21:18:55 +000020
Fred Drakee194beb1998-05-19 19:38:49 +000021$NO_FOOTNODE = 1;
Fred Drakebc7101d1998-03-06 21:18:55 +000022$NUMBERED_FOOTNOTES = 1;
23
24# Python documentation uses section numbers to support references to match
25# in the printed and online versions.
26#
27$SHOW_SECTION_NUMBERS = 1;
28
29$ICONSERVER = '../icons';
30
Fred Drake6aa5d481998-08-11 03:14:50 +000031# Control where the navigation bars should show up:
32$TOP_NAVIGATION = 1;
33$BOTTOM_NAVIGATION = 1;
34$AUTO_NAVIGATION = 0;
35
Fred Drake0cb76201998-08-07 16:43:29 +000036$BODYTEXT = 'bgcolor="#ffffff"';
Fred Drakebc7101d1998-03-06 21:18:55 +000037$CHILDLINE = "\n<p><hr>\n";
38$VERBOSITY = 0;
Fred Drakebc7101d1998-03-06 21:18:55 +000039
Fred Drake4d10b431998-08-07 20:51:58 +000040# default # of columns for the indexes
Fred Drakeaa3f9fb1998-08-07 19:52:37 +000041$INDEX_COLUMNS = 2;
Fred Drake4d10b431998-08-07 20:51:58 +000042$MODULE_INDEX_COLUMNS = 5;
Fred Drakeaa3f9fb1998-08-07 19:52:37 +000043
Fred Drakec9f2c141998-03-11 12:08:21 +000044
Fred Drakedb34a1e1998-03-10 23:02:57 +000045# A little painful, but lets us clean up the top level directory a little,
46# and not be tied to the current directory (as far as I can tell).
47#
Fred Drakec9f2c141998-03-11 12:08:21 +000048use Cwd;
49use File::Basename;
50($myname, $mydir, $myext) = fileparse(__FILE__, '\..*');
51chop $mydir; # remove trailing '/'
52$mydir = getcwd() . "$dd$mydir"
53 unless $mydir =~ s|^/|/|;
Fred Drakedb34a1e1998-03-10 23:02:57 +000054$LATEX2HTMLSTYLES = "$mydir$envkey$LATEX2HTMLSTYLES";
Fred Drakeb3a3ed81998-07-24 22:17:34 +000055push (@INC, $mydir);
Fred Drakebc7101d1998-03-06 21:18:55 +000056
Fred Drake235e6b11998-03-27 05:19:43 +000057($myrootname, $myrootdir, $myext) = fileparse($mydir, '\..*');
58chop $myrootdir;
59
Fred Drakebc7101d1998-03-06 21:18:55 +000060
Fred Drakea4565b01998-05-15 17:14:17 +000061# Hackish way to get the appropriate paper-*/ directory into $TEXINPUTS;
62# pass in the paper size (a4 or letter) as the environment variable PAPER
63# to add the right directory. If not given, the current directory is
64# added instead for use with HOWTO processing.
65#
66if (defined $ENV{'PAPER'}) {
67 $mytexinputs = "$myrootdir${dd}paper-$ENV{'PAPER'}$envkey";
68}
69else {
70 $mytexinputs = getcwd() . $envkey;
71}
72$mytexinputs .= "$myrootdir${dd}texinputs";
73
74
75sub custom_driver_hook{
76 #
77 # This adds the directory of the main input file to $TEXINPUTS; it
78 # seems to be sufficiently general that it should be fine for HOWTO
79 # processing.
80 #
81 my $file = @_[0];
82 my($jobname,$dir,$ext) = fileparse($file, '\..*');
83 $dir = make_directory_absolute($dir);
84 $dir =~ s/$dd$//;
85 $TEXINPUTS = "$dir$envkey$mytexinputs";
86 print "\nadding $dir to \$TEXINPUTS\n";
87}
88
89
Fred Drake062bc6e1998-08-13 22:03:46 +000090sub set_icon_size{
91 my($name, $w, $h) = @_;
92 $iconsizes{$name} = "width=$w height=$h";
93}
94
95foreach $name (split(/ /, 'up next previous contents index modules')) {
96 set_icon_size($name, 32, 32);
97}
98# The '_motif' is really annoying, and makes the HTML larger with no value
99# added, so strip it off:
100foreach $name (keys %icons) {
101 my $icon = $icons{$name};
102 $icon =~ s/_motif//;
103 $icons{$name} = $icon;
104}
Fred Drake9f7adc41998-08-11 19:33:38 +0000105
Fred Drake6aa5d481998-08-11 03:14:50 +0000106$CUSTOM_BUTTONS = '';
107
Fred Drake13210ed1998-03-17 06:28:05 +0000108sub make_nav_panel{
Fred Drake062bc6e1998-08-13 22:03:46 +0000109 ('<table width="100%" cellpadding=0 cellspacing=0><tr><td width="20%">'
110 . ($NEXT_TITLE ? "$NEXT " : '')
111 . ($UP_TITLE ? "$UP " : '')
112 . ($PREVIOUS_TITLE ? "$PREVIOUS " : '')
113 . "</td>\n<td align=center width=\"60%\"><b>$t_title</b>"
114 . "</td>\n<td align=right width=\"20%\">"
115 . $CONTENTS
116 . ' ' . $CUSTOM_BUTTONS
117 . ' ' . $INDEX
118 . "</td></tr></table>\n<hr>\n"
119 . ($NEXT_TITLE ? "<b>Next:</b> $NEXT_TITLE\n" : '')
120 . ($UP_TITLE ? "<b>Up:</b> $UP_TITLE\n" : '')
121 . ($PREVIOUS_TITLE ? "<b>Previous:</b> $PREVIOUS_TITLE\n" : ''));
Fred Drake13210ed1998-03-17 06:28:05 +0000122}
123
Fred Drakebc7101d1998-03-06 21:18:55 +0000124sub top_navigation_panel {
Fred Drake13210ed1998-03-17 06:28:05 +0000125 "<div class=navigation>\n"
Fred Drake64bdc241998-04-17 02:14:12 +0000126 . make_nav_panel()
127 . '<br><hr><p></div>';
Fred Drakebc7101d1998-03-06 21:18:55 +0000128}
129
130sub bot_navigation_panel {
Fred Drake9d4b6c51998-04-11 05:21:14 +0000131 "<p>\n<div class=navigation><hr>"
Fred Drake64bdc241998-04-17 02:14:12 +0000132 . make_nav_panel()
133 . '</div>';
134}
135
136sub add_link {
137 # Returns a pair (iconic link, textual link)
138 my($icon, $current_file, @link) = @_;
139 my($dummy, $file, $title) = split($delim,
Fred Drake28e7b4c1998-10-20 18:14:20 +0000140 $section_info{join(' ',@link)});
Fred Drake64bdc241998-04-17 02:14:12 +0000141 if ($title && ($file ne $current_file)) {
142 $title = purify($title);
143 $title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES);
144 return (make_href($file, $icon), make_href($file, "$title"))
145 }
146 elsif ($icon eq $up_visible_mark && $EXTERNAL_UP_LINK) {
147 return (make_href($EXTERNAL_UP_LINK, $icon),
148 make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE"))
149 }
150 elsif (($icon eq $previous_visible_mark
151 || $icon eq $previous_page_visible_mark)
152 && $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) {
153 return (make_href($EXTERNAL_PREV_LINK, $icon),
154 make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE"))
155 }
156 elsif (($icon eq $next_visible_mark
157 || $icon eq $next_page_visible_mark)
158 && $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) {
159 return (make_href($EXTERNAL_DOWN_LINK, $icon),
160 make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE"))
161 }
162 (&inactive_img($icon), "");
163}
164
165sub add_special_link {
166 my($icon, $file, $current_file) = @_;
167 (($file && ($file ne $current_file)) ? make_href($file, $icon) : undef)
168}
169
170sub img_tag {
171 local($icon) = @_;
172 my $alt;
173 my $align = " align=bottom ";
174
Fred Drake062bc6e1998-08-13 22:03:46 +0000175 # having this list hardcoded here is really bogus....
Fred Drake64bdc241998-04-17 02:14:12 +0000176 $alt = join('|', 'up', 'next_group', 'previous_group'
177 , 'next', 'previous', 'change_begin_right', 'change_begin'
178 , 'change_end_right', 'change_end', 'change_delete_right'
Fred Drake062bc6e1998-08-13 22:03:46 +0000179 , 'change_delete', 'contents', 'index', 'modules');
Fred Drake64bdc241998-04-17 02:14:12 +0000180
181 if ($icon =~ /(gif|png)$/) {
182 $used_icons{$icon} = 1;
183 if ($icon =~ /change_(begin|end|delete)_right/) { $align = ' ' };
184 my $nav_border = "$NAV_BORDER";
185 if ($icon =~ /($alt)/) {
186 $alt = $1;
187 }
188 else {
189 $nav_border = '1';
190 $alt = '[*]';
191 };
192 if ($LOCAL_ICONS) {
193 return join('', '<img ', $iconsizes{$1}, $align
194 ,'border=', $nav_border, ' alt="', $alt
195 ,'" src="', $icon, '">' );
196 }
197 return join('', '<img ', $iconsizes{$1}, $align
Fred Drakea0e4b781998-08-14 15:03:48 +0000198 ,'border=', $nav_border, ' alt="', $alt, "\"\n"
Fred Drake64bdc241998-04-17 02:14:12 +0000199 ,' src="', $ICONSERVER, "/$icon", '">' );
200 }
201 else {
202 return $icon;
203 }
Fred Drakebc7101d1998-03-06 21:18:55 +0000204}
205
206
Fred Drakebc7101d1998-03-06 21:18:55 +0000207sub gen_index_id {
208 # this is used to ensure common index key generation and a stable sort
Fred Drake235e6b11998-03-27 05:19:43 +0000209 my($str,$extra) = @_;
Fred Drake64bdc241998-04-17 02:14:12 +0000210 sprintf('%s###%s%010d', $str, $extra, ++$global{'max_id'});
Fred Drakebc7101d1998-03-06 21:18:55 +0000211}
212
Fred Drake13210ed1998-03-17 06:28:05 +0000213sub make_index_entry {
Fred Drake11916921998-04-02 22:30:57 +0000214 my($br_id,$str) = @_;
Fred Drake13210ed1998-03-17 06:28:05 +0000215 # If TITLE is not yet available (i.e the \index command is in the title of the
216 # current section), use $ref_before.
217 $TITLE = $ref_before unless $TITLE;
218 # Save the reference
219 $str = gen_index_id($str, '');
Fred Drake64bdc241998-04-17 02:14:12 +0000220 $index{$str} .= make_half_href("$CURRENT_FILE#$br_id");
Fred Drake13210ed1998-03-17 06:28:05 +0000221 "<a name=\"$br_id\">$anchor_invisible_mark<\/a>";
222}
Fred Drakebc7101d1998-03-06 21:18:55 +0000223
Fred Drake64bdc241998-04-17 02:14:12 +0000224
225sub insert_index{
Fred Drake4d10b431998-08-07 20:51:58 +0000226 my($mark,$datafile,$columns,$letters) = @_;
227 my $prog = "$myrootdir/tools/buildindex.py";
228 my $index;
229 if ($letters) {
230 $index = `$prog --columns $columns --letters $datafile`;
231 }
232 else {
233 $index = `$prog --columns $columns $datafile`;
234 }
Fred Drake64bdc241998-04-17 02:14:12 +0000235 s/$mark/$index/;
236}
237
Fred Drake235e6b11998-03-27 05:19:43 +0000238sub add_idx{
Fred Drake5a525191998-04-02 22:39:05 +0000239 print "\nDoing the index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000240 close(IDXFILE);
Fred Drake4d10b431998-08-07 20:51:58 +0000241 insert_index($idx_mark, 'index.dat', $INDEX_COLUMNS, 1);
Fred Drake13210ed1998-03-17 06:28:05 +0000242}
Fred Drakebc7101d1998-03-06 21:18:55 +0000243
244
245$idx_module_mark = '<tex2html_idx_module_mark>';
246$idx_module_title = 'Module Index';
247
Fred Drake13210ed1998-03-17 06:28:05 +0000248sub add_module_idx{
Fred Drakebc7101d1998-03-06 21:18:55 +0000249 print "\nDoing the module index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000250 my $key;
Fred Drake64bdc241998-04-17 02:14:12 +0000251 open(MODIDXFILE, '>modindex.dat') || die "\n$!\n";
Fred Drake235e6b11998-03-27 05:19:43 +0000252 foreach $key (keys %Modules) {
253 # dump the line in the data file; just use a dummy seqno field
Fred Drake9d4b6c51998-04-11 05:21:14 +0000254 print MODIDXFILE "$Modules{$key}" . $IDXFILE_FIELD_SEP . "$key###\n";
Fred Drakebc7101d1998-03-06 21:18:55 +0000255 }
Fred Drake235e6b11998-03-27 05:19:43 +0000256 close(MODIDXFILE);
Fred Drake4d10b431998-08-07 20:51:58 +0000257 insert_index($idx_module_mark, 'modindex.dat', $MODULE_INDEX_COLUMNS, 0);
Fred Drakebc7101d1998-03-06 21:18:55 +0000258}
259
Fred Drake235e6b11998-03-27 05:19:43 +0000260# replace both indexes as needed:
261sub add_idx_hook{
Fred Drakeb3a3ed81998-07-24 22:17:34 +0000262 add_idx() if (/$idx_mark/);
263 add_module_idx() if (/$idx_module_mark/);
264 process_all_localmoduletables();
Fred Drake235e6b11998-03-27 05:19:43 +0000265}
Fred Drakebc7101d1998-03-06 21:18:55 +0000266
Fred Drakebc7101d1998-03-06 21:18:55 +0000267
268# In addition to the standard stuff, add label to allow named node files.
269sub do_cmd_tableofcontents {
270 local($_) = @_;
271 $TITLE = $toc_title;
272 $tocfile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000273 my($closures,$reopens) = preserve_open_tags();
274 anchor_label('contents', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000275 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000276 , make_section_heading($toc_title, 'H2'), $toc_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000277 , $reopens, $_);
278}
279# In addition to the standard stuff, add label to allow named node files.
280sub do_cmd_listoffigures {
281 local($_) = @_;
282 $TITLE = $lof_title;
283 $loffile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000284 my($closures,$reopens) = preserve_open_tags();
285 anchor_label('lof', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000286 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000287 , make_section_heading($lof_title, 'H2'), $lof_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000288 , $reopens, $_);
289}
290# In addition to the standard stuff, add label to allow named node files.
291sub do_cmd_listoftables {
292 local($_) = @_;
293 $TITLE = $lot_title;
294 $lotfile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000295 my($closures,$reopens) = preserve_open_tags();
296 anchor_label('lot', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000297 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000298 , make_section_heading($lot_title, 'H2'), $lot_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000299 , $reopens, $_);
300}
301# In addition to the standard stuff, add label to allow named node files.
302sub do_cmd_textohtmlinfopage {
303 local($_) = @_;
304 if ($INFO) { #
Fred Drake64bdc241998-04-17 02:14:12 +0000305 anchor_label("about",$CURRENT_FILE,$_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000306 } #
307 ( ($INFO == 1)
308 ? join('', $close_all
309 , "<STRONG>$t_title</STRONG><P>\nThis document was generated using the\n"
310 , "<A HREF=\"$TEX2HTMLADDRESS\"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A>"
311 , " translator Version $TEX2HTMLVERSION\n"
312 , "<P>Copyright &#169; 1993, 1994, 1995, 1996, 1997,\n"
313 , "<A HREF=\"$AUTHORADDRESS\">Nikos Drakos</A>, \n"
314 , "Computer Based Learning Unit, University of Leeds.\n"
315 , "<P>The command line arguments were: <BR>\n "
316 , "<STRONG>latex2html</STRONG> <tt>$argv</tt>.\n"
317 , "<P>The translation was initiated by $address_data[0] on $address_data[1]"
318 , $open_all, $_)
319 : join('', $close_all, $INFO,"\n", $open_all, $_))
320}
321
322# $idx_mark will be replaced with the real index at the end
323sub do_cmd_textohtmlindex {
324 local($_) = @_;
325 $TITLE = $idx_title;
326 $idxfile = $CURRENT_FILE;
Fred Drake235e6b11998-03-27 05:19:43 +0000327 if (%index_labels) { make_index_labels(); }
328 if (($SHORT_INDEX) && (%index_segment)) { make_preindex(); }
Fred Drakebc7101d1998-03-06 21:18:55 +0000329 else { $preindex = ''; }
Fred Drake235e6b11998-03-27 05:19:43 +0000330 my $heading = make_section_heading($idx_title, 'h2') . $idx_mark;
Fred Drake11916921998-04-02 22:30:57 +0000331 my($pre,$post) = minimize_open_tags($heading);
Fred Drake235e6b11998-03-27 05:19:43 +0000332 anchor_label('genindex',$CURRENT_FILE,$_); # this is added
333 '<br>\n' . $pre . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000334}
335
336# $idx_module_mark will be replaced with the real index at the end
337sub do_cmd_textohtmlmoduleindex {
338 local($_) = @_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000339 $TITLE = $idx_module_title;
Fred Drake64bdc241998-04-17 02:14:12 +0000340 anchor_label("modindex",$CURRENT_FILE,$_);
Fred Drake235e6b11998-03-27 05:19:43 +0000341 '<p>' . make_section_heading($idx_module_title, "h2")
342 . $idx_module_mark . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000343}
344
345# The bibliography and the index should be treated as separate sections
346# in their own HTML files. The \bibliography{} command acts as a sectioning command
347# that has the desired effect. But when the bibliography is constructed
348# manually using the thebibliography environment, or when using the
349# theindex environment it is not possible to use the normal sectioning
350# mechanism. This subroutine inserts a \bibliography{} or a dummy
351# \textohtmlindex command just before the appropriate environments
352# to force sectioning.
353
354# XXX This *assumes* that if there are two {theindex} environments, the
355# first is the module index and the second is the standard index. This
356# is sufficient for the current Python documentation, but that's about
357# it.
358
359sub add_bbl_and_idx_dummy_commands {
Fred Drake11916921998-04-02 22:30:57 +0000360 my $id = $global{'max_id'};
Fred Drakebc7101d1998-03-06 21:18:55 +0000361
362 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
363 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo
364 #if ($bbl_cnt == 1)
365 ;
366 #}
Fred Drake11916921998-04-02 22:30:57 +0000367 #----------------------------------------------------------------------
368 # (FLD) This was added
369 my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
370 if (scalar(@parts) == 3) {
371 # Be careful to re-write the string in place, since $_ is *not*
372 # returned explicity; *** nasty side-effect dependency! ***
373 print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
374 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
375 . "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
376 s/$rx/\\textohtmlmoduleindex \1 \\textohtmlindex \2/o;
Fred Drake6aa5d481998-08-11 03:14:50 +0000377 # Add a button to the navigation areas:
Fred Drake062bc6e1998-08-13 22:03:46 +0000378 $CUSTOM_BUTTONS .= ("<a\n href=\"modindex.html\">"
379 . img_tag('modules.'.$IMAGE_TYPE) . "</a>");
Fred Drake11916921998-04-02 22:30:57 +0000380 }
381 else {
382 $global{'max_id'} = $id; # not sure why....
383 s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
384 s/[\\]printindex/\\textohtmlindex /o;
385 }
386 #----------------------------------------------------------------------
Fred Drake64bdc241998-04-17 02:14:12 +0000387 lib_add_bbl_and_idx_dummy_commands()
Fred Drake11916921998-04-02 22:30:57 +0000388 if defined(&lib_add_bbl_and_idx_dummy_commands);
Fred Drakebc7101d1998-03-06 21:18:55 +0000389}
390
391# The bibliographic references, the appendices, the lists of figures and tables
392# etc. must appear in the contents table at the same level as the outermost
393# sectioning command. This subroutine finds what is the outermost level and
394# sets the above to the same level;
395
Fred Drake13210ed1998-03-17 06:28:05 +0000396sub set_depth_levels {
397 # Sets $outermost_level
Fred Drake11916921998-04-02 22:30:57 +0000398 my $level;
Fred Drake13210ed1998-03-17 06:28:05 +0000399 #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH
400 foreach $level ("part", "chapter", "section", "subsection",
401 "subsubsection", "paragraph") {
402 last if (($outermost_level) = /\\($level)$delimiter_rx/);
403 }
404 $level = ($outermost_level ? $section_commands{$outermost_level} :
405 do {$outermost_level = 'section'; 3;});
Fred Drakebc7101d1998-03-06 21:18:55 +0000406
Fred Drake13210ed1998-03-17 06:28:05 +0000407 #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given
408 if ($REL_DEPTH && $MAX_SPLIT_DEPTH) {
409 $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH;
410 } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 };
Fred Drakebc7101d1998-03-06 21:18:55 +0000411
Fred Drake64bdc241998-04-17 02:14:12 +0000412 %unnumbered_section_commands = ('tableofcontents' => $level,
413 'listoffigures' => $level,
414 'listoftables' => $level,
415 'bibliography' => $level,
416 'textohtmlindex' => $level,
417 'textohtmlmoduleindex' => $level);
418 $section_headings{'textohtmlmoduleindex'} = 'h1';
Fred Drakebc7101d1998-03-06 21:18:55 +0000419
Fred Drake64bdc241998-04-17 02:14:12 +0000420 %section_commands = (%unnumbered_section_commands,
421 %section_commands);
Fred Drake11916921998-04-02 22:30:57 +0000422
423 make_sections_rx();
Fred Drake13210ed1998-03-17 06:28:05 +0000424}
Fred Drakebc7101d1998-03-06 21:18:55 +0000425
426
427# Fix from Ross Moore for ']' in \item[...]; this can be removed once the next
Fred Drake235e6b11998-03-27 05:19:43 +0000428# patch to LaTeX2HTML is released and tested ... if the patch gets included.
429# Be very careful to keep this around, just in case things break again!
Fred Drakebc7101d1998-03-06 21:18:55 +0000430#
431sub protect_useritems {
432 local(*_) = @_;
Fred Drake11916921998-04-02 22:30:57 +0000433 local($preitems,$thisitem);
Fred Drakebc7101d1998-03-06 21:18:55 +0000434 while (/\\item\s*\[/) {
Fred Drake11916921998-04-02 22:30:57 +0000435 $preitems .= $`;
436 $_ = $';
Fred Drakebc7101d1998-03-06 21:18:55 +0000437 $thisitem = $&.'<<'.++$global{'max_id'}.'>>';
438 s/^(((($O|$OP)\d+($C|$CP)).*\3|<[^<>]*>|[^\]<]+)*)\]/$thisitem.=$1;''/e;
Fred Drake11916921998-04-02 22:30:57 +0000439 $preitems .= $thisitem . '<<' . $global{'max_id'} . '>>]';
440 s/^]//;
Fred Drakebc7101d1998-03-06 21:18:55 +0000441 }
442 $_ = $preitems . $_;
443}
444
Fred Drake1072e461998-04-12 02:16:34 +0000445# This changes the markup used for {verbatim} environments, and is the
446# best way I've found that ensures the <dl> goes one the outside of the
447# <pre>...</pre>.
448#
449# Note that this *must* be done in the init file, not the python.perl
450# style support file. The %declarations must be set before initialize()
451# is called in the main script.
452#
Fred Drake64bdc241998-04-17 02:14:12 +0000453%declarations = ('preform' => '<dl><dd><pre></pre></dl>',
Fred Drake1072e461998-04-12 02:16:34 +0000454 %declarations);
455
Fred Drakebc7101d1998-03-06 21:18:55 +00004561; # This must be the last line