blob: 0d0fa773812be1a0f59cedf281e5cc5b3cb49531 [file] [log] [blame]
Fred Drake6659c301998-03-03 22:02:19 +00001# python.perl by Fred L. Drake, Jr. <fdrake@acm.org> -*- perl -*-
2#
3# Heavily based on Guido van Rossum's myformat.perl (now obsolete).
4#
5# Extension to LaTeX2HTML for documents using myformat.sty.
6# Subroutines of the form do_cmd_<name> here define translations
7# for LaTeX commands \<name> defined in the corresponding .sty file.
8
9package main;
10
11
12# words typeset in a special way (not in HTML though)
13
14sub do_cmd_ABC{ 'ABC' . @_[0]; }
15sub do_cmd_UNIX{ 'Unix'. @_[0]; }
16sub do_cmd_ASCII{ 'ASCII' . @_[0]; }
17sub do_cmd_POSIX{ 'POSIX' . @_[0]; }
18sub do_cmd_C{ 'C' . @_[0]; }
19sub do_cmd_Cpp{ 'C++' . @_[0]; }
20sub do_cmd_EOF{ 'EOF' . @_[0]; }
21sub do_cmd_NULL{ '<tt>NULL</tt>' . @_[0]; }
22
23sub do_cmd_e{ '&#92;' . @_[0]; }
24
25$AUTHOR_ADDRESS = '';
26$PYTHON_VERSION = '';
27
28sub do_cmd_version{ $PYTHON_VERSION . @_[0]; }
29sub do_cmd_release{
30 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000031 s/$next_pair_pr_rx//;
Fred Drake6659c301998-03-03 22:02:19 +000032 $PYTHON_VERSION = "$2";
33 $_;
34}
35
36sub do_cmd_authoraddress{
37 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000038 s/$next_pair_pr_rx//;
Fred Drake6659c301998-03-03 22:02:19 +000039 $AUTHOR_ADDRESS = "$2";
40 $_;
41}
42
43sub do_cmd_hackscore{
44 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000045 s/$next_pair_pr_rx/_/;
Fred Drake6659c301998-03-03 22:02:19 +000046 $_;
47}
48
49sub do_cmd_optional{
50 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000051 s|$next_pair_pr_rx|</var><big>\[</big><var>\2</var><big>\]</big><var>|;
Fred Drake6659c301998-03-03 22:02:19 +000052 $_;
53}
54
55sub do_cmd_varvars{
56 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000057 s|$next_pair_pr_rx|<var>\2</var>|;
Fred Drake6659c301998-03-03 22:02:19 +000058 $_;
59}
60
Fred Drake10ad52e1998-04-04 04:19:20 +000061sub use_current{
Fred Drake2b8093a1998-04-02 22:33:44 +000062 local($_) = @_;
63 s|$next_pair_pr_rx|\2|;
64 $_;
65}
66
Fred Drake10ad52e1998-04-04 04:19:20 +000067sub do_cmd_pytype{ use_current(); }
68sub do_cmd_makevar{ use_current(); }
69
Fred Drakec9a44381998-03-17 06:29:13 +000070# Logical formatting (some based on texinfo), needs to be converted to
71# minimalist HTML. The "minimalist" is primarily to reduce the size of
72# output files for users that read them over the network rather than
73# from local repositories.
Fred Drake6659c301998-03-03 22:02:19 +000074
75sub do_cmd_code{
76 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000077 s|$next_pair_pr_rx|<tt>\2</tt>|;
78 $_;
79}
80
81sub use_sans_serif{
82 local($_) = @_;
83 s|$next_pair_pr_rx|<font face=sans-serif>\2</font>|;
84 $_;
85}
86
87sub use_italics{
88 local($_) = @_;
89 s|$next_pair_pr_rx|<i>\2</i>|;
Fred Drake6659c301998-03-03 22:02:19 +000090 $_;
91}
92
93sub do_cmd_sectcode{ &do_cmd_code(@_); }
94sub do_cmd_module{ &do_cmd_code(@_); }
95sub do_cmd_keyword{ &do_cmd_code(@_); }
96sub do_cmd_exception{ &do_cmd_code(@_); }
97sub do_cmd_class{ &do_cmd_code(@_); }
98sub do_cmd_function{ &do_cmd_code(@_); }
99sub do_cmd_constant{ &do_cmd_code(@_); }
100sub do_cmd_member{ &do_cmd_code(@_); }
101sub do_cmd_method{ &do_cmd_code(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000102sub do_cmd_cfunction{ &do_cmd_code(@_); }
103sub do_cmd_cdata{ &do_cmd_code(@_); }
104sub do_cmd_ctype{ &do_cmd_code(@_); }
Fred Drakec9a44381998-03-17 06:29:13 +0000105sub do_cmd_regexp{ &do_cmd_code(@_); }
106sub do_cmd_key{ &do_cmd_code(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000107
Fred Drakefc16e781998-03-12 21:03:26 +0000108sub do_cmd_character{ &do_cmd_samp(@_); }
109
Fred Drakec9a44381998-03-17 06:29:13 +0000110sub do_cmd_program{ &do_cmd_strong(@_); }
111
112sub do_cmd_email{ &use_sans_serif(@_); }
113sub do_cmd_mimetype{ &use_sans_serif(@_); }
114
115sub do_cmd_var{ &use_italics(@_); }
Fred Drake42b31a51998-03-27 05:16:10 +0000116sub do_cmd_dfn{ &use_italics(@_); } # make an index entry?
Fred Drakec9a44381998-03-17 06:29:13 +0000117sub do_cmd_emph{ &use_italics(@_); }
118
Fred Drake1a7af391998-04-01 22:44:56 +0000119sub do_cmd_newsgroup{
120 local($_) = @_;
121 s/$next_pair_pr_rx//o;
122 my $newsgroup = $2;
123 my $stuff = "<a href=\"news:$newsgroup\"><font face=sans-serif>"
124 . "$newsgroup</font></a>";
125 $stuff . $_;
126}
Fred Drakefc16e781998-03-12 21:03:26 +0000127
128sub do_cmd_envvar{
129 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000130 s/$next_pair_pr_rx//;
131 my($br_id,$envvar) = ($1, $2);
132 my($name,$aname,$ahref) = link_info($br_id);
133 add_index_entry("environment variables!$envvar@\$$envvar", $ahref);
134 add_index_entry("$envvar@\$$envvar", $ahref);
135 "$aname\$$envvar</a>" . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000136}
137
Fred Drake6659c301998-03-03 22:02:19 +0000138sub do_cmd_url{
139 # use the URL as both text and hyperlink
140 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000141 s/$next_pair_pr_rx//;
142 my $url = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000143 $url =~ s/~/&#126;/g;
Fred Drakec9a44381998-03-17 06:29:13 +0000144 "<a href=\"$url\"><font face=sans-serif>$url</font></a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000145}
146
147sub do_cmd_manpage{
148 # two parameters: \manpage{name}{section}
149 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000150 my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3";
151 s|$rx|<i>\2</i>(\4)|;
Fred Drake6659c301998-03-03 22:02:19 +0000152 $_;
153}
154
155sub do_cmd_rfc{
156 local($_) = @_;
157 s/$next_pair_pr_rx//;
Fred Drakec9a44381998-03-17 06:29:13 +0000158 my($br_id,$rfcnumber) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000159
160 # Save the reference
Fred Drakec9a44381998-03-17 06:29:13 +0000161 my $nstr = &gen_index_id("RFC!RFC $rfcnumber", '');
Fred Drake6659c301998-03-03 22:02:19 +0000162 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
Fred Drakec9a44381998-03-17 06:29:13 +0000163 "<a name=$br_id>RFC $rfcnumber</a>" .$_;
Fred Drake6659c301998-03-03 22:02:19 +0000164}
165
166sub do_cmd_kbd{
167 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000168 s|$next_pair_pr_rx|<kbd>\2</kbd>|;
Fred Drake6659c301998-03-03 22:02:19 +0000169 $_;
170}
171
172sub do_cmd_strong{
173 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000174 s|$next_pair_pr_rx|<b>\2</b>|;
Fred Drake6659c301998-03-03 22:02:19 +0000175 $_;
176}
177
178sub do_cmd_deprecated{
179 # two parameters: \deprecated{version}{whattodo}
180 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000181 my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3";
182 s|$rx|<b>Deprecated since release \2.</b>\n\4<p>|;
183 $_;
Fred Drake6659c301998-03-03 22:02:19 +0000184}
185
186# file and samp are at the end of this file since they screw up fontlock.
187
188# index commands
189
190$INDEX_SUBITEM = "";
191
192sub get_indexsubitem{
Fred Drakefc16e781998-03-12 21:03:26 +0000193 #$INDEX_SUBITEM ? " $INDEX_SUBITEM" : '';
194 '';
Fred Drake6659c301998-03-03 22:02:19 +0000195}
196
197sub do_cmd_setindexsubitem{
198 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000199 s/$next_pair_pr_rx//;
Fred Drake6659c301998-03-03 22:02:19 +0000200 $INDEX_SUBITEM = $2;
201 $_;
202}
203
Fred Drakefc16e781998-03-12 21:03:26 +0000204sub do_cmd_withsubitem{
205 # We can't really do the right right thing, because LaTeX2HTML doesn't
206 # do things in the right order, but we need to at least strip this stuff
207 # out, and leave anything that the second argument expanded out to.
208 #
209 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000210 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drakefc16e781998-03-12 21:03:26 +0000211 s/$next_pair_pr_rx$any_next_pair_pr_rx3/\4/;
Fred Drake42b31a51998-03-27 05:16:10 +0000212 $INDEX_SUBITEM = $2;
Fred Drakefc16e781998-03-12 21:03:26 +0000213 $_;
214}
215
216sub do_cmd_makemodindex{ @_[0]; }
217
Fred Drake42b31a51998-03-27 05:16:10 +0000218# We're in the document subdirectory when this happens!
219open(IDXFILE, ">index.dat") || die "\n$!\n";
220open(INTLABELS, ">intlabels.pl") || die "\n$!\n";
221print INTLABELS
222 "%internal_labels = ();\n1; # hack in case there are no entries\n\n";
223
224sub gen_target_name{
225 "l2h-" . @_[0];
226}
227
228sub gen_target{
229 "<a name=\"" . @_[0] . "\">";
230}
231
232sub gen_link{
233 my($node,$target) = @_;
234 print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n";
235 "<a href=\"$node#$target\">";
236}
237
238sub make_index_entry{
239 my($br_id,$str) = @_;
240 my($name,$aname,$ahref) = link_info($br_id);
241 add_index_entry($str, $ahref);
242 "$aname$anchor_invisible_mark</a>";
243}
244
245sub add_index_entry{
246 # add an entry to the index structures; ignore the return value
247 my($str,$ahref) = @_;
248 $str = gen_index_id($str, '');
249 $index{$str} .= $ahref;
250 print IDXFILE $ahref, "\0", $str, "\n";
251}
252
253sub link_info{
254 my $name = gen_target_name(@_[0]);
255 my $aname = gen_target($name);
256 my $ahref = gen_link($CURRENT_FILE, $name);
257 return ($name, $aname, $ahref);
258}
259
260sub do_cmd_index{
261 local($_) = @_;
262 s/$next_pair_pr_rx[\n]?//o;
263 my($br_id,$str) = ($1, $2);
264 #
265 my($name,$aname,$ahref) = link_info($br_id);
266 add_index_entry("$str", $ahref);
267 "$aname$anchor_invisible_mark</a>" . $_;
268}
269
Fred Drake6659c301998-03-03 22:02:19 +0000270sub do_cmd_indexii{
271 local($_) = @_;
272 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000273 my($br_id1,$str1) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000274 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000275 my($br_id2,$str2) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000276 #
277 my($name,$aname,$ahref) = link_info($br_id1);
278 add_index_entry("$str1!$str2", $ahref);
279 add_index_entry("$str2!$str1", $ahref);
280 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000281}
282
283sub do_cmd_indexiii{
284 local($_) = @_;
285 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000286 my($br_id1,$str1) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000287 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000288 my($br_id2,$str2) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000289 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000290 my($br_id3,$str3) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000291 #
292 my($name,$aname,$ahref) = link_info($br_id1);
293 add_index_entry("$str1!$str2 $str3", $ahref);
294 add_index_entry("$str2!$str3, $str1", $ahref);
295 add_index_entry("$str3!$str1 $str2", $ahref);
296 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000297}
298
299sub do_cmd_indexiv{
300 local($_) = @_;
301 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000302 my($br_id1,$str1) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000303 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000304 my($br_id2,$str2) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000305 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000306 my($br_id3,$str3) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000307 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000308 my($br_id4,$str4) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000309 #
310 my($name,$aname,$ahref) = link_info($br_id1);
311 add_index_entry("$str1!$str2 $str3 $str4", $ahref);
312 add_index_entry("$str2!$str3 $str4, $str1", $ahref);
313 add_index_entry("$str3!$str4, $str1 $str2", $ahref);
314 add_index_entry("$str4!$$str1 $str2 $str3", $ahref);
315 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000316}
317
Fred Drakec9a44381998-03-17 06:29:13 +0000318sub do_cmd_ttindex{
319 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000320 s/$next_pair_pr_rx[\n]?//;
Fred Drakec9a44381998-03-17 06:29:13 +0000321 my($br_id,$str) = ($1, $2);
322 &make_index_entry($br_id, $str . &get_indexsubitem) . $_;
323}
Fred Drake6659c301998-03-03 22:02:19 +0000324
325sub my_typed_index_helper{
Fred Drakec9a44381998-03-17 06:29:13 +0000326 local($word,$_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000327 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000328 my($br_id,$str) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000329 #
330 my($name,$aname,$ahref) = link_info($br_id1);
331 add_index_entry("$str $word", $ahref);
332 add_index_entry("$word!$str", $ahref);
333 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000334}
335
336sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
337sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
338sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
339sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
340
341sub my_parword_index_helper{
Fred Drakec9a44381998-03-17 06:29:13 +0000342 local($word,$_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000343 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000344 my($br_id,$str) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000345 make_index_entry($br_id, "$str ($word)") . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000346}
347
348
349# Set this to true to strip out the <tt>...</tt> from index entries;
350# this is analogous to using the second definition of \idxcode{} from
351# myformat.sty.
352#
353# It is used from &make_mod_index_entry() and &make_str_index_entry().
354#
355$STRIP_INDEX_TT = 0;
356
357sub make_mod_index_entry{
Fred Drakec9a44381998-03-17 06:29:13 +0000358 my($br_id,$str,$define) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000359 my($name,$aname,$ahref) = link_info($br_id);
360 $str =~ s|<tt>(.*)</tt>|\1|
361 if $STRIP_INDEX_TT;
362 # equivalent of add_index_entry() using $define instead of ''
363 $str = gen_index_id($str, $define);
364 $index{$str} .= $ahref;
365 print IDXFILE $ahref, "\0", $str, "\n";
366
Fred Drakec9a44381998-03-17 06:29:13 +0000367 if ($define eq 'DEF') {
Fred Drake42b31a51998-03-27 05:16:10 +0000368 # add to the module index
Fred Drakec9a44381998-03-17 06:29:13 +0000369 my($nstr,$garbage) = split / /, $str, 2;
Fred Drake42b31a51998-03-27 05:16:10 +0000370 $Modules{$nstr} .= $ahref;
Fred Drake6659c301998-03-03 22:02:19 +0000371 }
Fred Drake42b31a51998-03-27 05:16:10 +0000372 "$aname$anchor_invisible_mark</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000373}
374
Fred Drakec9a44381998-03-17 06:29:13 +0000375$THIS_MODULE = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000376$THIS_CLASS = '';
Fred Drakec9a44381998-03-17 06:29:13 +0000377
Fred Drake6659c301998-03-03 22:02:19 +0000378sub my_module_index_helper{
379 local($word, $_) = @_;
380 s/$next_pair_pr_rx[\n]*//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000381 my($br_id, $str) = ($1, $2);
382 my $section_tag = join('', @curr_sec_id);
Fred Drake6659c301998-03-03 22:02:19 +0000383 $word = "$word " if $word;
Fred Drakec9a44381998-03-17 06:29:13 +0000384 $THIS_MODULE = "$str";
Fred Drake42b31a51998-03-27 05:16:10 +0000385 make_mod_index_entry("SECTION$section_tag",
386 "<tt>$str</tt> (${word}module)", 'DEF') . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000387}
388
389sub ref_module_index_helper{
390 local($word, $_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000391 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000392 my($br_id, $str) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000393 $word = "$word " if $word;
Fred Drake42b31a51998-03-27 05:16:10 +0000394 make_mod_index_entry($br_id, "<tt>$str</tt> (${word}module)", 'REF') . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000395}
396
Fred Drakec9a44381998-03-17 06:29:13 +0000397sub do_cmd_bifuncindex{
398 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000399 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000400 my($br_id,$str,$fname) = ($1, $2, "<tt>$2()</tt>");
401 $fname = "$str()"
402 if $STRIP_INDEX_TT;
Fred Drake42b31a51998-03-27 05:16:10 +0000403 make_index_entry($br_id, "$fname (built-in function)") . $_;
Fred Drakec9a44381998-03-17 06:29:13 +0000404}
405
Fred Drake42b31a51998-03-27 05:16:10 +0000406sub do_cmd_modindex{ my_module_index_helper('', @_); }
407sub do_cmd_bimodindex{ my_module_index_helper('built-in', @_); }
408sub do_cmd_exmodindex{ my_module_index_helper('extension', @_); }
409sub do_cmd_stmodindex{ my_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000410
411# these should be adjusted a bit....
Fred Drake42b31a51998-03-27 05:16:10 +0000412sub do_cmd_refmodindex{ ref_module_index_helper('', @_); }
413sub do_cmd_refbimodindex{ ref_module_index_helper('built-in', @_); }
414sub do_cmd_refexmodindex{ ref_module_index_helper('extension', @_); }
415sub do_cmd_refstmodindex{ ref_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000416
Fred Drake42b31a51998-03-27 05:16:10 +0000417sub do_cmd_nodename{ do_cmd_label(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000418
419sub init_myformat{
420 # XXX need some way for this to be called after &initialise; ???
421 $anchor_mark = '';
422 $icons{'anchor_mark'} = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000423 my $cmark = "(?:$comment_mark)?";
Fred Drake6659c301998-03-03 22:02:19 +0000424 # <<2>>...<<2>>
Fred Drake42b31a51998-03-27 05:16:10 +0000425 $next_pair_rx = "^[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\1$C";
426 $any_next_pair_rx3 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\3$C";
427 $any_next_pair_rx5 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\5$C";
428 $any_next_pair_rx7 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\7$C";
429 $any_next_pair_rx9 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\9$C";
Fred Drake6659c301998-03-03 22:02:19 +0000430 # <#2#>...<#2#>
Fred Drake42b31a51998-03-27 05:16:10 +0000431 $next_pair_pr_rx = "^[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\1$CP$cmark";
432 $any_next_pair_pr_rx3 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP$cmark";
433 $any_next_pair_pr_rx5 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP$cmark";
434 $any_next_pair_pr_rx7 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP$cmark";
435 $any_next_pair_pr_rx9 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP$cmark";
Fred Drake6659c301998-03-03 22:02:19 +0000436}
Fred Drake42b31a51998-03-27 05:16:10 +0000437init_myformat();
Fred Drake6659c301998-03-03 22:02:19 +0000438
439# similar to make_index_entry(), but includes the string in the result
440# instead of the dummy filler.
441#
442sub make_str_index_entry{
Fred Drakec9a44381998-03-17 06:29:13 +0000443 my($br_id,$str) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000444 my($name,$aname,$ahref) = link_info($br_id);
445 $str =~ s|<tt>(.*)</tt>|\1|
446 if $STRIP_INDEX_TT;
447 add_index_entry($str, $ahref);
448 "$aname$str</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000449}
450
451# Changed from the stock version to indent {verbatim} sections,
452# and make them smaller, to better match the LaTeX version:
453
454# (Used with LaTeX2HTML 96.1*)
455sub replace_verbatim {
456 # Modifies $_
Fred Drakec9a44381998-03-17 06:29:13 +0000457 my($prefix,$suffix) = ("\n<p><dl><dd><pre>\n", "</pre></dl>");
Fred Drake6659c301998-03-03 22:02:19 +0000458 s/$verbatim_mark(verbatim)(\d+)/$prefix$verbatim{$2}$suffix/go;
459 s/$verbatim_mark(rawhtml)(\d+)/$verbatim{$2}/ego; # Raw HTML
460}
461
462# (Used with LaTeX2HTML 98.1)
Fred Drake42b31a51998-03-27 05:16:10 +0000463# The HTML this produces is bad; the <PRE> is on the outside of the <dl>,
464# but I haven't found a workaround yet.
Fred Drake6659c301998-03-03 22:02:19 +0000465sub replace_verbatim_hook{
466 # Modifies $_
Fred Drakec9a44381998-03-17 06:29:13 +0000467 my($prefix,$suffix) = ("\n<p><dl><dd>", "</dl>");
Fred Drake6659c301998-03-03 22:02:19 +0000468 s/$math_verbatim_rx/&put_comment("MATH: ".$verbatim{$1})/eg;
469 s/$verbatim_mark(\w*[vV]erbatim\*?)(\d+)\#/$prefix$verbatim{$2}$suffix/go;
470 # Raw HTML, but replacements may have protected characters
471 s/$verbatim_mark(rawhtml)(\d+)#/&unprotect_raw_html($verbatim{$2})/eg;
472 s/$verbatim_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
473 s/$unfinished_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
474}
475
476sub do_env_cfuncdesc{
477 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000478 my($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
479 my $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
480 my $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
481 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
Fred Drake6659c301998-03-03 22:02:19 +0000482 if (/$cfuncdesc_rx/o) {
483 $return_type = "$2";
484 $function_name = "$4";
485 $arg_list = "$6";
Fred Drake42b31a51998-03-27 05:16:10 +0000486 $idx = make_str_index_entry($3,
Fred Drakec9a44381998-03-17 06:29:13 +0000487 "<tt>$function_name()</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000488 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000489 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000490 }
491 "<dl><dt>$return_type <b>$idx</b>"
Fred Drake42b31a51998-03-27 05:16:10 +0000492 . "(<var>$arg_list</var>)\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000493}
494
495sub do_env_ctypedesc{
496 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000497 my $type_name = ('');
498 my $cfuncdesc_rx = "$next_pair_rx";
Fred Drake6659c301998-03-03 22:02:19 +0000499 if (/$cfuncdesc_rx/o) {
500 $type_name = "$2";
Fred Drake42b31a51998-03-27 05:16:10 +0000501 $idx = make_str_index_entry($1,
Fred Drake6659c301998-03-03 22:02:19 +0000502 "<tt>$type_name</tt>" . &get_indexsubitem);
503 $idx =~ s/ \(.*\)//;
504 }
Fred Drake42b31a51998-03-27 05:16:10 +0000505 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000506}
507
508sub do_env_cvardesc{
509 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000510 my($var_type,$var_name,$idx) = ('', '', '');
511 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000512 if (/$cfuncdesc_rx/o) {
513 $var_type = "$2";
514 $var_name = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000515 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000516 "<tt>$var_name</tt>" . &get_indexsubitem);
517 $idx =~ s/ \(.*\)//;
518 }
519 "<dl><dt>$var_type <b>$idx</b>\n"
Fred Drake42b31a51998-03-27 05:16:10 +0000520 . "<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000521}
522
523sub do_env_funcdesc{
524 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000525 my($function_name,$arg_list,$idx) = ('', '', '');
526 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000527 if (/$funcdesc_rx/o) {
528 $function_name = "$2";
529 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000530 $idx = make_str_index_entry($3, "<tt>$function_name()</tt>"
Fred Drakec9a44381998-03-17 06:29:13 +0000531 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000532 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000533 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000534 }
Fred Drake42b31a51998-03-27 05:16:10 +0000535 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000536}
537
538sub do_env_funcdescni{
539 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000540 my($function_name,$arg_list,$idx) = ('', '', '');
541 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000542 if (/$funcdesc_rx/o) {
543 $function_name = "$2";
544 $arg_list = "$4";
545 if ($STRIP_INDEX_TT) {
Fred Drakec9a44381998-03-17 06:29:13 +0000546 $idx = "$function_name"; }
Fred Drake6659c301998-03-03 22:02:19 +0000547 else {
548 $idx = "<tt>$function_name</tt>"; }
549 }
Fred Drake42b31a51998-03-27 05:16:10 +0000550 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000551}
552
553sub do_cmd_funcline{
554 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000555 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drake6659c301998-03-03 22:02:19 +0000556
Fred Drakec9a44381998-03-17 06:29:13 +0000557 s/$next_pair_pr_rx//o;
558 my $function_name = $2;
559 s/$next_pair_pr_rx//o;
560 my($br_id,$arg_list) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000561 my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>"
562 . &get_indexsubitem);
Fred Drakec9a44381998-03-17 06:29:13 +0000563 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000564
565 "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
566}
567
568# Change this flag to index the opcode entries. I don't think it's very
569# useful to index them, since they're only presented to describe the dis
570# module.
571#
572$INDEX_OPCODES = 0;
573
574sub do_env_opcodedesc{
575 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000576 my($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000577 my $opcodedesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000578 if (/$opcodedesc_rx/o) {
579 $opcode_name = "$2";
580 $arg_list = "$4";
581 if ($INDEX_OPCODES) {
Fred Drake42b31a51998-03-27 05:16:10 +0000582 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000583 "<tt>$opcode_name</tt> (byte code instruction)");
584 $idx =~ s/ \(byte code instruction\)//;
585 }
586 else {
587 $idx = "<tt>$opcode_name</tt>";
588 }
589 }
590 $stuff = "<dl><dt><b>$idx</b>";
591 if ($arg_list) {
592 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
593 }
Fred Drake42b31a51998-03-27 05:16:10 +0000594 $stuff . "\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000595}
596
597sub do_env_datadesc{
598 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000599 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000600 if (/$next_pair_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000601 $idx = make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000602 $idx =~ s/ \(.*\)//;
603 }
Fred Drake42b31a51998-03-27 05:16:10 +0000604 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000605}
606
607sub do_env_datadescni{
608 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000609 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000610 if (/$next_pair_rx/o) {
611 if ($STRING_INDEX_TT) {
612 $idx = "$2"; }
613 else {
614 $idx = "<tt>$2</tt>"; }
615 }
Fred Drake42b31a51998-03-27 05:16:10 +0000616 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000617}
618
619sub do_cmd_dataline{
620 local($_) = @_;
621
622 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000623 my($br_id, $data_name) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000624 my $idx = make_str_index_entry($br_id, "<tt>$data_name</tt>"
625 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000626 $idx =~ s/ \(.*\)//;
627
Fred Drake42b31a51998-03-27 05:16:10 +0000628 "<dt><b>$idx</b><dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000629}
630
Fred Drake42b31a51998-03-27 05:16:10 +0000631sub do_env_excdesc{
632 local($_) = @_;
633 /$next_pair_rx/o;
634 my($br_id,$excname,$rest) = ($1, $2, $');
635 my $idx = make_str_index_entry($br_id,
636 "<tt>$excname</tt> (exception in $THIS_MODULE)");
637 $idx =~ s/ \(.*\)//;
638 "<dl><dt><b>$idx</b>\n<dd>$rest</dl>"
639}
640
641sub do_env_fulllineitems{ do_env_itemize(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000642
643
Fred Drakec9a44381998-03-17 06:29:13 +0000644sub do_env_classdesc{
645 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000646 my($class_name,$arg_list,$idx) = ('', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000647 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
648 if (/$funcdesc_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000649 $class_name = "$2";
Fred Drakec9a44381998-03-17 06:29:13 +0000650 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000651 $THIS_CLASS = $class_name;
652 $idx = make_str_index_entry($3,
653 "<tt>$class_name</tt> (class in $THIS_MODULE)" );
Fred Drakec9a44381998-03-17 06:29:13 +0000654 $idx =~ s/ \(.*\)//;
655 }
Fred Drake42b31a51998-03-27 05:16:10 +0000656 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drakec9a44381998-03-17 06:29:13 +0000657}
658
Fred Drake42b31a51998-03-27 05:16:10 +0000659
660sub do_env_methoddesc{
661 local($_) = @_;
662 my($class_name,$arg_list,$idx,$extra);
663 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
664 # require the argument to be there.
665 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
666 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
667 if (/$funcdesc_rx/o) {
668 $class_name = $2;
669 $class_name = $THIS_CLASS
670 unless $class_name;
671 $method_name = $4;
672 $arg_list = $6;
673 if ($class_name) {
674 $extra = " ($class_name method)";
675 }
676 $idx = make_str_index_entry($3, "<tt>$method_name()</tt>$extra");
677 $idx =~ s/ \(.*\)//;
678 $idx =~ s/\(\)//;
679 }
680 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
681}
682
683
684sub do_env_methoddescni{
685 local($_) = @_;
686 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
687 # require the argument to be there.
688 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
689 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
690 /$funcdesc_rx/o;
691 my $method = $4;
692 my $arg_list = $6;
693 "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
694}
695
696
697sub do_env_memberdesc{
698 local($_) = @_;
699 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
700 # require the argument to be there.
701 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
702 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
703 /$funcdesc_rx/o;
704 my($class,$member,$arg_list) = ($2, $4, $6);
705 $class = $THIS_CLASS
706 unless $class;
707 $extra = " ($class_name attribute)"
708 if $class;
709 my $idx = make_str_index_entry($3, "<tt>$member()</tt>$extra");
710 $idx =~ s/ \(.*\)//;
711 $idx =~ s/\(\)//;
712 "<dl><dt><b>$idx</b>\n<dd>$'</dl>";
713}
714
715
716sub do_env_memberdescni{
717 local($_) = @_;
718 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
719 # require the argument to be there.
720 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
721 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3";
722 /$funcdesc_rx/o;
723 my $member = $4;
724 "<dl><dt><b>$member</b>\n<dd>$'</dl>";
725}
726
727
Fred Drake6659c301998-03-03 22:02:19 +0000728@col_aligns = ("<td>", "<td>", "<td>");
729
730sub setup_column_alignments{
731 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000732 my($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_);
733 my($th1,$th2,$th3) = ('<th>', '<th>', '<th>');
Fred Drake6659c301998-03-03 22:02:19 +0000734 $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>");
735 $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>");
736 $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>");
737 # return the aligned header start tags; only used for \begin{tableiii?}
738 $th1 = (($a1 eq "l") ? "<th align=left>"
739 : ($a1 eq "r" ? "<th align=right>" : "<th>"));
740 $th2 = (($a2 eq "l") ? "<th align=left>"
741 : ($a2 eq "r" ? "<th align=right>" : "<th>"));
742 $th3 = (($a3 eq "l") ? "<th align=left>"
743 : ($a3 eq "r" ? "<th align=right>" : "<th>"));
744 ($th1, $th2, $th3);
745}
746
747sub do_env_tableii{
748 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000749 my($font,$h1,$h2) = ('', '', '');
750 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000751 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7";
752 if (/$tableiii_rx/o) {
753 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000754 $font = ''
755 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000756 $h1 = $6;
757 $h2 = $8;
758 }
Fred Drake42b31a51998-03-27 05:16:10 +0000759 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000760 $globals{"lineifont"} = $font;
761 "<table border align=center>"
762 . "\n <tr>$th1<b>$h1</b></th>"
763 . "\n $th2<b>$h2</b></th>$'"
764 . "\n</table>";
765}
766
767sub do_cmd_lineii{
768 local($_) = @_;
769 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000770 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000771 s/$next_pair_pr_rx//o;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000772 my($c2,$font,$efont) = ($2, $globals{"lineifont"}, '');
773 if ($font) {
774 $font = "<$font>";
775 $efont = "</$font>";
776 }
Fred Drakec9a44381998-03-17 06:29:13 +0000777 my($c1align,$c2align) = @col_aligns[0,1];
Fred Drake58b2bfd1998-04-02 20:14:04 +0000778 "<tr>$c1align$font$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000779 . " $c2align$c2</td>$'";
780}
781
782sub do_env_tableiii{
783 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000784 my($font,$h1,$h2,$h3) = ('', '', '', '');
Fred Drake6659c301998-03-03 22:02:19 +0000785
Fred Drakec9a44381998-03-17 06:29:13 +0000786 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000787 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"
788 . "$any_next_pair_rx9";
789 if (/$tableiii_rx/o) {
790 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000791 $font = ''
792 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000793 $h1 = $6;
794 $h2 = $8;
795 $h3 = $10;
796 }
Fred Drake42b31a51998-03-27 05:16:10 +0000797 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000798 $globals{"lineifont"} = $font;
799 "<table border align=center>"
800 . "\n <tr>$th1<b>$h1</b></th>"
801 . "\n $th2<b>$h2</b></th>"
802 . "\n $th3<b>$h3</b></th>$'"
803 . "\n</table>";
804}
805
806sub do_cmd_lineiii{
807 local($_) = @_;
808 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000809 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000810 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000811 my $c2 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000812 s/$next_pair_pr_rx//o;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000813 my($c3,$font,$efont) = ($2, $globals{"lineifont"}, '');
814 if ($font) {
815 $font = "<$font>";
816 $efont = "</$font>";
817 }
Fred Drakec9a44381998-03-17 06:29:13 +0000818 my($c1align, $c2align, $c3align) = @col_aligns;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000819 "<tr>$c1align$font$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000820 . " $c2align$c2</td>\n"
821 . " $c3align$c3</td>$'";
822}
823
824sub do_env_seealso{
825 "<p><b>See Also:</b></p>\n" . @_[0];
826}
827
828sub do_cmd_seemodule{
829 # Insert the right magic to jump to the module definition. This should
830 # work most of the time, at least for repeat builds....
831 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000832 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
833 my $any_next_pair_pr_rx5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
834 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
835 # require the argument to be there.
836 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
837 s/$opt_arg_rx$any_next_pair_pr_rx3$any_next_pair_pr_rx5//;
838 my($key,$module,$text) = ($2, $4, $6);
839 $key = $module unless $key;
Fred Drakeb3c9bca1998-03-06 21:20:08 +0000840 "<p>Module <tt><b><a href=\"module-$key.html\">$module</a></b></tt>"
Fred Drake6659c301998-03-03 22:02:19 +0000841 . "&nbsp;&nbsp;&nbsp;($text)</p>"
842 . $_;
843}
844
845sub do_cmd_seetext{
846 "<p>" . @_[0];
847}
848
849
850sub do_cmd_maketitle {
851 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000852 my $the_title = '';
Fred Drake6659c301998-03-03 22:02:19 +0000853 if ($t_title) {
Fred Drakec9a44381998-03-17 06:29:13 +0000854 $the_title .= "<h1 align=center>$t_title</h1>";
Fred Drake6659c301998-03-03 22:02:19 +0000855 } else { &write_warnings("\nThis document has no title."); }
Fred Drakec9a44381998-03-17 06:29:13 +0000856 $the_title .= "\n<center>";
Fred Drake6659c301998-03-03 22:02:19 +0000857 if ($t_author) {
858 if ($t_authorURL) {
Fred Drakec9a44381998-03-17 06:29:13 +0000859 my $href = &translate_commands($t_authorURL);
Fred Drake6659c301998-03-03 22:02:19 +0000860 $href = &make_named_href('author', $href, "<strong>${t_author}</strong>");
Fred Drakec9a44381998-03-17 06:29:13 +0000861 $the_title .= "\n<p>$href</p>";
Fred Drake6659c301998-03-03 22:02:19 +0000862 } else {
Fred Drakec9a44381998-03-17 06:29:13 +0000863 $the_title .= "\n<p><strong>$t_author</strong></p>";
Fred Drake6659c301998-03-03 22:02:19 +0000864 }
865 } else { &write_warnings("\nThere is no author for this document."); }
866 if ($t_institute) {
Fred Drakec9a44381998-03-17 06:29:13 +0000867 $the_title .= "\n<p>$t_institute</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000868 if ($AUTHOR_ADDRESS) {
Fred Drakec9a44381998-03-17 06:29:13 +0000869 $the_title .= "\n<p>$AUTHOR_ADDRESS</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000870 if ($t_affil) {
Fred Drakec9a44381998-03-17 06:29:13 +0000871 $the_title .= "\n<p><i>$t_affil</i></p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000872 if ($t_date) {
Fred Drakec9a44381998-03-17 06:29:13 +0000873 $the_title .= "\n<p><strong>$t_date</strong>";
Fred Drake6659c301998-03-03 22:02:19 +0000874 if ($PYTHON_VERSION) {
875 $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";}
876 $the_title .= "</p>"
877 }
Fred Drakec9a44381998-03-17 06:29:13 +0000878 $the_title .= "\n</center>";
Fred Drake6659c301998-03-03 22:02:19 +0000879 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +0000880 $the_title .= "\n<p>$t_address</p>";
881 } else { $the_title .= "\n<p>"}
Fred Drake6659c301998-03-03 22:02:19 +0000882 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +0000883 $the_title .= "\n<p>$t_email</p>";
884 }# else { $the_title .= "</p>" }
885 $the_title . "<hr>\n" . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +0000886}
887
888
Fred Drake42b31a51998-03-27 05:16:10 +0000889# sub do_cmd_indexlabel{
890# "genindex" . @_[0];
891# }
Fred Drakec9a44381998-03-17 06:29:13 +0000892
Fred Drakefc16e781998-03-12 21:03:26 +0000893
894# These are located down here since they screw up fontlock. -- used to.
Fred Drake6659c301998-03-03 22:02:19 +0000895
896sub do_cmd_file{
897 # This uses a weird HTML construct to adjust the font to be
898 # reasonable match that used in the printed form as much as
899 # possible. The expected behavior is that a browser that doesn't
900 # understand "<font face=...>" markup will use courier (or whatever
901 # the font is for <tt>).
902 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000903 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000904 $_;
905}
906
907sub do_cmd_samp{
908 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000909 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000910 $_;
911}
912
9131; # This must be the last line