blob: b098ba224e141b182c5a4244dbcb43c4a2236db2 [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 Drake6aa5d481998-08-11 03:14:50 +000088$CUSTOM_BUTTONS = '';
89
Fred Drake13210ed1998-03-17 06:28:05 +000090sub make_nav_panel{
Fred Drake64bdc241998-04-17 02:14:12 +000091 ($NEXT_TITLE ? $NEXT : '')
92 . ($UP_TITLE ? $UP : '')
93 . ($PREVIOUS_TITLE ? $PREVIOUS : '')
94 . $CONTENTS
Fred Drake6aa5d481998-08-11 03:14:50 +000095 . $CUSTOM_BUTTONS
Fred Drake64bdc241998-04-17 02:14:12 +000096 . $INDEX
Fred Drake64bdc241998-04-17 02:14:12 +000097 . "\n<br>\n"
98 . ($NEXT_TITLE ? "<b>Next:</b> $NEXT_TITLE\n" : '')
Fred Drake13210ed1998-03-17 06:28:05 +000099 . ($UP_TITLE ? "<b>Up:</b> $UP_TITLE\n" : '')
100 . ($PREVIOUS_TITLE ? "<b>Previous:</b> $PREVIOUS_TITLE\n" : '');
101}
102
Fred Drakebc7101d1998-03-06 21:18:55 +0000103sub top_navigation_panel {
Fred Drake13210ed1998-03-17 06:28:05 +0000104 "<div class=navigation>\n"
Fred Drake64bdc241998-04-17 02:14:12 +0000105 . make_nav_panel()
106 . '<br><hr><p></div>';
Fred Drakebc7101d1998-03-06 21:18:55 +0000107}
108
109sub bot_navigation_panel {
Fred Drake9d4b6c51998-04-11 05:21:14 +0000110 "<p>\n<div class=navigation><hr>"
Fred Drake64bdc241998-04-17 02:14:12 +0000111 . make_nav_panel()
112 . '</div>';
113}
114
115sub add_link {
116 # Returns a pair (iconic link, textual link)
117 my($icon, $current_file, @link) = @_;
118 my($dummy, $file, $title) = split($delim,
119 $toc_section_info{join(' ',@link)});
120 if ($title && ($file ne $current_file)) {
121 $title = purify($title);
122 $title = get_first_words($title, $WORDS_IN_NAVIGATION_PANEL_TITLES);
123 return (make_href($file, $icon), make_href($file, "$title"))
124 }
125 elsif ($icon eq $up_visible_mark && $EXTERNAL_UP_LINK) {
126 return (make_href($EXTERNAL_UP_LINK, $icon),
127 make_href($EXTERNAL_UP_LINK, "$EXTERNAL_UP_TITLE"))
128 }
129 elsif (($icon eq $previous_visible_mark
130 || $icon eq $previous_page_visible_mark)
131 && $EXTERNAL_PREV_LINK && $EXTERNAL_PREV_TITLE) {
132 return (make_href($EXTERNAL_PREV_LINK, $icon),
133 make_href($EXTERNAL_PREV_LINK, "$EXTERNAL_PREV_TITLE"))
134 }
135 elsif (($icon eq $next_visible_mark
136 || $icon eq $next_page_visible_mark)
137 && $EXTERNAL_DOWN_LINK && $EXTERNAL_DOWN_TITLE) {
138 return (make_href($EXTERNAL_DOWN_LINK, $icon),
139 make_href($EXTERNAL_DOWN_LINK, "$EXTERNAL_DOWN_TITLE"))
140 }
141 (&inactive_img($icon), "");
142}
143
144sub add_special_link {
145 my($icon, $file, $current_file) = @_;
146 (($file && ($file ne $current_file)) ? make_href($file, $icon) : undef)
147}
148
149sub img_tag {
150 local($icon) = @_;
151 my $alt;
152 my $align = " align=bottom ";
153
154 $alt = join('|', 'up', 'next_group', 'previous_group'
155 , 'next', 'previous', 'change_begin_right', 'change_begin'
156 , 'change_end_right', 'change_end', 'change_delete_right'
157 , 'change_delete', 'contents', 'index');
158
159 if ($icon =~ /(gif|png)$/) {
160 $used_icons{$icon} = 1;
161 if ($icon =~ /change_(begin|end|delete)_right/) { $align = ' ' };
162 my $nav_border = "$NAV_BORDER";
163 if ($icon =~ /($alt)/) {
164 $alt = $1;
165 }
166 else {
167 $nav_border = '1';
168 $alt = '[*]';
169 };
170 if ($LOCAL_ICONS) {
171 return join('', '<img ', $iconsizes{$1}, $align
172 ,'border=', $nav_border, ' alt="', $alt
173 ,'" src="', $icon, '">' );
174 }
175 return join('', '<img ', $iconsizes{$1}, $align
176 ,'border=', $nav_border, ' alt="', $alt, '"\n'
177 ,' src="', $ICONSERVER, "/$icon", '">' );
178 }
179 else {
180 return $icon;
181 }
Fred Drakebc7101d1998-03-06 21:18:55 +0000182}
183
184
Fred Drakebc7101d1998-03-06 21:18:55 +0000185sub gen_index_id {
186 # this is used to ensure common index key generation and a stable sort
Fred Drake235e6b11998-03-27 05:19:43 +0000187 my($str,$extra) = @_;
Fred Drake64bdc241998-04-17 02:14:12 +0000188 sprintf('%s###%s%010d', $str, $extra, ++$global{'max_id'});
Fred Drakebc7101d1998-03-06 21:18:55 +0000189}
190
Fred Drake13210ed1998-03-17 06:28:05 +0000191sub make_index_entry {
Fred Drake11916921998-04-02 22:30:57 +0000192 my($br_id,$str) = @_;
Fred Drake13210ed1998-03-17 06:28:05 +0000193 # If TITLE is not yet available (i.e the \index command is in the title of the
194 # current section), use $ref_before.
195 $TITLE = $ref_before unless $TITLE;
196 # Save the reference
197 $str = gen_index_id($str, '');
Fred Drake64bdc241998-04-17 02:14:12 +0000198 $index{$str} .= make_half_href("$CURRENT_FILE#$br_id");
Fred Drake13210ed1998-03-17 06:28:05 +0000199 "<a name=\"$br_id\">$anchor_invisible_mark<\/a>";
200}
Fred Drakebc7101d1998-03-06 21:18:55 +0000201
Fred Drake64bdc241998-04-17 02:14:12 +0000202
203sub insert_index{
Fred Drake4d10b431998-08-07 20:51:58 +0000204 my($mark,$datafile,$columns,$letters) = @_;
205 my $prog = "$myrootdir/tools/buildindex.py";
206 my $index;
207 if ($letters) {
208 $index = `$prog --columns $columns --letters $datafile`;
209 }
210 else {
211 $index = `$prog --columns $columns $datafile`;
212 }
Fred Drake64bdc241998-04-17 02:14:12 +0000213 s/$mark/$index/;
214}
215
Fred Drake235e6b11998-03-27 05:19:43 +0000216sub add_idx{
Fred Drake5a525191998-04-02 22:39:05 +0000217 print "\nDoing the index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000218 close(IDXFILE);
Fred Drake4d10b431998-08-07 20:51:58 +0000219 insert_index($idx_mark, 'index.dat', $INDEX_COLUMNS, 1);
Fred Drake13210ed1998-03-17 06:28:05 +0000220}
Fred Drakebc7101d1998-03-06 21:18:55 +0000221
222
223$idx_module_mark = '<tex2html_idx_module_mark>';
224$idx_module_title = 'Module Index';
225
Fred Drake13210ed1998-03-17 06:28:05 +0000226sub add_module_idx{
Fred Drakebc7101d1998-03-06 21:18:55 +0000227 print "\nDoing the module index ...";
Fred Drake235e6b11998-03-27 05:19:43 +0000228 my $key;
Fred Drake64bdc241998-04-17 02:14:12 +0000229 open(MODIDXFILE, '>modindex.dat') || die "\n$!\n";
Fred Drake235e6b11998-03-27 05:19:43 +0000230 foreach $key (keys %Modules) {
231 # dump the line in the data file; just use a dummy seqno field
Fred Drake9d4b6c51998-04-11 05:21:14 +0000232 print MODIDXFILE "$Modules{$key}" . $IDXFILE_FIELD_SEP . "$key###\n";
Fred Drakebc7101d1998-03-06 21:18:55 +0000233 }
Fred Drake235e6b11998-03-27 05:19:43 +0000234 close(MODIDXFILE);
Fred Drake4d10b431998-08-07 20:51:58 +0000235 insert_index($idx_module_mark, 'modindex.dat', $MODULE_INDEX_COLUMNS, 0);
Fred Drakebc7101d1998-03-06 21:18:55 +0000236}
237
Fred Drake235e6b11998-03-27 05:19:43 +0000238# replace both indexes as needed:
239sub add_idx_hook{
Fred Drakeb3a3ed81998-07-24 22:17:34 +0000240 add_idx() if (/$idx_mark/);
241 add_module_idx() if (/$idx_module_mark/);
242 process_all_localmoduletables();
Fred Drake235e6b11998-03-27 05:19:43 +0000243}
Fred Drakebc7101d1998-03-06 21:18:55 +0000244
Fred Drakebc7101d1998-03-06 21:18:55 +0000245
246# In addition to the standard stuff, add label to allow named node files.
247sub do_cmd_tableofcontents {
248 local($_) = @_;
249 $TITLE = $toc_title;
250 $tocfile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000251 my($closures,$reopens) = preserve_open_tags();
252 anchor_label('contents', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000253 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000254 , make_section_heading($toc_title, 'H2'), $toc_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000255 , $reopens, $_);
256}
257# In addition to the standard stuff, add label to allow named node files.
258sub do_cmd_listoffigures {
259 local($_) = @_;
260 $TITLE = $lof_title;
261 $loffile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000262 my($closures,$reopens) = preserve_open_tags();
263 anchor_label('lof', $CURRENT_FILE, $_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000264 join('', "<BR>\n", $closures
Fred Drake64bdc241998-04-17 02:14:12 +0000265 , make_section_heading($lof_title, 'H2'), $lof_mark
Fred Drakebc7101d1998-03-06 21:18:55 +0000266 , $reopens, $_);
267}
268# In addition to the standard stuff, add label to allow named node files.
269sub do_cmd_listoftables {
270 local($_) = @_;
271 $TITLE = $lot_title;
272 $lotfile = $CURRENT_FILE;
Fred Drake64bdc241998-04-17 02:14:12 +0000273 my($closures,$reopens) = preserve_open_tags();
274 anchor_label('lot', $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($lot_title, 'H2'), $lot_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_textohtmlinfopage {
281 local($_) = @_;
282 if ($INFO) { #
Fred Drake64bdc241998-04-17 02:14:12 +0000283 anchor_label("about",$CURRENT_FILE,$_); # this is added
Fred Drakebc7101d1998-03-06 21:18:55 +0000284 } #
285 ( ($INFO == 1)
286 ? join('', $close_all
287 , "<STRONG>$t_title</STRONG><P>\nThis document was generated using the\n"
288 , "<A HREF=\"$TEX2HTMLADDRESS\"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A>"
289 , " translator Version $TEX2HTMLVERSION\n"
290 , "<P>Copyright &#169; 1993, 1994, 1995, 1996, 1997,\n"
291 , "<A HREF=\"$AUTHORADDRESS\">Nikos Drakos</A>, \n"
292 , "Computer Based Learning Unit, University of Leeds.\n"
293 , "<P>The command line arguments were: <BR>\n "
294 , "<STRONG>latex2html</STRONG> <tt>$argv</tt>.\n"
295 , "<P>The translation was initiated by $address_data[0] on $address_data[1]"
296 , $open_all, $_)
297 : join('', $close_all, $INFO,"\n", $open_all, $_))
298}
299
300# $idx_mark will be replaced with the real index at the end
301sub do_cmd_textohtmlindex {
302 local($_) = @_;
303 $TITLE = $idx_title;
304 $idxfile = $CURRENT_FILE;
Fred Drake235e6b11998-03-27 05:19:43 +0000305 if (%index_labels) { make_index_labels(); }
306 if (($SHORT_INDEX) && (%index_segment)) { make_preindex(); }
Fred Drakebc7101d1998-03-06 21:18:55 +0000307 else { $preindex = ''; }
Fred Drake235e6b11998-03-27 05:19:43 +0000308 my $heading = make_section_heading($idx_title, 'h2') . $idx_mark;
Fred Drake11916921998-04-02 22:30:57 +0000309 my($pre,$post) = minimize_open_tags($heading);
Fred Drake235e6b11998-03-27 05:19:43 +0000310 anchor_label('genindex',$CURRENT_FILE,$_); # this is added
311 '<br>\n' . $pre . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000312}
313
314# $idx_module_mark will be replaced with the real index at the end
315sub do_cmd_textohtmlmoduleindex {
316 local($_) = @_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000317 $TITLE = $idx_module_title;
Fred Drake64bdc241998-04-17 02:14:12 +0000318 anchor_label("modindex",$CURRENT_FILE,$_);
Fred Drake235e6b11998-03-27 05:19:43 +0000319 '<p>' . make_section_heading($idx_module_title, "h2")
320 . $idx_module_mark . $_;
Fred Drakebc7101d1998-03-06 21:18:55 +0000321}
322
323# The bibliography and the index should be treated as separate sections
324# in their own HTML files. The \bibliography{} command acts as a sectioning command
325# that has the desired effect. But when the bibliography is constructed
326# manually using the thebibliography environment, or when using the
327# theindex environment it is not possible to use the normal sectioning
328# mechanism. This subroutine inserts a \bibliography{} or a dummy
329# \textohtmlindex command just before the appropriate environments
330# to force sectioning.
331
332# XXX This *assumes* that if there are two {theindex} environments, the
333# first is the module index and the second is the standard index. This
334# is sufficient for the current Python documentation, but that's about
335# it.
336
337sub add_bbl_and_idx_dummy_commands {
Fred Drake11916921998-04-02 22:30:57 +0000338 my $id = $global{'max_id'};
Fred Drakebc7101d1998-03-06 21:18:55 +0000339
340 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg;
341 s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo
342 #if ($bbl_cnt == 1)
343 ;
344 #}
Fred Drake11916921998-04-02 22:30:57 +0000345 #----------------------------------------------------------------------
346 # (FLD) This was added
347 my(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/);
348 if (scalar(@parts) == 3) {
349 # Be careful to re-write the string in place, since $_ is *not*
350 # returned explicity; *** nasty side-effect dependency! ***
351 print "\nadd_bbl_and_idx_dummy_commands ==> adding module index";
352 my $rx = "([\\\\]begin\\s*$O\\d+$C\\s*theindex[\\s\\S]*)"
353 . "([\\\\]begin\\s*$O\\d+$C\\s*theindex)";
354 s/$rx/\\textohtmlmoduleindex \1 \\textohtmlindex \2/o;
Fred Drake6aa5d481998-08-11 03:14:50 +0000355 # Add a button to the navigation areas:
356 $CUSTOM_BUTTONS .= ("<a\n href=\"modindex.html\"><img"
357 . " src=\"$ICONSERVER$dd"
358 . "modules_motif.gif\" border=0"
359 . " alt=\"[Modules]\"></a>");
Fred Drake11916921998-04-02 22:30:57 +0000360 }
361 else {
362 $global{'max_id'} = $id; # not sure why....
363 s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o;
364 s/[\\]printindex/\\textohtmlindex /o;
365 }
366 #----------------------------------------------------------------------
Fred Drake64bdc241998-04-17 02:14:12 +0000367 lib_add_bbl_and_idx_dummy_commands()
Fred Drake11916921998-04-02 22:30:57 +0000368 if defined(&lib_add_bbl_and_idx_dummy_commands);
Fred Drakebc7101d1998-03-06 21:18:55 +0000369}
370
371# The bibliographic references, the appendices, the lists of figures and tables
372# etc. must appear in the contents table at the same level as the outermost
373# sectioning command. This subroutine finds what is the outermost level and
374# sets the above to the same level;
375
Fred Drake13210ed1998-03-17 06:28:05 +0000376sub set_depth_levels {
377 # Sets $outermost_level
Fred Drake11916921998-04-02 22:30:57 +0000378 my $level;
Fred Drake13210ed1998-03-17 06:28:05 +0000379 #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH
380 foreach $level ("part", "chapter", "section", "subsection",
381 "subsubsection", "paragraph") {
382 last if (($outermost_level) = /\\($level)$delimiter_rx/);
383 }
384 $level = ($outermost_level ? $section_commands{$outermost_level} :
385 do {$outermost_level = 'section'; 3;});
Fred Drakebc7101d1998-03-06 21:18:55 +0000386
Fred Drake13210ed1998-03-17 06:28:05 +0000387 #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given
388 if ($REL_DEPTH && $MAX_SPLIT_DEPTH) {
389 $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH;
390 } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 };
Fred Drakebc7101d1998-03-06 21:18:55 +0000391
Fred Drake64bdc241998-04-17 02:14:12 +0000392 %unnumbered_section_commands = ('tableofcontents' => $level,
393 'listoffigures' => $level,
394 'listoftables' => $level,
395 'bibliography' => $level,
396 'textohtmlindex' => $level,
397 'textohtmlmoduleindex' => $level);
398 $section_headings{'textohtmlmoduleindex'} = 'h1';
Fred Drakebc7101d1998-03-06 21:18:55 +0000399
Fred Drake64bdc241998-04-17 02:14:12 +0000400 %section_commands = (%unnumbered_section_commands,
401 %section_commands);
Fred Drake11916921998-04-02 22:30:57 +0000402
403 make_sections_rx();
Fred Drake13210ed1998-03-17 06:28:05 +0000404}
Fred Drakebc7101d1998-03-06 21:18:55 +0000405
406
407# Fix from Ross Moore for ']' in \item[...]; this can be removed once the next
Fred Drake235e6b11998-03-27 05:19:43 +0000408# patch to LaTeX2HTML is released and tested ... if the patch gets included.
409# Be very careful to keep this around, just in case things break again!
Fred Drakebc7101d1998-03-06 21:18:55 +0000410#
411sub protect_useritems {
412 local(*_) = @_;
Fred Drake11916921998-04-02 22:30:57 +0000413 local($preitems,$thisitem);
Fred Drakebc7101d1998-03-06 21:18:55 +0000414 while (/\\item\s*\[/) {
Fred Drake11916921998-04-02 22:30:57 +0000415 $preitems .= $`;
416 $_ = $';
Fred Drakebc7101d1998-03-06 21:18:55 +0000417 $thisitem = $&.'<<'.++$global{'max_id'}.'>>';
418 s/^(((($O|$OP)\d+($C|$CP)).*\3|<[^<>]*>|[^\]<]+)*)\]/$thisitem.=$1;''/e;
Fred Drake11916921998-04-02 22:30:57 +0000419 $preitems .= $thisitem . '<<' . $global{'max_id'} . '>>]';
420 s/^]//;
Fred Drakebc7101d1998-03-06 21:18:55 +0000421 }
422 $_ = $preitems . $_;
423}
424
Fred Drake1072e461998-04-12 02:16:34 +0000425# This changes the markup used for {verbatim} environments, and is the
426# best way I've found that ensures the <dl> goes one the outside of the
427# <pre>...</pre>.
428#
429# Note that this *must* be done in the init file, not the python.perl
430# style support file. The %declarations must be set before initialize()
431# is called in the main script.
432#
Fred Drake64bdc241998-04-17 02:14:12 +0000433%declarations = ('preform' => '<dl><dd><pre></pre></dl>',
Fred Drake1072e461998-04-12 02:16:34 +0000434 %declarations);
435
Fred Drakebc7101d1998-03-06 21:18:55 +00004361; # This must be the last line