blob: d9ea19ffdcfcfc6e0b8121e4c10facf2417e4410 [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 Drake3ad125e1998-04-13 14:18:57 +000067sub do_cmd_pytype{ use_current(@_); }
68sub do_cmd_makevar{ use_current(@_); }
Fred Drake10ad52e1998-04-04 04:19:20 +000069
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
Fred Drake6659c301998-03-03 22:02:19 +0000447sub do_env_cfuncdesc{
448 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000449 my($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
450 my $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
451 my $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
452 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
Fred Drake6659c301998-03-03 22:02:19 +0000453 if (/$cfuncdesc_rx/o) {
454 $return_type = "$2";
455 $function_name = "$4";
456 $arg_list = "$6";
Fred Drake42b31a51998-03-27 05:16:10 +0000457 $idx = make_str_index_entry($3,
Fred Drakec9a44381998-03-17 06:29:13 +0000458 "<tt>$function_name()</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000459 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000460 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000461 }
462 "<dl><dt>$return_type <b>$idx</b>"
Fred Drake42b31a51998-03-27 05:16:10 +0000463 . "(<var>$arg_list</var>)\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000464}
465
466sub do_env_ctypedesc{
467 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000468 my $type_name = ('');
469 my $cfuncdesc_rx = "$next_pair_rx";
Fred Drake6659c301998-03-03 22:02:19 +0000470 if (/$cfuncdesc_rx/o) {
471 $type_name = "$2";
Fred Drake42b31a51998-03-27 05:16:10 +0000472 $idx = make_str_index_entry($1,
Fred Drake6659c301998-03-03 22:02:19 +0000473 "<tt>$type_name</tt>" . &get_indexsubitem);
474 $idx =~ s/ \(.*\)//;
475 }
Fred Drake42b31a51998-03-27 05:16:10 +0000476 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000477}
478
479sub do_env_cvardesc{
480 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000481 my($var_type,$var_name,$idx) = ('', '', '');
482 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000483 if (/$cfuncdesc_rx/o) {
484 $var_type = "$2";
485 $var_name = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000486 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000487 "<tt>$var_name</tt>" . &get_indexsubitem);
488 $idx =~ s/ \(.*\)//;
489 }
490 "<dl><dt>$var_type <b>$idx</b>\n"
Fred Drake42b31a51998-03-27 05:16:10 +0000491 . "<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000492}
493
494sub do_env_funcdesc{
495 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000496 my($function_name,$arg_list,$idx) = ('', '', '');
497 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000498 if (/$funcdesc_rx/o) {
499 $function_name = "$2";
500 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000501 $idx = make_str_index_entry($3, "<tt>$function_name()</tt>"
Fred Drakec9a44381998-03-17 06:29:13 +0000502 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000503 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000504 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000505 }
Fred Drake42b31a51998-03-27 05:16:10 +0000506 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000507}
508
509sub do_env_funcdescni{
510 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000511 my($function_name,$arg_list,$idx) = ('', '', '');
512 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000513 if (/$funcdesc_rx/o) {
514 $function_name = "$2";
515 $arg_list = "$4";
Fred Drake166abba1998-04-08 23:10:54 +0000516 $idx = "<tt>$function_name</tt>";
Fred Drake6659c301998-03-03 22:02:19 +0000517 }
Fred Drake42b31a51998-03-27 05:16:10 +0000518 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000519}
520
521sub do_cmd_funcline{
522 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000523 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drake6659c301998-03-03 22:02:19 +0000524
Fred Drakec9a44381998-03-17 06:29:13 +0000525 s/$next_pair_pr_rx//o;
526 my $function_name = $2;
527 s/$next_pair_pr_rx//o;
528 my($br_id,$arg_list) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000529 my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>"
530 . &get_indexsubitem);
Fred Drakec9a44381998-03-17 06:29:13 +0000531 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000532
533 "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
534}
535
536# Change this flag to index the opcode entries. I don't think it's very
537# useful to index them, since they're only presented to describe the dis
538# module.
539#
540$INDEX_OPCODES = 0;
541
542sub do_env_opcodedesc{
543 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000544 my($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000545 my $opcodedesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000546 if (/$opcodedesc_rx/o) {
547 $opcode_name = "$2";
548 $arg_list = "$4";
549 if ($INDEX_OPCODES) {
Fred Drake42b31a51998-03-27 05:16:10 +0000550 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000551 "<tt>$opcode_name</tt> (byte code instruction)");
552 $idx =~ s/ \(byte code instruction\)//;
553 }
554 else {
555 $idx = "<tt>$opcode_name</tt>";
556 }
557 }
558 $stuff = "<dl><dt><b>$idx</b>";
559 if ($arg_list) {
560 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
561 }
Fred Drake42b31a51998-03-27 05:16:10 +0000562 $stuff . "\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000563}
564
565sub do_env_datadesc{
566 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000567 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000568 if (/$next_pair_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000569 $idx = make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000570 $idx =~ s/ \(.*\)//;
571 }
Fred Drake42b31a51998-03-27 05:16:10 +0000572 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000573}
574
575sub do_env_datadescni{
576 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000577 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000578 if (/$next_pair_rx/o) {
579 if ($STRING_INDEX_TT) {
580 $idx = "$2"; }
581 else {
582 $idx = "<tt>$2</tt>"; }
583 }
Fred Drake42b31a51998-03-27 05:16:10 +0000584 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000585}
586
587sub do_cmd_dataline{
588 local($_) = @_;
589
590 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000591 my($br_id, $data_name) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000592 my $idx = make_str_index_entry($br_id, "<tt>$data_name</tt>"
593 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000594 $idx =~ s/ \(.*\)//;
595
Fred Drake42b31a51998-03-27 05:16:10 +0000596 "<dt><b>$idx</b><dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000597}
598
Fred Drake42b31a51998-03-27 05:16:10 +0000599sub do_env_excdesc{
600 local($_) = @_;
601 /$next_pair_rx/o;
602 my($br_id,$excname,$rest) = ($1, $2, $');
Fred Drake166abba1998-04-08 23:10:54 +0000603 my $idx = make_str_index_entry($br_id, "<tt>$excname</tt>");
Fred Drake42b31a51998-03-27 05:16:10 +0000604 "<dl><dt><b>$idx</b>\n<dd>$rest</dl>"
605}
606
607sub do_env_fulllineitems{ do_env_itemize(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000608
609
Fred Drakec9a44381998-03-17 06:29:13 +0000610sub do_env_classdesc{
611 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000612 my($class_name,$arg_list,$idx) = ('', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000613 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
614 if (/$funcdesc_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000615 $class_name = "$2";
Fred Drakec9a44381998-03-17 06:29:13 +0000616 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000617 $THIS_CLASS = $class_name;
618 $idx = make_str_index_entry($3,
619 "<tt>$class_name</tt> (class in $THIS_MODULE)" );
Fred Drakec9a44381998-03-17 06:29:13 +0000620 $idx =~ s/ \(.*\)//;
621 }
Fred Drake42b31a51998-03-27 05:16:10 +0000622 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drakec9a44381998-03-17 06:29:13 +0000623}
624
Fred Drake42b31a51998-03-27 05:16:10 +0000625
626sub do_env_methoddesc{
627 local($_) = @_;
628 my($class_name,$arg_list,$idx,$extra);
629 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
630 # require the argument to be there.
631 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
632 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
633 if (/$funcdesc_rx/o) {
634 $class_name = $2;
635 $class_name = $THIS_CLASS
636 unless $class_name;
637 $method_name = $4;
638 $arg_list = $6;
639 if ($class_name) {
640 $extra = " ($class_name method)";
641 }
642 $idx = make_str_index_entry($3, "<tt>$method_name()</tt>$extra");
643 $idx =~ s/ \(.*\)//;
644 $idx =~ s/\(\)//;
645 }
646 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
647}
648
649
650sub do_env_methoddescni{
651 local($_) = @_;
652 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
653 # require the argument to be there.
654 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
655 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
656 /$funcdesc_rx/o;
657 my $method = $4;
658 my $arg_list = $6;
659 "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
660}
661
662
663sub do_env_memberdesc{
664 local($_) = @_;
665 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
666 # require the argument to be there.
667 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
Fred Drake756a9e81998-04-11 03:12:06 +0000668 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3";
669 s/$funcdesc_rx//o;
670 my($class,$member) = ($2, $4);
Fred Drake42b31a51998-03-27 05:16:10 +0000671 $class = $THIS_CLASS
672 unless $class;
673 $extra = " ($class_name attribute)"
Fred Drakea608feb1998-04-12 03:58:13 +0000674 if (!($class eq ''));
Fred Drakeae9bc671998-04-12 03:49:46 +0000675 my $idx = make_str_index_entry($3, "<tt>$member</tt>$extra");
Fred Drake42b31a51998-03-27 05:16:10 +0000676 $idx =~ s/ \(.*\)//;
677 $idx =~ s/\(\)//;
Fred Drake756a9e81998-04-11 03:12:06 +0000678 "<dl><dt><b>$idx</b>\n<dd>" . $_ . "</dl>";
Fred Drake42b31a51998-03-27 05:16:10 +0000679}
680
681
682sub do_env_memberdescni{
683 local($_) = @_;
684 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
685 # require the argument to be there.
686 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
687 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3";
688 /$funcdesc_rx/o;
689 my $member = $4;
690 "<dl><dt><b>$member</b>\n<dd>$'</dl>";
691}
692
693
Fred Drake6659c301998-03-03 22:02:19 +0000694@col_aligns = ("<td>", "<td>", "<td>");
695
696sub setup_column_alignments{
697 local($_) = @_;
Fred Drakeee601911998-04-11 20:53:03 +0000698 my($a1,$a2,$a3) = split(/[|]/,$_);
Fred Drakec9a44381998-03-17 06:29:13 +0000699 my($th1,$th2,$th3) = ('<th>', '<th>', '<th>');
Fred Drake6659c301998-03-03 22:02:19 +0000700 $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>");
701 $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>");
702 $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>");
703 # return the aligned header start tags; only used for \begin{tableiii?}
704 $th1 = (($a1 eq "l") ? "<th align=left>"
705 : ($a1 eq "r" ? "<th align=right>" : "<th>"));
706 $th2 = (($a2 eq "l") ? "<th align=left>"
707 : ($a2 eq "r" ? "<th align=right>" : "<th>"));
708 $th3 = (($a3 eq "l") ? "<th align=left>"
709 : ($a3 eq "r" ? "<th align=right>" : "<th>"));
710 ($th1, $th2, $th3);
711}
712
713sub do_env_tableii{
714 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000715 my($font,$h1,$h2) = ('', '', '');
716 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000717 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7";
718 if (/$tableiii_rx/o) {
719 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000720 $font = ''
721 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000722 $h1 = $6;
723 $h2 = $8;
724 }
Fred Drake42b31a51998-03-27 05:16:10 +0000725 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000726 $globals{"lineifont"} = $font;
727 "<table border align=center>"
728 . "\n <tr>$th1<b>$h1</b></th>"
729 . "\n $th2<b>$h2</b></th>$'"
730 . "\n</table>";
731}
732
733sub do_cmd_lineii{
734 local($_) = @_;
735 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000736 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000737 s/$next_pair_pr_rx//o;
Fred Drake5cca42e1998-04-09 17:59:11 +0000738 my($c2,$font,$sfont,$efont) = ($2, $globals{"lineifont"}, '', '');
Fred Drake58b2bfd1998-04-02 20:14:04 +0000739 if ($font) {
Fred Drake5cca42e1998-04-09 17:59:11 +0000740 $sfont = "<$font>";
Fred Drake58b2bfd1998-04-02 20:14:04 +0000741 $efont = "</$font>";
742 }
Fred Drakec9a44381998-03-17 06:29:13 +0000743 my($c1align,$c2align) = @col_aligns[0,1];
Fred Drake5cca42e1998-04-09 17:59:11 +0000744 "<tr>$c1align$sfont$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000745 . " $c2align$c2</td>$'";
746}
747
748sub do_env_tableiii{
749 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000750 my($font,$h1,$h2,$h3) = ('', '', '', '');
Fred Drake6659c301998-03-03 22:02:19 +0000751
Fred Drakec9a44381998-03-17 06:29:13 +0000752 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000753 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"
754 . "$any_next_pair_rx9";
755 if (/$tableiii_rx/o) {
756 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000757 $font = ''
758 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000759 $h1 = $6;
760 $h2 = $8;
761 $h3 = $10;
762 }
Fred Drake42b31a51998-03-27 05:16:10 +0000763 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000764 $globals{"lineifont"} = $font;
765 "<table border align=center>"
766 . "\n <tr>$th1<b>$h1</b></th>"
767 . "\n $th2<b>$h2</b></th>"
768 . "\n $th3<b>$h3</b></th>$'"
769 . "\n</table>";
770}
771
772sub do_cmd_lineiii{
773 local($_) = @_;
774 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000775 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000776 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000777 my $c2 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000778 s/$next_pair_pr_rx//o;
Fred Drake5cca42e1998-04-09 17:59:11 +0000779 my($c3,$font,$sfont,$efont) = ($2, $globals{"lineifont"}, '', '');
Fred Drake58b2bfd1998-04-02 20:14:04 +0000780 if ($font) {
Fred Drake5cca42e1998-04-09 17:59:11 +0000781 $sfont = "<$font>";
Fred Drake58b2bfd1998-04-02 20:14:04 +0000782 $efont = "</$font>";
783 }
Fred Drakec9a44381998-03-17 06:29:13 +0000784 my($c1align, $c2align, $c3align) = @col_aligns;
Fred Drake5cca42e1998-04-09 17:59:11 +0000785 "<tr>$c1align$sfont$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000786 . " $c2align$c2</td>\n"
787 . " $c3align$c3</td>$'";
788}
789
790sub do_env_seealso{
791 "<p><b>See Also:</b></p>\n" . @_[0];
792}
793
794sub do_cmd_seemodule{
795 # Insert the right magic to jump to the module definition. This should
796 # work most of the time, at least for repeat builds....
797 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000798 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
799 my $any_next_pair_pr_rx5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
800 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
801 # require the argument to be there.
802 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
803 s/$opt_arg_rx$any_next_pair_pr_rx3$any_next_pair_pr_rx5//;
804 my($key,$module,$text) = ($2, $4, $6);
805 $key = $module unless $key;
Fred Drakeb3c9bca1998-03-06 21:20:08 +0000806 "<p>Module <tt><b><a href=\"module-$key.html\">$module</a></b></tt>"
Fred Drake6659c301998-03-03 22:02:19 +0000807 . "&nbsp;&nbsp;&nbsp;($text)</p>"
808 . $_;
809}
810
811sub do_cmd_seetext{
812 "<p>" . @_[0];
813}
814
815
816sub do_cmd_maketitle {
817 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000818 my $the_title = '';
Fred Drake6659c301998-03-03 22:02:19 +0000819 if ($t_title) {
Fred Drakec9a44381998-03-17 06:29:13 +0000820 $the_title .= "<h1 align=center>$t_title</h1>";
Fred Drake6659c301998-03-03 22:02:19 +0000821 } else { &write_warnings("\nThis document has no title."); }
Fred Drakec9a44381998-03-17 06:29:13 +0000822 $the_title .= "\n<center>";
Fred Drake6659c301998-03-03 22:02:19 +0000823 if ($t_author) {
824 if ($t_authorURL) {
Fred Drakec9a44381998-03-17 06:29:13 +0000825 my $href = &translate_commands($t_authorURL);
Fred Drake6659c301998-03-03 22:02:19 +0000826 $href = &make_named_href('author', $href, "<strong>${t_author}</strong>");
Fred Drakec9a44381998-03-17 06:29:13 +0000827 $the_title .= "\n<p>$href</p>";
Fred Drake6659c301998-03-03 22:02:19 +0000828 } else {
Fred Drakec9a44381998-03-17 06:29:13 +0000829 $the_title .= "\n<p><strong>$t_author</strong></p>";
Fred Drake6659c301998-03-03 22:02:19 +0000830 }
831 } else { &write_warnings("\nThere is no author for this document."); }
832 if ($t_institute) {
Fred Drakec9a44381998-03-17 06:29:13 +0000833 $the_title .= "\n<p>$t_institute</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000834 if ($AUTHOR_ADDRESS) {
Fred Drakec9a44381998-03-17 06:29:13 +0000835 $the_title .= "\n<p>$AUTHOR_ADDRESS</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000836 if ($t_affil) {
Fred Drakec9a44381998-03-17 06:29:13 +0000837 $the_title .= "\n<p><i>$t_affil</i></p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000838 if ($t_date) {
Fred Drakec9a44381998-03-17 06:29:13 +0000839 $the_title .= "\n<p><strong>$t_date</strong>";
Fred Drake6659c301998-03-03 22:02:19 +0000840 if ($PYTHON_VERSION) {
841 $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";}
842 $the_title .= "</p>"
843 }
Fred Drakec9a44381998-03-17 06:29:13 +0000844 $the_title .= "\n</center>";
Fred Drake6659c301998-03-03 22:02:19 +0000845 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +0000846 $the_title .= "\n<p>$t_address</p>";
847 } else { $the_title .= "\n<p>"}
Fred Drake6659c301998-03-03 22:02:19 +0000848 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +0000849 $the_title .= "\n<p>$t_email</p>";
850 }# else { $the_title .= "</p>" }
851 $the_title . "<hr>\n" . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +0000852}
853
854
Fred Drake42b31a51998-03-27 05:16:10 +0000855# sub do_cmd_indexlabel{
856# "genindex" . @_[0];
857# }
Fred Drakec9a44381998-03-17 06:29:13 +0000858
Fred Drakefc16e781998-03-12 21:03:26 +0000859
860# These are located down here since they screw up fontlock. -- used to.
Fred Drake6659c301998-03-03 22:02:19 +0000861
862sub do_cmd_file{
863 # This uses a weird HTML construct to adjust the font to be
864 # reasonable match that used in the printed form as much as
865 # possible. The expected behavior is that a browser that doesn't
866 # understand "<font face=...>" markup will use courier (or whatever
867 # the font is for <tt>).
868 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000869 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000870 $_;
871}
872
873sub do_cmd_samp{
874 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000875 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000876 $_;
877}
878
8791; # This must be the last line