blob: 7cec9157aec31f77113d5d60e8502e6c8ecccb76 [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 Drake2b8093a1998-04-02 22:33:44 +000061sub do_cmd_pytype{
62 local($_) = @_;
63 s|$next_pair_pr_rx|\2|;
64 $_;
65}
66
Fred Drakec9a44381998-03-17 06:29:13 +000067# Logical formatting (some based on texinfo), needs to be converted to
68# minimalist HTML. The "minimalist" is primarily to reduce the size of
69# output files for users that read them over the network rather than
70# from local repositories.
Fred Drake6659c301998-03-03 22:02:19 +000071
72sub do_cmd_code{
73 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +000074 s|$next_pair_pr_rx|<tt>\2</tt>|;
75 $_;
76}
77
78sub use_sans_serif{
79 local($_) = @_;
80 s|$next_pair_pr_rx|<font face=sans-serif>\2</font>|;
81 $_;
82}
83
84sub use_italics{
85 local($_) = @_;
86 s|$next_pair_pr_rx|<i>\2</i>|;
Fred Drake6659c301998-03-03 22:02:19 +000087 $_;
88}
89
90sub do_cmd_sectcode{ &do_cmd_code(@_); }
91sub do_cmd_module{ &do_cmd_code(@_); }
92sub do_cmd_keyword{ &do_cmd_code(@_); }
93sub do_cmd_exception{ &do_cmd_code(@_); }
94sub do_cmd_class{ &do_cmd_code(@_); }
95sub do_cmd_function{ &do_cmd_code(@_); }
96sub do_cmd_constant{ &do_cmd_code(@_); }
97sub do_cmd_member{ &do_cmd_code(@_); }
98sub do_cmd_method{ &do_cmd_code(@_); }
Fred Drake6659c301998-03-03 22:02:19 +000099sub do_cmd_cfunction{ &do_cmd_code(@_); }
100sub do_cmd_cdata{ &do_cmd_code(@_); }
101sub do_cmd_ctype{ &do_cmd_code(@_); }
Fred Drakec9a44381998-03-17 06:29:13 +0000102sub do_cmd_regexp{ &do_cmd_code(@_); }
103sub do_cmd_key{ &do_cmd_code(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000104
Fred Drakefc16e781998-03-12 21:03:26 +0000105sub do_cmd_character{ &do_cmd_samp(@_); }
106
Fred Drakec9a44381998-03-17 06:29:13 +0000107sub do_cmd_program{ &do_cmd_strong(@_); }
108
109sub do_cmd_email{ &use_sans_serif(@_); }
110sub do_cmd_mimetype{ &use_sans_serif(@_); }
111
112sub do_cmd_var{ &use_italics(@_); }
Fred Drake42b31a51998-03-27 05:16:10 +0000113sub do_cmd_dfn{ &use_italics(@_); } # make an index entry?
Fred Drakec9a44381998-03-17 06:29:13 +0000114sub do_cmd_emph{ &use_italics(@_); }
115
Fred Drake1a7af391998-04-01 22:44:56 +0000116sub do_cmd_newsgroup{
117 local($_) = @_;
118 s/$next_pair_pr_rx//o;
119 my $newsgroup = $2;
120 my $stuff = "<a href=\"news:$newsgroup\"><font face=sans-serif>"
121 . "$newsgroup</font></a>";
122 $stuff . $_;
123}
Fred Drakefc16e781998-03-12 21:03:26 +0000124
125sub do_cmd_envvar{
126 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000127 s/$next_pair_pr_rx//;
128 my($br_id,$envvar) = ($1, $2);
129 my($name,$aname,$ahref) = link_info($br_id);
130 add_index_entry("environment variables!$envvar@\$$envvar", $ahref);
131 add_index_entry("$envvar@\$$envvar", $ahref);
132 "$aname\$$envvar</a>" . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000133}
134
Fred Drake6659c301998-03-03 22:02:19 +0000135sub do_cmd_url{
136 # use the URL as both text and hyperlink
137 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000138 s/$next_pair_pr_rx//;
139 my $url = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000140 $url =~ s/~/&#126;/g;
Fred Drakec9a44381998-03-17 06:29:13 +0000141 "<a href=\"$url\"><font face=sans-serif>$url</font></a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000142}
143
144sub do_cmd_manpage{
145 # two parameters: \manpage{name}{section}
146 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000147 my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3";
148 s|$rx|<i>\2</i>(\4)|;
Fred Drake6659c301998-03-03 22:02:19 +0000149 $_;
150}
151
152sub do_cmd_rfc{
153 local($_) = @_;
154 s/$next_pair_pr_rx//;
Fred Drakec9a44381998-03-17 06:29:13 +0000155 my($br_id,$rfcnumber) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000156
157 # Save the reference
Fred Drakec9a44381998-03-17 06:29:13 +0000158 my $nstr = &gen_index_id("RFC!RFC $rfcnumber", '');
Fred Drake6659c301998-03-03 22:02:19 +0000159 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
Fred Drakec9a44381998-03-17 06:29:13 +0000160 "<a name=$br_id>RFC $rfcnumber</a>" .$_;
Fred Drake6659c301998-03-03 22:02:19 +0000161}
162
163sub do_cmd_kbd{
164 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000165 s|$next_pair_pr_rx|<kbd>\2</kbd>|;
Fred Drake6659c301998-03-03 22:02:19 +0000166 $_;
167}
168
169sub do_cmd_strong{
170 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000171 s|$next_pair_pr_rx|<b>\2</b>|;
Fred Drake6659c301998-03-03 22:02:19 +0000172 $_;
173}
174
175sub do_cmd_deprecated{
176 # two parameters: \deprecated{version}{whattodo}
177 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000178 my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3";
179 s|$rx|<b>Deprecated since release \2.</b>\n\4<p>|;
180 $_;
Fred Drake6659c301998-03-03 22:02:19 +0000181}
182
183# file and samp are at the end of this file since they screw up fontlock.
184
185# index commands
186
187$INDEX_SUBITEM = "";
188
189sub get_indexsubitem{
Fred Drakefc16e781998-03-12 21:03:26 +0000190 #$INDEX_SUBITEM ? " $INDEX_SUBITEM" : '';
191 '';
Fred Drake6659c301998-03-03 22:02:19 +0000192}
193
194sub do_cmd_setindexsubitem{
195 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000196 s/$next_pair_pr_rx//;
Fred Drake6659c301998-03-03 22:02:19 +0000197 $INDEX_SUBITEM = $2;
198 $_;
199}
200
Fred Drakefc16e781998-03-12 21:03:26 +0000201sub do_cmd_withsubitem{
202 # We can't really do the right right thing, because LaTeX2HTML doesn't
203 # do things in the right order, but we need to at least strip this stuff
204 # out, and leave anything that the second argument expanded out to.
205 #
206 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000207 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drakefc16e781998-03-12 21:03:26 +0000208 s/$next_pair_pr_rx$any_next_pair_pr_rx3/\4/;
Fred Drake42b31a51998-03-27 05:16:10 +0000209 $INDEX_SUBITEM = $2;
Fred Drakefc16e781998-03-12 21:03:26 +0000210 $_;
211}
212
213sub do_cmd_makemodindex{ @_[0]; }
214
Fred Drake42b31a51998-03-27 05:16:10 +0000215# We're in the document subdirectory when this happens!
216open(IDXFILE, ">index.dat") || die "\n$!\n";
217open(INTLABELS, ">intlabels.pl") || die "\n$!\n";
218print INTLABELS
219 "%internal_labels = ();\n1; # hack in case there are no entries\n\n";
220
221sub gen_target_name{
222 "l2h-" . @_[0];
223}
224
225sub gen_target{
226 "<a name=\"" . @_[0] . "\">";
227}
228
229sub gen_link{
230 my($node,$target) = @_;
231 print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n";
232 "<a href=\"$node#$target\">";
233}
234
235sub make_index_entry{
236 my($br_id,$str) = @_;
237 my($name,$aname,$ahref) = link_info($br_id);
238 add_index_entry($str, $ahref);
239 "$aname$anchor_invisible_mark</a>";
240}
241
242sub add_index_entry{
243 # add an entry to the index structures; ignore the return value
244 my($str,$ahref) = @_;
245 $str = gen_index_id($str, '');
246 $index{$str} .= $ahref;
247 print IDXFILE $ahref, "\0", $str, "\n";
248}
249
250sub link_info{
251 my $name = gen_target_name(@_[0]);
252 my $aname = gen_target($name);
253 my $ahref = gen_link($CURRENT_FILE, $name);
254 return ($name, $aname, $ahref);
255}
256
257sub do_cmd_index{
258 local($_) = @_;
259 s/$next_pair_pr_rx[\n]?//o;
260 my($br_id,$str) = ($1, $2);
261 #
262 my($name,$aname,$ahref) = link_info($br_id);
263 add_index_entry("$str", $ahref);
264 "$aname$anchor_invisible_mark</a>" . $_;
265}
266
Fred Drake6659c301998-03-03 22:02:19 +0000267sub do_cmd_indexii{
268 local($_) = @_;
269 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000270 my($br_id1,$str1) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000271 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000272 my($br_id2,$str2) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000273 #
274 my($name,$aname,$ahref) = link_info($br_id1);
275 add_index_entry("$str1!$str2", $ahref);
276 add_index_entry("$str2!$str1", $ahref);
277 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000278}
279
280sub do_cmd_indexiii{
281 local($_) = @_;
282 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000283 my($br_id1,$str1) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000284 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000285 my($br_id2,$str2) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000286 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000287 my($br_id3,$str3) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000288 #
289 my($name,$aname,$ahref) = link_info($br_id1);
290 add_index_entry("$str1!$str2 $str3", $ahref);
291 add_index_entry("$str2!$str3, $str1", $ahref);
292 add_index_entry("$str3!$str1 $str2", $ahref);
293 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000294}
295
296sub do_cmd_indexiv{
297 local($_) = @_;
298 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000299 my($br_id1,$str1) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000300 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000301 my($br_id2,$str2) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000302 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000303 my($br_id3,$str3) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000304 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000305 my($br_id4,$str4) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000306 #
307 my($name,$aname,$ahref) = link_info($br_id1);
308 add_index_entry("$str1!$str2 $str3 $str4", $ahref);
309 add_index_entry("$str2!$str3 $str4, $str1", $ahref);
310 add_index_entry("$str3!$str4, $str1 $str2", $ahref);
311 add_index_entry("$str4!$$str1 $str2 $str3", $ahref);
312 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000313}
314
Fred Drakec9a44381998-03-17 06:29:13 +0000315sub do_cmd_ttindex{
316 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000317 s/$next_pair_pr_rx[\n]?//;
Fred Drakec9a44381998-03-17 06:29:13 +0000318 my($br_id,$str) = ($1, $2);
319 &make_index_entry($br_id, $str . &get_indexsubitem) . $_;
320}
Fred Drake6659c301998-03-03 22:02:19 +0000321
322sub my_typed_index_helper{
Fred Drakec9a44381998-03-17 06:29:13 +0000323 local($word,$_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000324 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000325 my($br_id,$str) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000326 #
327 my($name,$aname,$ahref) = link_info($br_id1);
328 add_index_entry("$str $word", $ahref);
329 add_index_entry("$word!$str", $ahref);
330 "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000331}
332
333sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
334sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
335sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
336sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
337
338sub my_parword_index_helper{
Fred Drakec9a44381998-03-17 06:29:13 +0000339 local($word,$_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000340 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000341 my($br_id,$str) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000342 make_index_entry($br_id, "$str ($word)") . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000343}
344
345
346# Set this to true to strip out the <tt>...</tt> from index entries;
347# this is analogous to using the second definition of \idxcode{} from
348# myformat.sty.
349#
350# It is used from &make_mod_index_entry() and &make_str_index_entry().
351#
352$STRIP_INDEX_TT = 0;
353
354sub make_mod_index_entry{
Fred Drakec9a44381998-03-17 06:29:13 +0000355 my($br_id,$str,$define) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000356 my($name,$aname,$ahref) = link_info($br_id);
357 $str =~ s|<tt>(.*)</tt>|\1|
358 if $STRIP_INDEX_TT;
359 # equivalent of add_index_entry() using $define instead of ''
360 $str = gen_index_id($str, $define);
361 $index{$str} .= $ahref;
362 print IDXFILE $ahref, "\0", $str, "\n";
363
Fred Drakec9a44381998-03-17 06:29:13 +0000364 if ($define eq 'DEF') {
Fred Drake42b31a51998-03-27 05:16:10 +0000365 # add to the module index
Fred Drakec9a44381998-03-17 06:29:13 +0000366 my($nstr,$garbage) = split / /, $str, 2;
Fred Drake42b31a51998-03-27 05:16:10 +0000367 $Modules{$nstr} .= $ahref;
Fred Drake6659c301998-03-03 22:02:19 +0000368 }
Fred Drake42b31a51998-03-27 05:16:10 +0000369 "$aname$anchor_invisible_mark</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000370}
371
Fred Drakec9a44381998-03-17 06:29:13 +0000372$THIS_MODULE = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000373$THIS_CLASS = '';
Fred Drakec9a44381998-03-17 06:29:13 +0000374
Fred Drake6659c301998-03-03 22:02:19 +0000375sub my_module_index_helper{
376 local($word, $_) = @_;
377 s/$next_pair_pr_rx[\n]*//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000378 my($br_id, $str) = ($1, $2);
379 my $section_tag = join('', @curr_sec_id);
Fred Drake6659c301998-03-03 22:02:19 +0000380 $word = "$word " if $word;
Fred Drakec9a44381998-03-17 06:29:13 +0000381 $THIS_MODULE = "$str";
Fred Drake42b31a51998-03-27 05:16:10 +0000382 make_mod_index_entry("SECTION$section_tag",
383 "<tt>$str</tt> (${word}module)", 'DEF') . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000384}
385
386sub ref_module_index_helper{
387 local($word, $_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000388 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000389 my($br_id, $str) = ($1, $2);
Fred Drake6659c301998-03-03 22:02:19 +0000390 $word = "$word " if $word;
Fred Drake42b31a51998-03-27 05:16:10 +0000391 make_mod_index_entry($br_id, "<tt>$str</tt> (${word}module)", 'REF') . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000392}
393
Fred Drakec9a44381998-03-17 06:29:13 +0000394sub do_cmd_bifuncindex{
395 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000396 s/$next_pair_pr_rx[\n]?//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000397 my($br_id,$str,$fname) = ($1, $2, "<tt>$2()</tt>");
398 $fname = "$str()"
399 if $STRIP_INDEX_TT;
Fred Drake42b31a51998-03-27 05:16:10 +0000400 make_index_entry($br_id, "$fname (built-in function)") . $_;
Fred Drakec9a44381998-03-17 06:29:13 +0000401}
402
Fred Drake42b31a51998-03-27 05:16:10 +0000403sub do_cmd_modindex{ my_module_index_helper('', @_); }
404sub do_cmd_bimodindex{ my_module_index_helper('built-in', @_); }
405sub do_cmd_exmodindex{ my_module_index_helper('extension', @_); }
406sub do_cmd_stmodindex{ my_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000407
408# these should be adjusted a bit....
Fred Drake42b31a51998-03-27 05:16:10 +0000409sub do_cmd_refmodindex{ ref_module_index_helper('', @_); }
410sub do_cmd_refbimodindex{ ref_module_index_helper('built-in', @_); }
411sub do_cmd_refexmodindex{ ref_module_index_helper('extension', @_); }
412sub do_cmd_refstmodindex{ ref_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000413
Fred Drake42b31a51998-03-27 05:16:10 +0000414sub do_cmd_nodename{ do_cmd_label(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000415
416sub init_myformat{
417 # XXX need some way for this to be called after &initialise; ???
418 $anchor_mark = '';
419 $icons{'anchor_mark'} = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000420 my $cmark = "(?:$comment_mark)?";
Fred Drake6659c301998-03-03 22:02:19 +0000421 # <<2>>...<<2>>
Fred Drake42b31a51998-03-27 05:16:10 +0000422 $next_pair_rx = "^[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\1$C";
423 $any_next_pair_rx3 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\3$C";
424 $any_next_pair_rx5 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\5$C";
425 $any_next_pair_rx7 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\7$C";
426 $any_next_pair_rx9 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\9$C";
Fred Drake6659c301998-03-03 22:02:19 +0000427 # <#2#>...<#2#>
Fred Drake42b31a51998-03-27 05:16:10 +0000428 $next_pair_pr_rx = "^[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\1$CP$cmark";
429 $any_next_pair_pr_rx3 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP$cmark";
430 $any_next_pair_pr_rx5 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP$cmark";
431 $any_next_pair_pr_rx7 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP$cmark";
432 $any_next_pair_pr_rx9 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP$cmark";
Fred Drake6659c301998-03-03 22:02:19 +0000433}
Fred Drake42b31a51998-03-27 05:16:10 +0000434init_myformat();
Fred Drake6659c301998-03-03 22:02:19 +0000435
436# similar to make_index_entry(), but includes the string in the result
437# instead of the dummy filler.
438#
439sub make_str_index_entry{
Fred Drakec9a44381998-03-17 06:29:13 +0000440 my($br_id,$str) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000441 my($name,$aname,$ahref) = link_info($br_id);
442 $str =~ s|<tt>(.*)</tt>|\1|
443 if $STRIP_INDEX_TT;
444 add_index_entry($str, $ahref);
445 "$aname$str</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000446}
447
448# Changed from the stock version to indent {verbatim} sections,
449# and make them smaller, to better match the LaTeX version:
450
451# (Used with LaTeX2HTML 96.1*)
452sub replace_verbatim {
453 # Modifies $_
Fred Drakec9a44381998-03-17 06:29:13 +0000454 my($prefix,$suffix) = ("\n<p><dl><dd><pre>\n", "</pre></dl>");
Fred Drake6659c301998-03-03 22:02:19 +0000455 s/$verbatim_mark(verbatim)(\d+)/$prefix$verbatim{$2}$suffix/go;
456 s/$verbatim_mark(rawhtml)(\d+)/$verbatim{$2}/ego; # Raw HTML
457}
458
459# (Used with LaTeX2HTML 98.1)
Fred Drake42b31a51998-03-27 05:16:10 +0000460# The HTML this produces is bad; the <PRE> is on the outside of the <dl>,
461# but I haven't found a workaround yet.
Fred Drake6659c301998-03-03 22:02:19 +0000462sub replace_verbatim_hook{
463 # Modifies $_
Fred Drakec9a44381998-03-17 06:29:13 +0000464 my($prefix,$suffix) = ("\n<p><dl><dd>", "</dl>");
Fred Drake6659c301998-03-03 22:02:19 +0000465 s/$math_verbatim_rx/&put_comment("MATH: ".$verbatim{$1})/eg;
466 s/$verbatim_mark(\w*[vV]erbatim\*?)(\d+)\#/$prefix$verbatim{$2}$suffix/go;
467 # Raw HTML, but replacements may have protected characters
468 s/$verbatim_mark(rawhtml)(\d+)#/&unprotect_raw_html($verbatim{$2})/eg;
469 s/$verbatim_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
470 s/$unfinished_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
471}
472
473sub do_env_cfuncdesc{
474 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000475 my($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
476 my $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
477 my $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
478 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
Fred Drake6659c301998-03-03 22:02:19 +0000479 if (/$cfuncdesc_rx/o) {
480 $return_type = "$2";
481 $function_name = "$4";
482 $arg_list = "$6";
Fred Drake42b31a51998-03-27 05:16:10 +0000483 $idx = make_str_index_entry($3,
Fred Drakec9a44381998-03-17 06:29:13 +0000484 "<tt>$function_name()</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000485 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000486 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000487 }
488 "<dl><dt>$return_type <b>$idx</b>"
Fred Drake42b31a51998-03-27 05:16:10 +0000489 . "(<var>$arg_list</var>)\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000490}
491
492sub do_env_ctypedesc{
493 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000494 my $type_name = ('');
495 my $cfuncdesc_rx = "$next_pair_rx";
Fred Drake6659c301998-03-03 22:02:19 +0000496 if (/$cfuncdesc_rx/o) {
497 $type_name = "$2";
Fred Drake42b31a51998-03-27 05:16:10 +0000498 $idx = make_str_index_entry($1,
Fred Drake6659c301998-03-03 22:02:19 +0000499 "<tt>$type_name</tt>" . &get_indexsubitem);
500 $idx =~ s/ \(.*\)//;
501 }
Fred Drake42b31a51998-03-27 05:16:10 +0000502 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000503}
504
505sub do_env_cvardesc{
506 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000507 my($var_type,$var_name,$idx) = ('', '', '');
508 my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000509 if (/$cfuncdesc_rx/o) {
510 $var_type = "$2";
511 $var_name = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000512 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000513 "<tt>$var_name</tt>" . &get_indexsubitem);
514 $idx =~ s/ \(.*\)//;
515 }
516 "<dl><dt>$var_type <b>$idx</b>\n"
Fred Drake42b31a51998-03-27 05:16:10 +0000517 . "<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000518}
519
520sub do_env_funcdesc{
521 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000522 my($function_name,$arg_list,$idx) = ('', '', '');
523 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000524 if (/$funcdesc_rx/o) {
525 $function_name = "$2";
526 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000527 $idx = make_str_index_entry($3, "<tt>$function_name()</tt>"
Fred Drakec9a44381998-03-17 06:29:13 +0000528 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000529 $idx =~ s/ \(.*\)//;
Fred Drakec9a44381998-03-17 06:29:13 +0000530 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000531 }
Fred Drake42b31a51998-03-27 05:16:10 +0000532 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000533}
534
535sub do_env_funcdescni{
536 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000537 my($function_name,$arg_list,$idx) = ('', '', '');
538 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000539 if (/$funcdesc_rx/o) {
540 $function_name = "$2";
541 $arg_list = "$4";
542 if ($STRIP_INDEX_TT) {
Fred Drakec9a44381998-03-17 06:29:13 +0000543 $idx = "$function_name"; }
Fred Drake6659c301998-03-03 22:02:19 +0000544 else {
545 $idx = "<tt>$function_name</tt>"; }
546 }
Fred Drake42b31a51998-03-27 05:16:10 +0000547 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000548}
549
550sub do_cmd_funcline{
551 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000552 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drake6659c301998-03-03 22:02:19 +0000553
Fred Drakec9a44381998-03-17 06:29:13 +0000554 s/$next_pair_pr_rx//o;
555 my $function_name = $2;
556 s/$next_pair_pr_rx//o;
557 my($br_id,$arg_list) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000558 my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>"
559 . &get_indexsubitem);
Fred Drakec9a44381998-03-17 06:29:13 +0000560 $idx =~ s/\(\)//;
Fred Drake6659c301998-03-03 22:02:19 +0000561
562 "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
563}
564
565# Change this flag to index the opcode entries. I don't think it's very
566# useful to index them, since they're only presented to describe the dis
567# module.
568#
569$INDEX_OPCODES = 0;
570
571sub do_env_opcodedesc{
572 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000573 my($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000574 my $opcodedesc_rx = "$next_pair_rx$any_next_pair_rx3";
Fred Drake6659c301998-03-03 22:02:19 +0000575 if (/$opcodedesc_rx/o) {
576 $opcode_name = "$2";
577 $arg_list = "$4";
578 if ($INDEX_OPCODES) {
Fred Drake42b31a51998-03-27 05:16:10 +0000579 $idx = make_str_index_entry($3,
Fred Drake6659c301998-03-03 22:02:19 +0000580 "<tt>$opcode_name</tt> (byte code instruction)");
581 $idx =~ s/ \(byte code instruction\)//;
582 }
583 else {
584 $idx = "<tt>$opcode_name</tt>";
585 }
586 }
587 $stuff = "<dl><dt><b>$idx</b>";
588 if ($arg_list) {
589 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
590 }
Fred Drake42b31a51998-03-27 05:16:10 +0000591 $stuff . "\n<dd>$'</dl>";
Fred Drake6659c301998-03-03 22:02:19 +0000592}
593
594sub do_env_datadesc{
595 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000596 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000597 if (/$next_pair_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000598 $idx = make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000599 $idx =~ s/ \(.*\)//;
600 }
Fred Drake42b31a51998-03-27 05:16:10 +0000601 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000602}
603
604sub do_env_datadescni{
605 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000606 my $idx = '';
Fred Drake6659c301998-03-03 22:02:19 +0000607 if (/$next_pair_rx/o) {
608 if ($STRING_INDEX_TT) {
609 $idx = "$2"; }
610 else {
611 $idx = "<tt>$2</tt>"; }
612 }
Fred Drake42b31a51998-03-27 05:16:10 +0000613 "<dl><dt><b>$idx</b>\n<dd>$'</dl>"
Fred Drake6659c301998-03-03 22:02:19 +0000614}
615
616sub do_cmd_dataline{
617 local($_) = @_;
618
619 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000620 my($br_id, $data_name) = ($1, $2);
Fred Drake42b31a51998-03-27 05:16:10 +0000621 my $idx = make_str_index_entry($br_id, "<tt>$data_name</tt>"
622 . &get_indexsubitem);
Fred Drake6659c301998-03-03 22:02:19 +0000623 $idx =~ s/ \(.*\)//;
624
Fred Drake42b31a51998-03-27 05:16:10 +0000625 "<dt><b>$idx</b><dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000626}
627
Fred Drake42b31a51998-03-27 05:16:10 +0000628sub do_env_excdesc{
629 local($_) = @_;
630 /$next_pair_rx/o;
631 my($br_id,$excname,$rest) = ($1, $2, $');
632 my $idx = make_str_index_entry($br_id,
633 "<tt>$excname</tt> (exception in $THIS_MODULE)");
634 $idx =~ s/ \(.*\)//;
635 "<dl><dt><b>$idx</b>\n<dd>$rest</dl>"
636}
637
638sub do_env_fulllineitems{ do_env_itemize(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000639
640
Fred Drakec9a44381998-03-17 06:29:13 +0000641sub do_env_classdesc{
642 local($_) = @_;
Fred Drake42b31a51998-03-27 05:16:10 +0000643 my($class_name,$arg_list,$idx) = ('', '', '');
Fred Drakec9a44381998-03-17 06:29:13 +0000644 my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3";
645 if (/$funcdesc_rx/o) {
Fred Drake42b31a51998-03-27 05:16:10 +0000646 $class_name = "$2";
Fred Drakec9a44381998-03-17 06:29:13 +0000647 $arg_list = "$4";
Fred Drake42b31a51998-03-27 05:16:10 +0000648 $THIS_CLASS = $class_name;
649 $idx = make_str_index_entry($3,
650 "<tt>$class_name</tt> (class in $THIS_MODULE)" );
Fred Drakec9a44381998-03-17 06:29:13 +0000651 $idx =~ s/ \(.*\)//;
652 }
Fred Drake42b31a51998-03-27 05:16:10 +0000653 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
Fred Drakec9a44381998-03-17 06:29:13 +0000654}
655
Fred Drake42b31a51998-03-27 05:16:10 +0000656
657sub do_env_methoddesc{
658 local($_) = @_;
659 my($class_name,$arg_list,$idx,$extra);
660 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
661 # require the argument to be there.
662 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
663 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
664 if (/$funcdesc_rx/o) {
665 $class_name = $2;
666 $class_name = $THIS_CLASS
667 unless $class_name;
668 $method_name = $4;
669 $arg_list = $6;
670 if ($class_name) {
671 $extra = " ($class_name method)";
672 }
673 $idx = make_str_index_entry($3, "<tt>$method_name()</tt>$extra");
674 $idx =~ s/ \(.*\)//;
675 $idx =~ s/\(\)//;
676 }
677 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
678}
679
680
681sub do_env_methoddescni{
682 local($_) = @_;
683 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
684 # require the argument to be there.
685 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
686 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
687 /$funcdesc_rx/o;
688 my $method = $4;
689 my $arg_list = $6;
690 "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>$'</dl>";
691}
692
693
694sub do_env_memberdesc{
695 local($_) = @_;
696 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
697 # require the argument to be there.
698 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
699 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5";
700 /$funcdesc_rx/o;
701 my($class,$member,$arg_list) = ($2, $4, $6);
702 $class = $THIS_CLASS
703 unless $class;
704 $extra = " ($class_name attribute)"
705 if $class;
706 my $idx = make_str_index_entry($3, "<tt>$member()</tt>$extra");
707 $idx =~ s/ \(.*\)//;
708 $idx =~ s/\(\)//;
709 "<dl><dt><b>$idx</b>\n<dd>$'</dl>";
710}
711
712
713sub do_env_memberdescni{
714 local($_) = @_;
715 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
716 # require the argument to be there.
717 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
718 my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3";
719 /$funcdesc_rx/o;
720 my $member = $4;
721 "<dl><dt><b>$member</b>\n<dd>$'</dl>";
722}
723
724
Fred Drake6659c301998-03-03 22:02:19 +0000725@col_aligns = ("<td>", "<td>", "<td>");
726
727sub setup_column_alignments{
728 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000729 my($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_);
730 my($th1,$th2,$th3) = ('<th>', '<th>', '<th>');
Fred Drake6659c301998-03-03 22:02:19 +0000731 $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>");
732 $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>");
733 $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>");
734 # return the aligned header start tags; only used for \begin{tableiii?}
735 $th1 = (($a1 eq "l") ? "<th align=left>"
736 : ($a1 eq "r" ? "<th align=right>" : "<th>"));
737 $th2 = (($a2 eq "l") ? "<th align=left>"
738 : ($a2 eq "r" ? "<th align=right>" : "<th>"));
739 $th3 = (($a3 eq "l") ? "<th align=left>"
740 : ($a3 eq "r" ? "<th align=right>" : "<th>"));
741 ($th1, $th2, $th3);
742}
743
744sub do_env_tableii{
745 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000746 my($font,$h1,$h2) = ('', '', '');
747 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000748 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7";
749 if (/$tableiii_rx/o) {
750 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000751 $font = ''
752 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000753 $h1 = $6;
754 $h2 = $8;
755 }
Fred Drake42b31a51998-03-27 05:16:10 +0000756 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000757 $globals{"lineifont"} = $font;
758 "<table border align=center>"
759 . "\n <tr>$th1<b>$h1</b></th>"
760 . "\n $th2<b>$h2</b></th>$'"
761 . "\n</table>";
762}
763
764sub do_cmd_lineii{
765 local($_) = @_;
766 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000767 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000768 s/$next_pair_pr_rx//o;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000769 my($c2,$font,$efont) = ($2, $globals{"lineifont"}, '');
770 if ($font) {
771 $font = "<$font>";
772 $efont = "</$font>";
773 }
Fred Drakec9a44381998-03-17 06:29:13 +0000774 my($c1align,$c2align) = @col_aligns[0,1];
Fred Drake58b2bfd1998-04-02 20:14:04 +0000775 "<tr>$c1align$font$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000776 . " $c2align$c2</td>$'";
777}
778
779sub do_env_tableiii{
780 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000781 my($font,$h1,$h2,$h3) = ('', '', '', '');
Fred Drake6659c301998-03-03 22:02:19 +0000782
Fred Drakec9a44381998-03-17 06:29:13 +0000783 my $tableiii_rx =
Fred Drake6659c301998-03-03 22:02:19 +0000784 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"
785 . "$any_next_pair_rx9";
786 if (/$tableiii_rx/o) {
787 $font = $4;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000788 $font = ''
789 if ($font eq 'textrm');
Fred Drake6659c301998-03-03 22:02:19 +0000790 $h1 = $6;
791 $h2 = $8;
792 $h3 = $10;
793 }
Fred Drake42b31a51998-03-27 05:16:10 +0000794 my($th1,$th2,$th3) = setup_column_alignments($2);
Fred Drake6659c301998-03-03 22:02:19 +0000795 $globals{"lineifont"} = $font;
796 "<table border align=center>"
797 . "\n <tr>$th1<b>$h1</b></th>"
798 . "\n $th2<b>$h2</b></th>"
799 . "\n $th3<b>$h3</b></th>$'"
800 . "\n</table>";
801}
802
803sub do_cmd_lineiii{
804 local($_) = @_;
805 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000806 my $c1 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000807 s/$next_pair_pr_rx//o;
Fred Drakec9a44381998-03-17 06:29:13 +0000808 my $c2 = $2;
Fred Drake6659c301998-03-03 22:02:19 +0000809 s/$next_pair_pr_rx//o;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000810 my($c3,$font,$efont) = ($2, $globals{"lineifont"}, '');
811 if ($font) {
812 $font = "<$font>";
813 $efont = "</$font>";
814 }
Fred Drakec9a44381998-03-17 06:29:13 +0000815 my($c1align, $c2align, $c3align) = @col_aligns;
Fred Drake58b2bfd1998-04-02 20:14:04 +0000816 "<tr>$c1align$font$c1$efont</td>\n"
Fred Drake6659c301998-03-03 22:02:19 +0000817 . " $c2align$c2</td>\n"
818 . " $c3align$c3</td>$'";
819}
820
821sub do_env_seealso{
822 "<p><b>See Also:</b></p>\n" . @_[0];
823}
824
825sub do_cmd_seemodule{
826 # Insert the right magic to jump to the module definition. This should
827 # work most of the time, at least for repeat builds....
828 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000829 my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
830 my $any_next_pair_pr_rx5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
831 # Predefined $opt_arg_rx & $optional_arg_rx don't work because they
832 # require the argument to be there.
833 my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?";
834 s/$opt_arg_rx$any_next_pair_pr_rx3$any_next_pair_pr_rx5//;
835 my($key,$module,$text) = ($2, $4, $6);
836 $key = $module unless $key;
Fred Drakeb3c9bca1998-03-06 21:20:08 +0000837 "<p>Module <tt><b><a href=\"module-$key.html\">$module</a></b></tt>"
Fred Drake6659c301998-03-03 22:02:19 +0000838 . "&nbsp;&nbsp;&nbsp;($text)</p>"
839 . $_;
840}
841
842sub do_cmd_seetext{
843 "<p>" . @_[0];
844}
845
846
847sub do_cmd_maketitle {
848 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000849 my $the_title = '';
Fred Drake6659c301998-03-03 22:02:19 +0000850 if ($t_title) {
Fred Drakec9a44381998-03-17 06:29:13 +0000851 $the_title .= "<h1 align=center>$t_title</h1>";
Fred Drake6659c301998-03-03 22:02:19 +0000852 } else { &write_warnings("\nThis document has no title."); }
Fred Drakec9a44381998-03-17 06:29:13 +0000853 $the_title .= "\n<center>";
Fred Drake6659c301998-03-03 22:02:19 +0000854 if ($t_author) {
855 if ($t_authorURL) {
Fred Drakec9a44381998-03-17 06:29:13 +0000856 my $href = &translate_commands($t_authorURL);
Fred Drake6659c301998-03-03 22:02:19 +0000857 $href = &make_named_href('author', $href, "<strong>${t_author}</strong>");
Fred Drakec9a44381998-03-17 06:29:13 +0000858 $the_title .= "\n<p>$href</p>";
Fred Drake6659c301998-03-03 22:02:19 +0000859 } else {
Fred Drakec9a44381998-03-17 06:29:13 +0000860 $the_title .= "\n<p><strong>$t_author</strong></p>";
Fred Drake6659c301998-03-03 22:02:19 +0000861 }
862 } else { &write_warnings("\nThere is no author for this document."); }
863 if ($t_institute) {
Fred Drakec9a44381998-03-17 06:29:13 +0000864 $the_title .= "\n<p>$t_institute</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000865 if ($AUTHOR_ADDRESS) {
Fred Drakec9a44381998-03-17 06:29:13 +0000866 $the_title .= "\n<p>$AUTHOR_ADDRESS</p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000867 if ($t_affil) {
Fred Drakec9a44381998-03-17 06:29:13 +0000868 $the_title .= "\n<p><i>$t_affil</i></p>";}
Fred Drake6659c301998-03-03 22:02:19 +0000869 if ($t_date) {
Fred Drakec9a44381998-03-17 06:29:13 +0000870 $the_title .= "\n<p><strong>$t_date</strong>";
Fred Drake6659c301998-03-03 22:02:19 +0000871 if ($PYTHON_VERSION) {
872 $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";}
873 $the_title .= "</p>"
874 }
Fred Drakec9a44381998-03-17 06:29:13 +0000875 $the_title .= "\n</center>";
Fred Drake6659c301998-03-03 22:02:19 +0000876 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +0000877 $the_title .= "\n<p>$t_address</p>";
878 } else { $the_title .= "\n<p>"}
Fred Drake6659c301998-03-03 22:02:19 +0000879 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +0000880 $the_title .= "\n<p>$t_email</p>";
881 }# else { $the_title .= "</p>" }
882 $the_title . "<hr>\n" . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +0000883}
884
885
Fred Drake42b31a51998-03-27 05:16:10 +0000886# sub do_cmd_indexlabel{
887# "genindex" . @_[0];
888# }
Fred Drakec9a44381998-03-17 06:29:13 +0000889
Fred Drakefc16e781998-03-12 21:03:26 +0000890
891# These are located down here since they screw up fontlock. -- used to.
Fred Drake6659c301998-03-03 22:02:19 +0000892
893sub do_cmd_file{
894 # This uses a weird HTML construct to adjust the font to be
895 # reasonable match that used in the printed form as much as
896 # possible. The expected behavior is that a browser that doesn't
897 # understand "<font face=...>" markup will use courier (or whatever
898 # the font is for <tt>).
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
904sub do_cmd_samp{
905 local($_) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000906 s|$next_pair_pr_rx|\"<tt>\2</tt>\"|;
Fred Drake6659c301998-03-03 22:02:19 +0000907 $_;
908}
909
9101; # This must be the last line