blob: 20ebbe24fadad2f8312198444cfb1c2f4e399cd9 [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 Drake6aa5d481998-08-11 03:14:50 +000016$MAX_LINK_DEPTH = 2;
Fred Draked7571651998-04-23 20:06:24 +000017$ADDRESS = '';
Fred Drakebc7101d1998-03-06 21:18:55 +000018
Fred Drakee194beb1998-05-19 19:38:49 +000019$NO_FOOTNODE = 1;
Fred Drakebc7101d1998-03-06 21:18:55 +000020$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
27$ICONSERVER = '../icons';
28
Fred Drake6aa5d481998-08-11 03:14:50 +000029# Control where the navigation bars should show up:
30$TOP_NAVIGATION = 1;
31$BOTTOM_NAVIGATION = 1;
32$AUTO_NAVIGATION = 0;
33
Fred Drake0cb76201998-08-07 16:43:29 +000034$BODYTEXT = 'bgcolor="#ffffff"';
Fred Drakebc7101d1998-03-06 21:18:55 +000035$CHILDLINE = "\n<p><hr>\n";
36$VERBOSITY = 0;
Fred Drakebc7101d1998-03-06 21:18:55 +000037
Fred Drake4d10b431998-08-07 20:51:58 +000038# default # of columns for the indexes
Fred Drakeaa3f9fb1998-08-07 19:52:37 +000039$INDEX_COLUMNS = 2;
Fred Drake4d10b431998-08-07 20:51:58 +000040$MODULE_INDEX_COLUMNS = 5;
Fred Drakeaa3f9fb1998-08-07 19:52:37 +000041
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,
44# and not be tied to the current directory (as far as I can tell).
45#
Fred Drakec9f2c141998-03-11 12:08:21 +000046use Cwd;
47use File::Basename;
48($myname, $mydir, $myext) = fileparse(__FILE__, '\..*');
49chop $mydir; # remove trailing '/'
50$mydir = getcwd() . "$dd$mydir"
51 unless $mydir =~ s|^/|/|;
Fred Drakedb34a1e1998-03-10 23:02:57 +000052$LATEX2HTMLSTYLES = "$mydir$envkey$LATEX2HTMLSTYLES";
Fred Drakeb3a3ed81998-07-24 22:17:34 +000053push (@INC, $mydir);
Fred Drakebc7101d1998-03-06 21:18:55 +000054
Fred Drake235e6b11998-03-27 05:19:43 +000055($myrootname, $myrootdir, $myext) = fileparse($mydir, '\..*');
56chop $myrootdir;
57
Fred Drakebc7101d1998-03-06 21:18:55 +000058
Fred Drakea4565b01998-05-15 17:14:17 +000059# Hackish way to get the appropriate paper-*/ directory into $TEXINPUTS;
60# pass in the paper size (a4 or letter) as the environment variable PAPER
61# to add the right directory. If not given, the current directory is
62# added instead for use with HOWTO processing.
63#
64if (defined $ENV{'PAPER'}) {
65 $mytexinputs = "$myrootdir${dd}paper-$ENV{'PAPER'}$envkey";
66}
67else {
68 $mytexinputs = getcwd() . $envkey;
69}
70$mytexinputs .= "$myrootdir${dd}texinputs";
71
72
73sub custom_driver_hook{
74 #
75 # This adds the directory of the main input file to $TEXINPUTS; it
76 # seems to be sufficiently general that it should be fine for HOWTO
77 # processing.
78 #
79 my $file = @_[0];
80 my($jobname,$dir,$ext) = fileparse($file, '\..*');
81 $dir = make_directory_absolute($dir);
82 $dir =~ s/$dd$//;
83 $TEXINPUTS = "$dir$envkey$mytexinputs";
84 print "\nadding $dir to \$TEXINPUTS\n";
85}
86
87
Fred Drake062bc6e1998-08-13 22:03:46 +000088sub set_icon_size{
89 my($name, $w, $h) = @_;
90 $iconsizes{$name} = "width=$w height=$h";
91}
92
93foreach $name (split(/ /, 'up next previous contents index modules')) {
94 set_icon_size($name, 32, 32);
95}
96# The '_motif' is really annoying, and makes the HTML larger with no value
97# added, so strip it off:
98foreach $name (keys %icons) {
99 my $icon = $icons{$name};
100 $icon =~ s/_motif//;
101 $icons{$name} = $icon;
102}
Fred Drake9f7adc41998-08-11 19:33:38 +0000103
Fred Drake6aa5d481998-08-11 03:14:50 +0000104$CUSTOM_BUTTONS = '';
105
Fred Drake13210ed1998-03-17 06:28:05 +0000106sub make_nav_panel{
Fred Drake062bc6e1998-08-13 22:03:46 +0000107 ('<table width="100%" cellpadding=0 cellspacing=0><tr><td width="20%">'
108 . ($NEXT_TITLE ? "$NEXT " : '')
109 . ($UP_TITLE ? "$UP " : '')
110 . ($PREVIOUS_TITLE ? "$PREVIOUS " : '')
111 . "</td>\n<td align=center width=\"60%\"><b>$t_title</b>"
112 . "</td>\n<td align=right width=\"20%\">"
113 . $CONTENTS
114 . ' ' . $CUSTOM_BUTTONS
115 . ' ' . $INDEX
116 . "</td></tr></table>\n<hr>\n"
117 . ($NEXT_TITLE ? "<b>Next:</b> $NEXT_TITLE\n" : '')
118 . ($UP_TITLE ? "<b>Up:</b> $UP_TITLE\n" : '')
119 . ($PREVIOUS_TITLE ? "<b>Previous:</b> $PREVIOUS_TITLE\n" : ''));
Fred Drake13210ed1998-03-17 06:28:05 +0000120}
121
Fred Drakebc7101d1998-03-06 21:18:55 +0000122sub top_navigation_panel {
Fred Drake13210ed1998-03-17 06:28:05 +0000123 "<div class=navigation>\n"
Fred Drake64bdc241998-04-17 02:14:12 +0000124 . make_nav_panel()
125 . '<br><hr><p></div>';
Fred Drakebc7101d1998-03-06 21:18:55 +0000126}
127
128sub bot_navigation_panel {
Fred Drake9d4b6c51998-04-11 05:21:14 +0000129 "<p>\n<div class=navigation><hr>"
Fred Drake64bdc241998-04-17 02:14:12 +0000130 . make_nav_panel()
131 . '</div>';
132}
133
134sub add_link {
135 # Returns a pair (iconic link, textual link)
136 my($icon, $current_file, @link) = @_;
137 my($dummy, $file, $title) = split($delim,
138 $toc_section_info{join(' ',@link)});
139 if ($title && ($file ne $current_file)) {
140 $title = purify($title);
141 $title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES);
142 return (make_href($file, $icon), make_href($file, "$title"))
143 }
144 elsif ($icon eq $up_visible_mark && $EXTERNAL_UP_LINK) {
145 return (make_href($EXTERNAL_UP_LINK, $icon),
146 make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE"))
147 }
148 elsif (($icon eq $previous_visible_mark
149 || $icon eq $previous_page_visible_mark)
150 && $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) {
151 return (make_href($EXTERNAL_PREV_LINK, $icon),
152 make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE"))
153 }
154 elsif (($icon eq $next_visible_mark
155 || $icon eq $next_page_visible_mark)
156 && $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) {
157 return (make_href($EXTERNAL_DOWN_LINK, $icon),
158 make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE"))
159 }
160 (&inactive_img($icon), "");
161}
162
163sub add_special_link {
164 my($icon, $file, $current_file) = @_;
165 (($file && ($file ne $current_file)) ? make_href($file, $icon) : undef)
166}
167
168sub img_tag {
169 local($icon) = @_;
170 my $alt;
171 my $align = " align=bottom ";
172
Fred Drake062bc6e1998-08-13 22:03:46 +0000173 # having this list hardcoded here is really bogus....
Fred Drake64bdc241998-04-17 02:14:12 +0000174 $alt = join('|', 'up', 'next_group', 'previous_group'
175 , 'next', 'previous', 'change_begin_right', 'change_begin'
176 , 'change_end_right', 'change_end', 'change_delete_right'
Fred Drake062bc6e1998-08-13 22:03:46 +0000177 , 'change_delete', 'contents', 'index', 'modules');
Fred Drake64bdc241998-04-17 02:14:12 +0000178
179 if ($icon =~ /(gif|png)$/) {
180 $used_icons{$icon} = 1;
181 if ($icon =~ /change_(begin|end|delete)_right/) { $align = ' ' };
182 my $nav_border = "$NAV_BORDER";
183 if ($icon =~ /($alt)/) {
184 $alt = $1;
185 }
186 else {
187 $nav_border = '1';
188 $alt = '[*]';
189 };
190 if ($LOCAL_ICONS) {
191 return join('', '<img ', $iconsizes{$1}, $align
192 ,'border=', $nav_border, ' alt="', $alt
193 ,'" src="', $icon, '">' );
194 }
195 return join('', '<img ', $iconsizes{$1}, $align
196 ,'border=', $nav_border, ' alt="', $alt, '"\n'
197 ,' src="', $ICONSERVER, "/$icon", '">' );
198 }
199 else {
200 return $icon;
201 }
Fred Drakebc7101d1998-03-06 21:18:55 +0000202}
203
204
Fred Drakebc7101d1998-03-06 21:18:55 +0000205sub gen_index_id {
206 # this is used to ensure common index key generation and a stable sort
Fred Drake235e6b11998-03-27 05:19:43 +0000207 my($str,$extra) = @_;
Fred Drake64bdc241998-04-17 02:14:12 +0000208 sprintf('%s###%s%010d', $str, $extra, ++$global{'max_id'});
Fred Drakebc7101d1998-03-06 21:18:55 +0000209}
210
Fred Drake13210ed1998-03-17 06:28:05 +0000211sub make_index_entry {
Fred Drake11916921998-04-02 22:30:57 +0000212 my($br_id,$str) = @_;
Fred Drake13210ed1998-03-17 06:28:05 +0000213 # If TITLE is not yet available (i.e the \index command is in the title of the
214 # current section), use $ref_before.
215 $TITLE = $ref_before unless $TITLE;
216 # Save the reference
217 $str = gen_index_id($str, '');
Fred Drake64bdc241998-04-17 02:14:12 +0000218 $index{$str} .= make_half_href("$CURRENT_FILE#$br_id");
Fred Drake13210ed1998-03-17 06:28:05 +0000219 "<a name=\"$br_id\">$anchor_invisible_mark<\/a>";
220}
Fred Drakebc7101d1998-03-06 21:18:55 +0000221
Fred Drake64bdc241998-04-17 02:14:12 +0000222
223sub insert_index{
Fred Drake4d10b431998-08-07 20:51:58 +0000224 my($mark,$datafile,$columns,$letters) = @_;
225 my $prog = "$myrootdir/tools/buildindex.py";
226 my $index;
227 if ($letters) {
228 $index = `$prog --columns $columns --letters $datafile`;
229 }
230 else {
231 $index = `$prog --columns $columns $datafile`;
232 }
Fred Drake64bdc241998-04-17 02:14:12 +0000233 s/$mark/$index/;
234}
235
Fred Drake235e6b11998-03-27 05:19:43 +0000236sub add_idx{
Fred Drake5a525191998-04-02 22:39:05 +0000237 print "\nDoing the index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000238 close(IDXFILE);
Fred Drake4d10b431998-08-07 20:51:58 +0000239 insert_index($idx_mark, 'index.dat', $INDEX_COLUMNS, 1);
Fred Drake13210ed1998-03-17 06:28:05 +0000240}
Fred Drakebc7101d1998-03-06 21:18:55 +0000241
242
243$idx_module_mark = '<tex2html_idx_module_mark>';
244$idx_module_title = 'Module Index';
245
Fred Drake13210ed1998-03-17 06:28:05 +0000246sub add_module_idx{
Fred Drakebc7101d1998-03-06 21:18:55 +0000247 print "\nDoing the module index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000248 my $key;
Fred Drake64bdc241998-04-17 02:14:12 +0000249 open(MODIDXFILE, '>modindex.dat') || die "\n$!\n";
Fred Drake235e6b11998-03-27 05:19:43 +0000250 foreach $key (keys %Modules) {
251 # dump the line in the data file; just use a dummy seqno field
Fred Drake9d4b6c51998-04-11 05:21:14 +0000252 print MODIDXFILE "$Modules{$key}" . $IDXFILE_FIELD_SEP . "$key###\n";
Fred Drakebc7101d1998-03-06 21:18:55 +0000253 }
Fred Drake235e6b11998-03-27 05:19:43 +0000254 close(MODIDXFILE);
Fred Drake4d10b431998-08-07 20:51:58 +0000255 insert_index($idx_module_mark, 'modindex.dat', $MODULE_INDEX_COLUMNS, 0);
Fred Drakebc7101d1998-03-06 21:18:55 +0000256}
257
Fred Drake235e6b11998-03-27 05:19:43 +0000258# replace both indexes as needed:
259sub add_idx_hook{
Fred Drakeb3a3ed81998-07-24 22:17:34 +0000260 add_idx() if (/$idx_mark/);
261 add_module_idx() if (/$idx_module_mark/);
262 process_all_localmoduletables();
Fred Drake235e6b11998-03-27 05:19:43 +0000263}
Fred Drakebc7101d1998-03-06 21:18:55 +0000264
Fred Drakebc7101d1998-03-06 21:18:55 +0000265
266# In addition to the standard stuff, add label to allow named node files.
267sub do_cmd_tableofcontents {
268 local($_) = @_;
269 $TITLE = $toc_title;
270 $tocfile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000271 my($closures,$reopens) = preserve_open_tags();
272 anchor_label('contents', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000273 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000274 , make_section_heading($toc_title, 'H2'), $toc_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000275 , $reopens, $_);
276}
277# In addition to the standard stuff, add label to allow named node files.
278sub do_cmd_listoffigures {
279 local($_) = @_;
280 $TITLE = $lof_title;
281 $loffile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000282 my($closures,$reopens) = preserve_open_tags();
283 anchor_label('lof', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000284 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000285 , make_section_heading($lof_title, 'H2'), $lof_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000286 , $reopens, $_);
287}
288# In addition to the standard stuff, add label to allow named node files.
289sub do_cmd_listoftables {
290 local($_) = @_;
291 $TITLE = $lot_title;
292 $lotfile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000293 my($closures,$reopens) = preserve_open_tags();
294 anchor_label('lot', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000295 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000296 , make_section_heading($lot_title, 'H2'), $lot_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000297 , $reopens, $_);
298}
299# In addition to the standard stuff, add label to allow named node files.
300sub do_cmd_textohtmlinfopage {
301 local($_) = @_;
302 if ($INFO) { #
Fred Drake64bdc241998-04-17 02:14:12 +0000303 anchor_label("about",$CURRENT_FILE,$_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000304 } #
305 ( ($INFO == 1)
306 ? join('', $close_all
307 , "<STRONG>$t_title</STRONG><P>\nThis document was generated using the\n"
308 , "<A HREF=\"$TEX2HTMLADDRESS\"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A>"
309 , " translator Version $TEX2HTMLVERSION\n"
310 , "<P>Copyright &#169; 1993, 1994, 1995, 1996, 1997,\n"
311 , "<A HREF=\"$AUTHORADDRESS\">Nikos Drakos</A>, \n"
312 , "Computer Based Learning Unit, University of Leeds.\n"
313 , "<P>The command line arguments were: <BR>\n "
314 , "<STRONG>latex2html</STRONG> <tt>$argv</tt>.\n"
315 , "<P>The translation was initiated by $address_data[0] on $address_data[1]"
316 , $open_all, $_)
317 : join('', $close_all, $INFO,"\n", $open_all, $_))
318}
319
320# $idx_mark will be replaced with the real index at the end
321sub do_cmd_textohtmlindex {
322 local($_) = @_;
323 $TITLE = $idx_title;
324 $idxfile = $CURRENT_FILE;
Fred Drake235e6b11998-03-27 05:19:43 +0000325 if (%index_labels) { make_index_labels(); }
326 if (($SHORT_INDEX) && (%index_segment)) { make_preindex(); }
Fred Drakebc7101d1998-03-06 21:18:55 +0000327 else { $preindex = ''; }
Fred Drake235e6b11998-03-27 05:19:43 +0000328 my $heading = make_section_heading($idx_title, 'h2') . $idx_mark;
Fred Drake11916921998-04-02 22:30:57 +0000329 my($pre,$post) = minimize_open_tags($heading);
Fred Drake235e6b11998-03-27 05:19:43 +0000330 anchor_label('genindex',$CURRENT_FILE,$_); # this is added
331 '<br>\n' . $pre . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000332}
333
334# $idx_module_mark will be replaced with the real index at the end
335sub do_cmd_textohtmlmoduleindex {
336 local($_) = @_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000337 $TITLE = $idx_module_title;
Fred Drake64bdc241998-04-17 02:14:12 +0000338 anchor_label("modindex",$CURRENT_FILE,$_);
Fred Drake235e6b11998-03-27 05:19:43 +0000339 '<p>' . make_section_heading($idx_module_title, "h2")
340 . $idx_module_mark . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000341}
342
343# The bibliography and the index should be treated as separate sections
344# in their own HTML files. The \bibliography{} command acts as a sectioning command
345# that has the desired effect. But when the bibliography is constructed
346# manually using the thebibliography environment, or when using the
347# theindex environment it is not possible to use the normal sectioning
348# mechanism. This subroutine inserts a \bibliography{} or a dummy
349# \textohtmlindex command just before the appropriate environments
350# to force sectioning.
351
352# XXX This *assumes* that if there are two {theindex} environments, the
353# first is the module index and the second is the standard index. This
354# is sufficient for the current Python documentation, but that's about
355# it.
356
357sub add_bbl_and_idx_dummy_commands {
Fred Drake11916921998-04-02 22:30:57 +0000358 my $id = $global{'max_id'};
Fred Drakebc7101d1998-03-06 21:18:55 +0000359
360 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
361 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo
362 #if ($bbl_cnt == 1)
363 ;
364 #}
Fred Drake11916921998-04-02 22:30:57 +0000365 #----------------------------------------------------------------------
366 # (FLD) This was added
367 my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
368 if (scalar(@parts) == 3) {
369 # Be careful to re-write the string in place, since $_ is *not*
370 # returned explicity; *** nasty side-effect dependency! ***
371 print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
372 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
373 . "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
374 s/$rx/\\textohtmlmoduleindex \1 \\textohtmlindex \2/o;
Fred Drake6aa5d481998-08-11 03:14:50 +0000375 # Add a button to the navigation areas:
Fred Drake062bc6e1998-08-13 22:03:46 +0000376 $CUSTOM_BUTTONS .= ("<a\n href=\"modindex.html\">"
377 . img_tag('modules.'.$IMAGE_TYPE) . "</a>");
Fred Drake11916921998-04-02 22:30:57 +0000378 }
379 else {
380 $global{'max_id'} = $id; # not sure why....
381 s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
382 s/[\\]printindex/\\textohtmlindex /o;
383 }
384 #----------------------------------------------------------------------
Fred Drake64bdc241998-04-17 02:14:12 +0000385 lib_add_bbl_and_idx_dummy_commands()
Fred Drake11916921998-04-02 22:30:57 +0000386 if defined(&lib_add_bbl_and_idx_dummy_commands);
Fred Drakebc7101d1998-03-06 21:18:55 +0000387}
388
389# The bibliographic references, the appendices, the lists of figures and tables
390# etc. must appear in the contents table at the same level as the outermost
391# sectioning command. This subroutine finds what is the outermost level and
392# sets the above to the same level;
393
Fred Drake13210ed1998-03-17 06:28:05 +0000394sub set_depth_levels {
395 # Sets $outermost_level
Fred Drake11916921998-04-02 22:30:57 +0000396 my $level;
Fred Drake13210ed1998-03-17 06:28:05 +0000397 #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH
398 foreach $level ("part", "chapter", "section", "subsection",
399 "subsubsection", "paragraph") {
400 last if (($outermost_level) = /\\($level)$delimiter_rx/);
401 }
402 $level = ($outermost_level ? $section_commands{$outermost_level} :
403 do {$outermost_level = 'section'; 3;});
Fred Drakebc7101d1998-03-06 21:18:55 +0000404
Fred Drake13210ed1998-03-17 06:28:05 +0000405 #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given
406 if ($REL_DEPTH && $MAX_SPLIT_DEPTH) {
407 $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH;
408 } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 };
Fred Drakebc7101d1998-03-06 21:18:55 +0000409
Fred Drake64bdc241998-04-17 02:14:12 +0000410 %unnumbered_section_commands = ('tableofcontents' => $level,
411 'listoffigures' => $level,
412 'listoftables' => $level,
413 'bibliography' => $level,
414 'textohtmlindex' => $level,
415 'textohtmlmoduleindex' => $level);
416 $section_headings{'textohtmlmoduleindex'} = 'h1';
Fred Drakebc7101d1998-03-06 21:18:55 +0000417
Fred Drake64bdc241998-04-17 02:14:12 +0000418 %section_commands = (%unnumbered_section_commands,
419 %section_commands);
Fred Drake11916921998-04-02 22:30:57 +0000420
421 make_sections_rx();
Fred Drake13210ed1998-03-17 06:28:05 +0000422}
Fred Drakebc7101d1998-03-06 21:18:55 +0000423
424
425# Fix from Ross Moore for ']' in \item[...]; this can be removed once the next
Fred Drake235e6b11998-03-27 05:19:43 +0000426# patch to LaTeX2HTML is released and tested ... if the patch gets included.
427# Be very careful to keep this around, just in case things break again!
Fred Drakebc7101d1998-03-06 21:18:55 +0000428#
429sub protect_useritems {
430 local(*_) = @_;
Fred Drake11916921998-04-02 22:30:57 +0000431 local($preitems,$thisitem);
Fred Drakebc7101d1998-03-06 21:18:55 +0000432 while (/\\item\s*\[/) {
Fred Drake11916921998-04-02 22:30:57 +0000433 $preitems .= $`;
434 $_ = $';
Fred Drakebc7101d1998-03-06 21:18:55 +0000435 $thisitem = $&.'<<'.++$global{'max_id'}.'>>';
436 s/^(((($O|$OP)\d+($C|$CP)).*\3|<[^<>]*>|[^\]<]+)*)\]/$thisitem.=$1;''/e;
Fred Drake11916921998-04-02 22:30:57 +0000437 $preitems .= $thisitem . '<<' . $global{'max_id'} . '>>]';
438 s/^]//;
Fred Drakebc7101d1998-03-06 21:18:55 +0000439 }
440 $_ = $preitems . $_;
441}
442
Fred Drake1072e461998-04-12 02:16:34 +0000443# This changes the markup used for {verbatim} environments, and is the
444# best way I've found that ensures the <dl> goes one the outside of the
445# <pre>...</pre>.
446#
447# Note that this *must* be done in the init file, not the python.perl
448# style support file. The %declarations must be set before initialize()
449# is called in the main script.
450#
Fred Drake64bdc241998-04-17 02:14:12 +0000451%declarations = ('preform' => '<dl><dd><pre></pre></dl>',
Fred Drake1072e461998-04-12 02:16:34 +0000452 %declarations);
453
Fred Drakebc7101d1998-03-06 21:18:55 +00004541; # This must be the last line