blob: 4842da2d6f593d4f836561fe1467781cee9ab4f8 [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);
Fred Drake166abba1998-04-08 23:10:54 +0000133 # The <tt> here is really to keep buildindex.py from making
134 # the variable name case-insensitive.
135 add_index_entry("environment variables!$envvar@<tt>\$$envvar</tt>",
136 $ahref);
Fred Drake42b31a51998-03-27 05:16:10 +0000137 add_index_entry("$envvar@\$$envvar", $ahref);
138 "$aname\$$envvar</a>" . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000139}
140
Fred Drake6659c301998-03-03 22:02:19 +0000141sub do_cmd_url{
142 # use the URL as both text and hyperlink
143 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000144 s/$next_pair_pr_rx//;
145 my $url = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000146 $url =~ s/~/&#126;/g;
Fred Drakec9a44381998-03-17 06:29:13 +0000147 "<a href=\"$url\"><font face=sans-serif>$url</font></a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000148}
149
150sub do_cmd_manpage{
151 # two parameters: \manpage{name}{section}
152 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000153 my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3";
154 s|$rx|<i>\2</i>(\4)|;
Fred Drake6659c301998-03-03 22:02:19 +0000155 $_;
156}
157
158sub do_cmd_rfc{
159 local($_) = @_;
160 s/$next_pair_pr_rx//;
Fred Drakec9a44381998-03-17 06:29:13 +0000161 my($br_id,$rfcnumber) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000162
163 # Save the reference
Fred Drakec9a44381998-03-17 06:29:13 +0000164 my $nstr = &gen_index_id("RFC!RFC $rfcnumber", '');
Fred Drake6659c301998-03-03 22:02:19 +0000165 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
Fred Drakec9a44381998-03-17 06:29:13 +0000166 "<a name=$br_id>RFC $rfcnumber</a>" .$_;
Fred Drake6659c301998-03-03 22:02:19 +0000167}
168
169sub do_cmd_kbd{
170 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000171 s|$next_pair_pr_rx|<kbd>\2</kbd>|;
Fred Drake6659c301998-03-03 22:02:19 +0000172 $_;
173}
174
175sub do_cmd_strong{
176 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000177 s|$next_pair_pr_rx|<b>\2</b>|;
Fred Drake6659c301998-03-03 22:02:19 +0000178 $_;
179}
180
181sub do_cmd_deprecated{
182 # two parameters: \deprecated{version}{whattodo}
183 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000184 my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3";
185 s|$rx|<b>Deprecated since release \2.</b>\n\4<p>|;
186 $_;
Fred Drake6659c301998-03-03 22:02:19 +0000187}
188
189# file and samp are at the end of this file since they screw up fontlock.
190
191# index commands
192
193$INDEX_SUBITEM = "";
194
195sub get_indexsubitem{
Fred Drakefc16e781998-03-12 21:03:26 +0000196 #$INDEX_SUBITEM ? " $INDEX_SUBITEM" : '';
197 '';
Fred Drake6659c301998-03-03 22:02:19 +0000198}
199
200sub do_cmd_setindexsubitem{
201 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000202 s/$next_pair_pr_rx//;
Fred Drake6659c301998-03-03 22:02:19 +0000203 $INDEX_SUBITEM = $2;
204 $_;
205}
206
Fred Drakefc16e781998-03-12 21:03:26 +0000207sub do_cmd_withsubitem{
208 # We can't really do the right right thing, because LaTeX2HTML doesn't
209 # do things in the right order, but we need to at least strip this stuff
210 # out, and leave anything that the second argument expanded out to.
211 #
212 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000213 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drakefc16e781998-03-12 21:03:26 +0000214 s/$next_pair_pr_rx$any_next_pair_pr_rx3/\4/;
Fred Drake42b31a51998-03-27 05:16:10 +0000215 $INDEX_SUBITEM = $2;
Fred Drakefc16e781998-03-12 21:03:26 +0000216 $_;
217}
218
219sub do_cmd_makemodindex{ @_[0]; }
220
Fred Drake42b31a51998-03-27 05:16:10 +0000221# We're in the document subdirectory when this happens!
Fred Drake166abba1998-04-08 23:10:54 +0000222#
Fred Drake42b31a51998-03-27 05:16:10 +0000223open(IDXFILE, ">index.dat") || die "\n$!\n";
224open(INTLABELS, ">intlabels.pl") || die "\n$!\n";
Fred Drake166abba1998-04-08 23:10:54 +0000225print INTLABELS "%internal_labels = ();\n";
226print INTLABELS "1; # hack in case there are no entries\n\n";
227
228# Using \0 for this is bad because we can't use common tools to work with the
229# resulting files. Things like grep can be useful with this stuff!
230#
231$IDXFILE_FIELD_SEP = "\1";
232
Fred Drake42b31a51998-03-27 05:16:10 +0000233
234sub gen_target_name{
235 "l2h-" . @_[0];
236}
237
238sub gen_target{
239 "<a name=\"" . @_[0] . "\">";
240}
241
242sub gen_link{
243 my($node,$target) = @_;
244 print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n";
245 "<a href=\"$node#$target\">";
246}
247
248sub make_index_entry{
249 my($br_id,$str) = @_;
250 my($name,$aname,$ahref) = link_info($br_id);
251 add_index_entry($str, $ahref);
252 "$aname$anchor_invisible_mark</a>";
253}
254
255sub add_index_entry{
256 # add an entry to the index structures; ignore the return value
257 my($str,$ahref) = @_;
258 $str = gen_index_id($str, '');
259 $index{$str} .= $ahref;
Fred Drake166abba1998-04-08 23:10:54 +0000260 print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n";
Fred Drake42b31a51998-03-27 05:16:10 +0000261}
262
263sub link_info{
264 my $name = gen_target_name(@_[0]);
265 my $aname = gen_target($name);
266 my $ahref = gen_link($CURRENT_FILE, $name);
267 return ($name, $aname, $ahref);
268}
269
270sub do_cmd_index{
271 local($_) = @_;
272 s/$next_pair_pr_rx[\n]?//o;
273 my($br_id,$str) = ($1, $2);
274 #
275 my($name,$aname,$ahref) = link_info($br_id);
276 add_index_entry("$str", $ahref);
277 "$aname$anchor_invisible_mark</a>" . $_;
278}
279
Fred Drake6659c301998-03-03 22:02:19 +0000280sub do_cmd_indexii{
281 local($_) = @_;
282 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000283 my($br_id1,$str1) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000284 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000285 my($br_id2,$str2) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000286 #
287 my($name,$aname,$ahref) = link_info($br_id1);
288 add_index_entry("$str1!$str2", $ahref);
289 add_index_entry("$str2!$str1", $ahref);
290 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000291}
292
293sub do_cmd_indexiii{
294 local($_) = @_;
295 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000296 my($br_id1,$str1) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000297 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000298 my($br_id2,$str2) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000299 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000300 my($br_id3,$str3) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000301 #
302 my($name,$aname,$ahref) = link_info($br_id1);
303 add_index_entry("$str1!$str2 $str3", $ahref);
304 add_index_entry("$str2!$str3, $str1", $ahref);
305 add_index_entry("$str3!$str1 $str2", $ahref);
306 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000307}
308
309sub do_cmd_indexiv{
310 local($_) = @_;
311 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000312 my($br_id1,$str1) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000313 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000314 my($br_id2,$str2) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000315 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000316 my($br_id3,$str3) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000317 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000318 my($br_id4,$str4) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000319 #
320 my($name,$aname,$ahref) = link_info($br_id1);
321 add_index_entry("$str1!$str2 $str3 $str4", $ahref);
322 add_index_entry("$str2!$str3 $str4, $str1", $ahref);
323 add_index_entry("$str3!$str4, $str1 $str2", $ahref);
324 add_index_entry("$str4!$$str1 $str2 $str3", $ahref);
325 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000326}
327
Fred Drakec9a44381998-03-17 06:29:13 +0000328sub do_cmd_ttindex{
329 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000330 s/$next_pair_pr_rx[\n]?//;
Fred Drakec9a44381998-03-17 06:29:13 +0000331 my($br_id,$str) = ($1, $2);
332 &make_index_entry($br_id, $str . &get_indexsubitem) . $_;
333}
Fred Drake6659c301998-03-03 22:02:19 +0000334
335sub my_typed_index_helper{
Fred Drakec9a44381998-03-17 06:29:13 +0000336 local($word,$_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000337 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000338 my($br_id,$str) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000339 #
340 my($name,$aname,$ahref) = link_info($br_id1);
341 add_index_entry("$str $word", $ahref);
342 add_index_entry("$word!$str", $ahref);
343 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000344}
345
346sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
347sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
348sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
349sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
350
351sub my_parword_index_helper{
Fred Drakec9a44381998-03-17 06:29:13 +0000352 local($word,$_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000353 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000354 my($br_id,$str) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000355 make_index_entry($br_id, "$str ($word)") . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000356}
357
358
Fred Drake6659c301998-03-03 22:02:19 +0000359sub make_mod_index_entry{
Fred Drakec9a44381998-03-17 06:29:13 +0000360 my($br_id,$str,$define) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000361 my($name,$aname,$ahref) = link_info($br_id);
Fred Drake42b31a51998-03-27 05:16:10 +0000362 # equivalent of add_index_entry() using $define instead of ''
363 $str = gen_index_id($str, $define);
364 $index{$str} .= $ahref;
Fred Drake166abba1998-04-08 23:10:54 +0000365 print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n";
Fred Drake42b31a51998-03-27 05:16:10 +0000366
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>");
Fred Drake42b31a51998-03-27 05:16:10 +0000401 make_index_entry($br_id, "$fname (built-in function)") . $_;
Fred Drakec9a44381998-03-17 06:29:13 +0000402}
403
Fred Drake42b31a51998-03-27 05:16:10 +0000404sub do_cmd_modindex{ my_module_index_helper('', @_); }
405sub do_cmd_bimodindex{ my_module_index_helper('built-in', @_); }
406sub do_cmd_exmodindex{ my_module_index_helper('extension', @_); }
407sub do_cmd_stmodindex{ my_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000408
409# these should be adjusted a bit....
Fred Drake42b31a51998-03-27 05:16:10 +0000410sub do_cmd_refmodindex{ ref_module_index_helper('', @_); }
411sub do_cmd_refbimodindex{ ref_module_index_helper('built-in', @_); }
412sub do_cmd_refexmodindex{ ref_module_index_helper('extension', @_); }
413sub do_cmd_refstmodindex{ ref_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000414
Fred Drake42b31a51998-03-27 05:16:10 +0000415sub do_cmd_nodename{ do_cmd_label(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000416
417sub init_myformat{
418 # XXX need some way for this to be called after &initialise; ???
419 $anchor_mark = '';
420 $icons{'anchor_mark'} = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000421 my $cmark = "(?:$comment_mark)?";
Fred Drake6659c301998-03-03 22:02:19 +0000422 # <<2>>...<<2>>
Fred Drake42b31a51998-03-27 05:16:10 +0000423 $next_pair_rx = "^[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\1$C";
424 $any_next_pair_rx3 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\3$C";
425 $any_next_pair_rx5 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\5$C";
426 $any_next_pair_rx7 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\7$C";
427 $any_next_pair_rx9 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\9$C";
Fred Drake6659c301998-03-03 22:02:19 +0000428 # <#2#>...<#2#>
Fred Drake42b31a51998-03-27 05:16:10 +0000429 $next_pair_pr_rx = "^[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\1$CP$cmark";
430 $any_next_pair_pr_rx3 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP$cmark";
431 $any_next_pair_pr_rx5 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP$cmark";
432 $any_next_pair_pr_rx7 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP$cmark";
433 $any_next_pair_pr_rx9 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP$cmark";
Fred Drake6659c301998-03-03 22:02:19 +0000434}
Fred Drake42b31a51998-03-27 05:16:10 +0000435init_myformat();
Fred Drake6659c301998-03-03 22:02:19 +0000436
437# similar to make_index_entry(), but includes the string in the result
438# instead of the dummy filler.
439#
440sub make_str_index_entry{
Fred Drakec9a44381998-03-17 06:29:13 +0000441 my($br_id,$str) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000442 my($name,$aname,$ahref) = link_info($br_id);
Fred Drake42b31a51998-03-27 05:16:10 +0000443 add_index_entry($str, $ahref);
444 "$aname$str</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000445}
446
447# Changed from the stock version to indent {verbatim} sections,
448# and make them smaller, to better match the LaTeX version:
449
450# (Used with LaTeX2HTML 96.1*)
451sub replace_verbatim {
452 # Modifies $_
Fred Drakec9a44381998-03-17 06:29:13 +0000453 my($prefix,$suffix) = ("\n<p><dl><dd><pre>\n", "</pre></dl>");
Fred Drake6659c301998-03-03 22:02:19 +0000454 s/$verbatim_mark(verbatim)(\d+)/$prefix$verbatim{$2}$suffix/go;
455 s/$verbatim_mark(rawhtml)(\d+)/$verbatim{$2}/ego; # Raw HTML
456}
457
458# (Used with LaTeX2HTML 98.1)
Fred Drake42b31a51998-03-27 05:16:10 +0000459# The HTML this produces is bad; the <PRE> is on the outside of the <dl>,
460# but I haven't found a workaround yet.
Fred Drake6659c301998-03-03 22:02:19 +0000461sub replace_verbatim_hook{
462 # Modifies $_
Fred Drakec9a44381998-03-17 06:29:13 +0000463 my($prefix,$suffix) = ("\n<p><dl><dd>", "</dl>");
Fred Drake6659c301998-03-03 22:02:19 +0000464 s/$math_verbatim_rx/&put_comment("MATH: ".$verbatim{$1})/eg;
465 s/$verbatim_mark(\w*[vV]erbatim\*?)(\d+)\#/$prefix$verbatim{$2}$suffix/go;
466 # Raw HTML, but replacements may have protected characters
467 s/$verbatim_mark(rawhtml)(\d+)#/&unprotect_raw_html($verbatim{$2})/eg;
468 s/$verbatim_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
469 s/$unfinished_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
470}
471
472sub do_env_cfuncdesc{
473 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000474 my($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
475 my $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
476 my $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
477 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
Fred Drake6659c301998-03-03 22:02:19 +0000478 if (/$cfuncdesc_rx/o) {
479 $return_type = "$2";
480 $function_name = "$4";
481 $arg_list = "$6";
Fred Drake42b31a51998-03-27 05:16:10 +0000482 $idx = make_str_index_entry($3,
Fred Drakec9a44381998-03-17 06:29:13 +0000483 "<tt>$function_name()</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000484 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000485 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000486 }
487 "<dl><dt>$return_type <b>$idx</b>"
Fred Drake42b31a51998-03-27 05:16:10 +0000488 . "(<var>$arg_list</var>)\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000489}
490
491sub do_env_ctypedesc{
492 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000493 my $type_name = ('');
494 my $cfuncdesc_rx = "$next_pair_rx";
Fred Drake6659c301998-03-03 22:02:19 +0000495 if (/$cfuncdesc_rx/o) {
496 $type_name = "$2";
Fred Drake42b31a51998-03-27 05:16:10 +0000497 $idx = make_str_index_entry($1,
Fred Drake6659c301998-03-03 22:02:19 +0000498 "<tt>$type_name</tt>" . &get_indexsubitem);
499 $idx =~ s/ \(.*\)//;
500 }
Fred Drake42b31a51998-03-27 05:16:10 +0000501 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000502}
503
504sub do_env_cvardesc{
505 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000506 my($var_type,$var_name,$idx) = ('', '', '');
507 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000508 if (/$cfuncdesc_rx/o) {
509 $var_type = "$2";
510 $var_name = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000511 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000512 "<tt>$var_name</tt>" . &get_indexsubitem);
513 $idx =~ s/ \(.*\)//;
514 }
515 "<dl><dt>$var_type <b>$idx</b>\n"
Fred Drake42b31a51998-03-27 05:16:10 +0000516 . "<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000517}
518
519sub do_env_funcdesc{
520 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000521 my($function_name,$arg_list,$idx) = ('', '', '');
522 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000523 if (/$funcdesc_rx/o) {
524 $function_name = "$2";
525 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000526 $idx = make_str_index_entry($3, "<tt>$function_name()</tt>"
Fred Drakec9a44381998-03-17 06:29:13 +0000527 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000528 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000529 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000530 }
Fred Drake42b31a51998-03-27 05:16:10 +0000531 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000532}
533
534sub do_env_funcdescni{
535 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000536 my($function_name,$arg_list,$idx) = ('', '', '');
537 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000538 if (/$funcdesc_rx/o) {
539 $function_name = "$2";
540 $arg_list = "$4";
Fred Drake166abba1998-04-08 23:10:54 +0000541 $idx = "<tt>$function_name</tt>";
Fred Drake6659c301998-03-03 22:02:19 +0000542 }
Fred Drake42b31a51998-03-27 05:16:10 +0000543 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000544}
545
546sub do_cmd_funcline{
547 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000548 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drake6659c301998-03-03 22:02:19 +0000549
Fred Drakec9a44381998-03-17 06:29:13 +0000550 s/$next_pair_pr_rx//o;
551 my $function_name = $2;
552 s/$next_pair_pr_rx//o;
553 my($br_id,$arg_list) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000554 my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>"
555 . &get_indexsubitem);
Fred Drakec9a44381998-03-17 06:29:13 +0000556 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000557
558 "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
559}
560
561# Change this flag to index the opcode entries. I don't think it's very
562# useful to index them, since they're only presented to describe the dis
563# module.
564#
565$INDEX_OPCODES = 0;
566
567sub do_env_opcodedesc{
568 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000569 my($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000570 my $opcodedesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000571 if (/$opcodedesc_rx/o) {
572 $opcode_name = "$2";
573 $arg_list = "$4";
574 if ($INDEX_OPCODES) {
Fred Drake42b31a51998-03-27 05:16:10 +0000575 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000576 "<tt>$opcode_name</tt> (byte code instruction)");
577 $idx =~ s/ \(byte code instruction\)//;
578 }
579 else {
580 $idx = "<tt>$opcode_name</tt>";
581 }
582 }
583 $stuff = "<dl><dt><b>$idx</b>";
584 if ($arg_list) {
585 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
586 }
Fred Drake42b31a51998-03-27 05:16:10 +0000587 $stuff . "\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000588}
589
590sub do_env_datadesc{
591 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000592 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000593 if (/$next_pair_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000594 $idx = make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000595 $idx =~ s/ \(.*\)//;
596 }
Fred Drake42b31a51998-03-27 05:16:10 +0000597 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000598}
599
600sub do_env_datadescni{
601 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000602 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000603 if (/$next_pair_rx/o) {
604 if ($STRING_INDEX_TT) {
605 $idx = "$2"; }
606 else {
607 $idx = "<tt>$2</tt>"; }
608 }
Fred Drake42b31a51998-03-27 05:16:10 +0000609 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000610}
611
612sub do_cmd_dataline{
613 local($_) = @_;
614
615 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000616 my($br_id, $data_name) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000617 my $idx = make_str_index_entry($br_id, "<tt>$data_name</tt>"
618 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000619 $idx =~ s/ \(.*\)//;
620
Fred Drake42b31a51998-03-27 05:16:10 +0000621 "<dt><b>$idx</b><dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000622}
623
Fred Drake42b31a51998-03-27 05:16:10 +0000624sub do_env_excdesc{
625 local($_) = @_;
626 /$next_pair_rx/o;
627 my($br_id,$excname,$rest) = ($1, $2, $');
Fred Drake166abba1998-04-08 23:10:54 +0000628 my $idx = make_str_index_entry($br_id, "<tt>$excname</tt>");
Fred Drake42b31a51998-03-27 05:16:10 +0000629 "<dl><dt><b>$idx</b>\n<dd>$rest</dl>"
630}
631
632sub do_env_fulllineitems{ do_env_itemize(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000633
634
Fred Drakec9a44381998-03-17 06:29:13 +0000635sub do_env_classdesc{
636 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000637 my($class_name,$arg_list,$idx) = ('', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000638 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
639 if (/$funcdesc_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000640 $class_name = "$2";
Fred Drakec9a44381998-03-17 06:29:13 +0000641 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000642 $THIS_CLASS = $class_name;
643 $idx = make_str_index_entry($3,
644 "<tt>$class_name</tt> (class in $THIS_MODULE)" );
Fred Drakec9a44381998-03-17 06:29:13 +0000645 $idx =~ s/ \(.*\)//;
646 }
Fred Drake42b31a51998-03-27 05:16:10 +0000647 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drakec9a44381998-03-17 06:29:13 +0000648}
649
Fred Drake42b31a51998-03-27 05:16:10 +0000650
651sub do_env_methoddesc{
652 local($_) = @_;
653 my($class_name,$arg_list,$idx,$extra);
654 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
655 # require the argument to be there.
656 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
657 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
658 if (/$funcdesc_rx/o) {
659 $class_name = $2;
660 $class_name = $THIS_CLASS
661 unless $class_name;
662 $method_name = $4;
663 $arg_list = $6;
664 if ($class_name) {
665 $extra = " ($class_name method)";
666 }
667 $idx = make_str_index_entry($3, "<tt>$method_name()</tt>$extra");
668 $idx =~ s/ \(.*\)//;
669 $idx =~ s/\(\)//;
670 }
671 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
672}
673
674
675sub do_env_methoddescni{
676 local($_) = @_;
677 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
678 # require the argument to be there.
679 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
680 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
681 /$funcdesc_rx/o;
682 my $method = $4;
683 my $arg_list = $6;
684 "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
685}
686
687
688sub do_env_memberdesc{
689 local($_) = @_;
690 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
691 # require the argument to be there.
692 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
693 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
694 /$funcdesc_rx/o;
695 my($class,$member,$arg_list) = ($2, $4, $6);
696 $class = $THIS_CLASS
697 unless $class;
698 $extra = " ($class_name attribute)"
699 if $class;
700 my $idx = make_str_index_entry($3, "<tt>$member()</tt>$extra");
701 $idx =~ s/ \(.*\)//;
702 $idx =~ s/\(\)//;
703 "<dl><dt><b>$idx</b>\n<dd>$'</dl>";
704}
705
706
707sub do_env_memberdescni{
708 local($_) = @_;
709 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
710 # require the argument to be there.
711 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
712 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3";
713 /$funcdesc_rx/o;
714 my $member = $4;
715 "<dl><dt><b>$member</b>\n<dd>$'</dl>";
716}
717
718
Fred Drake6659c301998-03-03 22:02:19 +0000719@col_aligns = ("<td>", "<td>", "<td>");
720
721sub setup_column_alignments{
722 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000723 my($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_);
724 my($th1,$th2,$th3) = ('<th>', '<th>', '<th>');
Fred Drake6659c301998-03-03 22:02:19 +0000725 $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>");
726 $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>");
727 $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>");
728 # return the aligned header start tags; only used for \begin{tableiii?}
729 $th1 = (($a1 eq "l") ? "<th align=left>"
730 : ($a1 eq "r" ? "<th align=right>" : "<th>"));
731 $th2 = (($a2 eq "l") ? "<th align=left>"
732 : ($a2 eq "r" ? "<th align=right>" : "<th>"));
733 $th3 = (($a3 eq "l") ? "<th align=left>"
734 : ($a3 eq "r" ? "<th align=right>" : "<th>"));
735 ($th1, $th2, $th3);
736}
737
738sub do_env_tableii{
739 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000740 my($font,$h1,$h2) = ('', '', '');
741 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000742 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7";
743 if (/$tableiii_rx/o) {
744 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000745 $font = ''
746 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000747 $h1 = $6;
748 $h2 = $8;
749 }
Fred Drake42b31a51998-03-27 05:16:10 +0000750 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000751 $globals{"lineifont"} = $font;
752 "<table border align=center>"
753 . "\n <tr>$th1<b>$h1</b></th>"
754 . "\n $th2<b>$h2</b></th>$'"
755 . "\n</table>";
756}
757
758sub do_cmd_lineii{
759 local($_) = @_;
760 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000761 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000762 s/$next_pair_pr_rx//o;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000763 my($c2,$font,$efont) = ($2, $globals{"lineifont"}, '');
764 if ($font) {
765 $font = "<$font>";
766 $efont = "</$font>";
767 }
Fred Drakec9a44381998-03-17 06:29:13 +0000768 my($c1align,$c2align) = @col_aligns[0,1];
Fred Drake58b2bfd1998-04-02 20:14:04 +0000769 "<tr>$c1align$font$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000770 . " $c2align$c2</td>$'";
771}
772
773sub do_env_tableiii{
774 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000775 my($font,$h1,$h2,$h3) = ('', '', '', '');
Fred Drake6659c301998-03-03 22:02:19 +0000776
Fred Drakec9a44381998-03-17 06:29:13 +0000777 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000778 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"
779 . "$any_next_pair_rx9";
780 if (/$tableiii_rx/o) {
781 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000782 $font = ''
783 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000784 $h1 = $6;
785 $h2 = $8;
786 $h3 = $10;
787 }
Fred Drake42b31a51998-03-27 05:16:10 +0000788 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000789 $globals{"lineifont"} = $font;
790 "<table border align=center>"
791 . "\n <tr>$th1<b>$h1</b></th>"
792 . "\n $th2<b>$h2</b></th>"
793 . "\n $th3<b>$h3</b></th>$'"
794 . "\n</table>";
795}
796
797sub do_cmd_lineiii{
798 local($_) = @_;
799 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000800 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000801 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000802 my $c2 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000803 s/$next_pair_pr_rx//o;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000804 my($c3,$font,$efont) = ($2, $globals{"lineifont"}, '');
805 if ($font) {
806 $font = "<$font>";
807 $efont = "</$font>";
808 }
Fred Drakec9a44381998-03-17 06:29:13 +0000809 my($c1align, $c2align, $c3align) = @col_aligns;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000810 "<tr>$c1align$font$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000811 . " $c2align$c2</td>\n"
812 . " $c3align$c3</td>$'";
813}
814
815sub do_env_seealso{
816 "<p><b>See Also:</b></p>\n" . @_[0];
817}
818
819sub do_cmd_seemodule{
820 # Insert the right magic to jump to the module definition. This should
821 # work most of the time, at least for repeat builds....
822 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000823 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
824 my $any_next_pair_pr_rx5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
825 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
826 # require the argument to be there.
827 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
828 s/$opt_arg_rx$any_next_pair_pr_rx3$any_next_pair_pr_rx5//;
829 my($key,$module,$text) = ($2, $4, $6);
830 $key = $module unless $key;
Fred Drakeb3c9bca1998-03-06 21:20:08 +0000831 "<p>Module <tt><b><a href=\"module-$key.html\">$module</a></b></tt>"
Fred Drake6659c301998-03-03 22:02:19 +0000832 . "&nbsp;&nbsp;&nbsp;($text)</p>"
833 . $_;
834}
835
836sub do_cmd_seetext{
837 "<p>" . @_[0];
838}
839
840
841sub do_cmd_maketitle {
842 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000843 my $the_title = '';
Fred Drake6659c301998-03-03 22:02:19 +0000844 if ($t_title) {
Fred Drakec9a44381998-03-17 06:29:13 +0000845 $the_title .= "<h1 align=center>$t_title</h1>";
Fred Drake6659c301998-03-03 22:02:19 +0000846 } else { &write_warnings("\nThis document has no title."); }
Fred Drakec9a44381998-03-17 06:29:13 +0000847 $the_title .= "\n<center>";
Fred Drake6659c301998-03-03 22:02:19 +0000848 if ($t_author) {
849 if ($t_authorURL) {
Fred Drakec9a44381998-03-17 06:29:13 +0000850 my $href = &translate_commands($t_authorURL);
Fred Drake6659c301998-03-03 22:02:19 +0000851 $href = &make_named_href('author', $href, "<strong>${t_author}</strong>");
Fred Drakec9a44381998-03-17 06:29:13 +0000852 $the_title .= "\n<p>$href</p>";
Fred Drake6659c301998-03-03 22:02:19 +0000853 } else {
Fred Drakec9a44381998-03-17 06:29:13 +0000854 $the_title .= "\n<p><strong>$t_author</strong></p>";
Fred Drake6659c301998-03-03 22:02:19 +0000855 }
856 } else { &write_warnings("\nThere is no author for this document."); }
857 if ($t_institute) {
Fred Drakec9a44381998-03-17 06:29:13 +0000858 $the_title .= "\n<p>$t_institute</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000859 if ($AUTHOR_ADDRESS) {
Fred Drakec9a44381998-03-17 06:29:13 +0000860 $the_title .= "\n<p>$AUTHOR_ADDRESS</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000861 if ($t_affil) {
Fred Drakec9a44381998-03-17 06:29:13 +0000862 $the_title .= "\n<p><i>$t_affil</i></p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000863 if ($t_date) {
Fred Drakec9a44381998-03-17 06:29:13 +0000864 $the_title .= "\n<p><strong>$t_date</strong>";
Fred Drake6659c301998-03-03 22:02:19 +0000865 if ($PYTHON_VERSION) {
866 $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";}
867 $the_title .= "</p>"
868 }
Fred Drakec9a44381998-03-17 06:29:13 +0000869 $the_title .= "\n</center>";
Fred Drake6659c301998-03-03 22:02:19 +0000870 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +0000871 $the_title .= "\n<p>$t_address</p>";
872 } else { $the_title .= "\n<p>"}
Fred Drake6659c301998-03-03 22:02:19 +0000873 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +0000874 $the_title .= "\n<p>$t_email</p>";
875 }# else { $the_title .= "</p>" }
876 $the_title . "<hr>\n" . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +0000877}
878
879
Fred Drake42b31a51998-03-27 05:16:10 +0000880# sub do_cmd_indexlabel{
881# "genindex" . @_[0];
882# }
Fred Drakec9a44381998-03-17 06:29:13 +0000883
Fred Drakefc16e781998-03-12 21:03:26 +0000884
885# These are located down here since they screw up fontlock. -- used to.
Fred Drake6659c301998-03-03 22:02:19 +0000886
887sub do_cmd_file{
888 # This uses a weird HTML construct to adjust the font to be
889 # reasonable match that used in the printed form as much as
890 # possible. The expected behavior is that a browser that doesn't
891 # understand "<font face=...>" markup will use courier (or whatever
892 # the font is for <tt>).
893 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000894 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000895 $_;
896}
897
898sub do_cmd_samp{
899 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000900 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000901 $_;
902}
903
9041; # This must be the last line