blob: 2ea09e6476767925954e608c6d16e3b79307d84a [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($_) = @_;
31 s/$any_next_pair_pr_rx//;
32 $PYTHON_VERSION = "$2";
33 $_;
34}
35
36sub do_cmd_authoraddress{
37 local($_) = @_;
38 s/$any_next_pair_pr_rx//;
39 $AUTHOR_ADDRESS = "$2";
40 $_;
41}
42
43sub do_cmd_hackscore{
44 local($_) = @_;
45 s/$any_next_pair_pr_rx/_/;
46 $_;
47}
48
49sub do_cmd_optional{
50 local($_) = @_;
51 s/$any_next_pair_pr_rx/<\/var><big>\[<\/big><var>\2<\/var><big>\]<\/big><var>/;
52 $_;
53}
54
55sub do_cmd_varvars{
56 local($_) = @_;
57 s/$any_next_pair_pr_rx/<var>\2<\/var>/;
58 $_;
59}
60
61# texinfo-like formatting commands: \code{...} etc.
62
63sub do_cmd_code{
64 local($_) = @_;
65 s/$any_next_pair_pr_rx/<tt>\2<\/tt>/;
66 $_;
67}
68
69sub do_cmd_sectcode{ &do_cmd_code(@_); }
70sub do_cmd_module{ &do_cmd_code(@_); }
71sub do_cmd_keyword{ &do_cmd_code(@_); }
72sub do_cmd_exception{ &do_cmd_code(@_); }
73sub do_cmd_class{ &do_cmd_code(@_); }
74sub do_cmd_function{ &do_cmd_code(@_); }
75sub do_cmd_constant{ &do_cmd_code(@_); }
76sub do_cmd_member{ &do_cmd_code(@_); }
77sub do_cmd_method{ &do_cmd_code(@_); }
78sub do_cmd_email{ &do_cmd_code(@_); }
79sub do_cmd_program{ &do_cmd_code(@_); }
80sub do_cmd_cfunction{ &do_cmd_code(@_); }
81sub do_cmd_cdata{ &do_cmd_code(@_); }
82sub do_cmd_ctype{ &do_cmd_code(@_); }
83
84sub do_cmd_email{
85 local($_) = @_;
86 s/$any_next_pair_pr_rx/<tt><font face=sans-serif>\2<\/font><\/tt>/;
87 $_;
88}
89
90sub do_cmd_url{
91 # use the URL as both text and hyperlink
92 local($_) = @_;
93 s/$any_next_pair_pr_rx//;
94 local($url) = $2;
95 $url =~ s/~/&#126;/g;
96 "<tt><font face=sans-serif><a href=\"$url\">$url</a></font></tt>" . $_;
97}
98
99sub do_cmd_manpage{
100 # two parameters: \manpage{name}{section}
101 local($_) = @_;
102 local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
103 s/$next_pair_pr_rx$any_next_pair_pr_rx3/<i>\2<\/i>(\4)/;
104 $_;
105}
106
107sub do_cmd_rfc{
108 local($_) = @_;
109 s/$next_pair_pr_rx//;
110 local($br_id,$rfcnumber) = ($1, $2);
111
112 # Save the reference
113 local($nstr) = &gen_index_id("RFC!RFC $rfcnumber", '');
114 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
115 "<a name=\"$br_id\">RFC $rfcnumber<\/a>" .$_;
116}
117
118sub do_cmd_kbd{
119 local($_) = @_;
120 s/$any_next_pair_pr_rx/<kbd>\2<\/kbd>/;
121 $_;
122}
123
124sub do_cmd_key{
125 local($_) = @_;
126 s/$any_next_pair_pr_rx/<tt>\2<\/tt>/;
127 $_;
128}
129
130sub do_cmd_var{
131 local($_) = @_;
132 s/$any_next_pair_pr_rx/<i>\2<\/i>/;
133 $_;
134}
135
136sub do_cmd_dfn{
137 local($_) = @_;
138 s/$any_next_pair_pr_rx/<i>\2<\/i>/;
139 $_;
140}
141
142sub do_cmd_emph{
143 local($_) = @_;
144 s/$any_next_pair_pr_rx/<i>\2<\/i>/;
145 $_;
146}
147
148sub do_cmd_strong{
149 local($_) = @_;
150 s/$any_next_pair_pr_rx/<b>\2<\/b>/;
151 $_;
152}
153
154sub do_cmd_deprecated{
155 # two parameters: \deprecated{version}{whattodo}
156 local($_) = @_;
157 local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
158 local($release,$action) = ($2, $4);
159 s/$next_pair_pr_rx$any_next_pair_pr_rx3//;
160 "<b>Deprecated since release $release.</b>"
161 . "\n$action<p>"
162 . $_;
163}
164
165# file and samp are at the end of this file since they screw up fontlock.
166
167# index commands
168
169$INDEX_SUBITEM = "";
170
171sub get_indexsubitem{
172 $INDEX_SUBITEM ? " $INDEX_SUBITEM" : '';
173}
174
175sub do_cmd_setindexsubitem{
176 local($_) = @_;
177 s/$any_next_pair_pr_rx//;
178 $INDEX_SUBITEM = $2;
179 $_;
180}
181
182sub do_cmd_indexii{
183 local($_) = @_;
184 s/$next_pair_pr_rx//o;
185 local($br_id1, $str1) = ($1, $2);
186 s/$next_pair_pr_rx//o;
187 local($br_id2, $str2) = ($1, $2);
188 join('', &make_index_entry($br_id1, "$str1 $str2"),
189 &make_index_entry($br_id2, "$str2, $str1"), $_);
190}
191
192sub do_cmd_indexiii{
193 local($_) = @_;
194 s/$next_pair_pr_rx//o;
195 local($br_id1, $str1) = ($1, $2);
196 s/$next_pair_pr_rx//o;
197 local($br_id2, $str2) = ($1, $2);
198 s/$next_pair_pr_rx//o;
199 local($br_id3, $str3) = ($1, $2);
200 join('', &make_index_entry($br_id1, "$str1 $str2 $str3"),
201 &make_index_entry($br_id2, "$str2 $str3, $str1"),
202 &make_index_entry($br_id3, "$str3, $str1 $str2"),
203 $_);
204}
205
206sub do_cmd_indexiv{
207 local($_) = @_;
208 s/$next_pair_pr_rx//o;
209 local($br_id1, $str1) = ($1, $2);
210 s/$next_pair_pr_rx//o;
211 local($br_id2, $str2) = ($1, $2);
212 s/$next_pair_pr_rx//o;
213 local($br_id3, $str3) = ($1, $2);
214 s/$next_pair_pr_rx//o;
215 local($br_id4, $str4) = ($1, $2);
216 join('', &make_index_entry($br_id1, "$str1 $str2 $str3 $str4"),
217 &make_index_entry($br_id2, "$str2 $str3 $str4, $str1"),
218 &make_index_entry($br_id3, "$str3 $str4, $str1 $str2"),
219 &make_index_entry($br_id4, "$str4, $str1 $str2 $str3"),
220 $_);
221}
222
223sub do_cmd_ttindex{ &do_cmd_index(@_); }
224
225sub my_typed_index_helper{
226 local($word, $_) = @_;
227 s/$next_pair_pr_rx//o;
228 local($br_id, $str) = ($1, $2);
229 join('', &make_index_entry($br_id, "$str $word"),
230 &make_index_entry($br_id, "$word, $str"), $_);
231}
232
233sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
234sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
235sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
236sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
237
238sub my_parword_index_helper{
239 local($word, $_) = @_;
240 s/$next_pair_pr_rx//o;
241 local($br_id, $str) = ($1, $2);
242 &make_index_entry($br_id, "$str ($word)") . $_;
243}
244
245
246# Set this to true to strip out the <tt>...</tt> from index entries;
247# this is analogous to using the second definition of \idxcode{} from
248# myformat.sty.
249#
250# It is used from &make_mod_index_entry() and &make_str_index_entry().
251#
252$STRIP_INDEX_TT = 0;
253
254sub make_mod_index_entry{
255 local($br_id,$str,$define) = @_;
256 local($halfref) = &make_half_href("$CURRENT_FILE#$br_id");
257 # If TITLE is not yet available (i.e the \index command is in the title
258 # of the current section), use $ref_before.
259 $TITLE = $ref_before unless $TITLE;
260 # Save the reference
261 if ($define eq "DEF") {
262 local($nstr,$garbage) = split / /, $str, 2;
263 $Modules{$nstr} .= $halfref;
264 }
265 $str = &gen_index_id($str, $define);
266 if ($STRIP_INDEX_TT) {
267 $str =~ s/<tt>(.*)<\/tt>/\1/;
268 }
269 $index{$str} .= $halfref;
270 "<a name=\"$br_id\">$anchor_invisible_mark<\/a>";
271}
272
273sub my_module_index_helper{
274 local($word, $_) = @_;
275 s/$next_pair_pr_rx[\n]*//o;
276 local($br_id, $str) = ($1, $2);
277 local($section_tag) = join('', @curr_sec_id);
278 $word = "$word " if $word;
279 &make_mod_index_entry("SECTION$section_tag",
280 "<tt>$str</tt> (${word}module)", 'DEF');
281 $_;
282}
283
284sub ref_module_index_helper{
285 local($word, $_) = @_;
286 s/$next_pair_pr_rx//o;
287 local($br_id, $str) = ($1, $2);
288 $word = "$word " if $word;
289 &make_mod_index_entry($br_id, "<tt>$str</tt> (${word}module)", 'REF') . $_;
290}
291
292sub do_cmd_bifuncindex{ &my_parword_index_helper('built-in function', @_); }
293sub do_cmd_modindex{ &my_module_index_helper('', @_); }
294sub do_cmd_bimodindex{ &my_module_index_helper('built-in', @_); }
295sub do_cmd_exmodindex{ &my_module_index_helper('extension', @_); }
296sub do_cmd_stmodindex{ &my_module_index_helper('standard', @_); }
297
298# these should be adjusted a bit....
299sub do_cmd_refmodindex{ &ref_module_index_helper('', @_); }
300sub do_cmd_refbimodindex{ &ref_module_index_helper('built-in', @_); }
301sub do_cmd_refexmodindex{ &ref_module_index_helper('extension', @_); }
302sub do_cmd_refstmodindex{ &ref_module_index_helper('standard', @_); }
303
304sub do_cmd_nodename{ &do_cmd_label(@_); }
305
306sub init_myformat{
307 # XXX need some way for this to be called after &initialise; ???
308 $anchor_mark = '';
309 $icons{'anchor_mark'} = '';
310 # <<2>>...<<2>>
311 $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
312 $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
313 $any_next_pair_rx7 = "$O(\\d+)$C([\\s\\S]*)$O\\7$C";
314 $any_next_pair_rx9 = "$O(\\d+)$C([\\s\\S]*)$O\\9$C";
315 # <#2#>...<#2#>
316 $any_next_pair_pr_rx_3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
317 $any_next_pair_pr_rx_5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
318 $any_next_pair_pr_rx_7 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP";
319 $any_next_pair_pr_rx_9 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP";
Fred Drake2da947a1998-03-04 05:30:49 +0000320# if (defined &process_commands_wrap_deferred) {
321# &process_commands_wrap_deferred(<<THESE_COMMANDS);
322# indexii # {} # {}
323# indexiii # {} # {} # {}
324# indexiv # {} # {} # {} # {}
325# exindex # {}
326# obindex # {}
327# opindex # {}
328# stindex # {}
329# ttindex # {}
330# bifuncindex # {}
331# modindex # {}
332# bimodindex # {}
333# exmodindex # {}
334# stmodindex # {}
335# refmodindex # {}
336# refbimodindex # {}
337# refexmodindex # {}
338# refstmodindex # {}
339# rfc # {}
340# THESE_COMMANDS
341# }
Fred Drake6659c301998-03-03 22:02:19 +0000342}
343
344&init_myformat;
345
346# similar to make_index_entry(), but includes the string in the result
347# instead of the dummy filler.
348#
349sub make_str_index_entry{
350 local($br_id,$str) = @_;
351 # If TITLE is not yet available (i.e the \index command is in the title
352 # of the current section), use $ref_before.
353 $TITLE = $ref_before unless $TITLE;
354 # Save the reference
355 local($nstr) = &gen_index_id($str, '');
356 if ($STRIP_INDEX_TT) {
357 $nstr =~ s/<tt>(.*)<\/tt>/\1/;
358 }
359 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
360 "<a name=\"$br_id\">$str<\/a>";
361}
362
363# Changed from the stock version to indent {verbatim} sections,
364# and make them smaller, to better match the LaTeX version:
365
366# (Used with LaTeX2HTML 96.1*)
367sub replace_verbatim {
368 # Modifies $_
369 local($prefix,$suffix) = ("\n<p><dl><dd><pre><font size=-1>\n",
370 "</font></pre></dl>");
371 s/$verbatim_mark(verbatim)(\d+)/$prefix$verbatim{$2}$suffix/go;
372 s/$verbatim_mark(rawhtml)(\d+)/$verbatim{$2}/ego; # Raw HTML
373}
374
375# (Used with LaTeX2HTML 98.1)
376sub replace_verbatim_hook{
377 # Modifies $_
378 local($prefix,$suffix) = ("\n<p><dl><dd><font size=-1>",
379 "</font></dl>");
380 s/$math_verbatim_rx/&put_comment("MATH: ".$verbatim{$1})/eg;
381 s/$verbatim_mark(\w*[vV]erbatim\*?)(\d+)\#/$prefix$verbatim{$2}$suffix/go;
382 # Raw HTML, but replacements may have protected characters
383 s/$verbatim_mark(rawhtml)(\d+)#/&unprotect_raw_html($verbatim{$2})/eg;
384 s/$verbatim_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
385 s/$unfinished_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX
386}
387
388sub do_env_cfuncdesc{
389 local($_) = @_;
390 local($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
391 local($cfuncdesc_rx) =
392 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
393 if (/$cfuncdesc_rx/o) {
394 $return_type = "$2";
395 $function_name = "$4";
396 $arg_list = "$6";
397 $idx = &make_str_index_entry($3,
398 "<tt>$function_name</tt>" . &get_indexsubitem);
399 $idx =~ s/ \(.*\)//;
400 }
401 "<dl><dt>$return_type <b>$idx</b>"
402 . "(<var>$arg_list</var>)\n<dd>$'\n</dl>"
403}
404
405sub do_env_ctypedesc{
406 local($_) = @_;
407 local($type_name) = ('');
408 local($cfuncdesc_rx) = "$next_pair_rx";
409 if (/$cfuncdesc_rx/o) {
410 $type_name = "$2";
411 $idx = &make_str_index_entry($1,
412 "<tt>$type_name</tt>" . &get_indexsubitem);
413 $idx =~ s/ \(.*\)//;
414 }
415 "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
416}
417
418sub do_env_cvardesc{
419 local($_) = @_;
420 local($var_type,$var_name,$idx) = ('', '', '');
421 local($cfuncdesc_rx) = "$next_pair_rx$any_next_pair_rx3";
422 if (/$cfuncdesc_rx/o) {
423 $var_type = "$2";
424 $var_name = "$4";
425 $idx = &make_str_index_entry($3,
426 "<tt>$var_name</tt>" . &get_indexsubitem);
427 $idx =~ s/ \(.*\)//;
428 }
429 "<dl><dt>$var_type <b>$idx</b>\n"
430 . "<dd>$'\n</dl>";
431}
432
433sub do_env_funcdesc{
434 local($_) = @_;
435 local($function_name,$arg_list,$idx) = ('', '', '');
436 local($funcdesc_rx) = "$next_pair_rx$any_next_pair_rx3";
437 if (/$funcdesc_rx/o) {
438 $function_name = "$2";
439 $arg_list = "$4";
440 $idx = &make_str_index_entry($3,
441 "<tt>$function_name</tt>" . &get_indexsubitem);
442 $idx =~ s/ \(.*\)//;
443 }
444 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'\n</dl>";
445}
446
447sub do_env_funcdescni{
448 local($_) = @_;
449 local($function_name,$arg_list,$idx) = ('', '', '');
450 local($funcdesc_rx) = "$next_pair_rx$any_next_pair_rx3";
451 if (/$funcdesc_rx/o) {
452 $function_name = "$2";
453 $arg_list = "$4";
454 if ($STRIP_INDEX_TT) {
455 $idx = $function_name; }
456 else {
457 $idx = "<tt>$function_name</tt>"; }
458 }
459 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'\n</dl>";
460}
461
462sub do_cmd_funcline{
463 local($_) = @_;
464 local($funcdesc_rx) = "$next_pair_pr_rx$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
465
466 s/$funcdesc_rx//o;
467 local($br_id, $function_name, $arg_list) = ($3, $2, $4);
468 local($idx) = &make_str_index_entry($br_id, "<tt>$function_name</tt>");
469
470 "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
471}
472
473# Change this flag to index the opcode entries. I don't think it's very
474# useful to index them, since they're only presented to describe the dis
475# module.
476#
477$INDEX_OPCODES = 0;
478
479sub do_env_opcodedesc{
480 local($_) = @_;
481 local($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
482 local($opcodedesc_rx) = "$next_pair_rx$any_next_pair_rx3";
483 if (/$opcodedesc_rx/o) {
484 $opcode_name = "$2";
485 $arg_list = "$4";
486 if ($INDEX_OPCODES) {
487 $idx = &make_str_index_entry($3,
488 "<tt>$opcode_name</tt> (byte code instruction)");
489 $idx =~ s/ \(byte code instruction\)//;
490 }
491 else {
492 $idx = "<tt>$opcode_name</tt>";
493 }
494 }
495 $stuff = "<dl><dt><b>$idx</b>";
496 if ($arg_list) {
497 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
498 }
499 $stuff . "\n<dd>$'\n</dl>";
500}
501
502sub do_env_datadesc{
503 local($_) = @_;
504 local($idx) = '';
505 if (/$next_pair_rx/o) {
506 $idx = &make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
507 $idx =~ s/ \(.*\)//;
508 }
509 "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
510}
511
512sub do_env_datadescni{
513 local($_) = @_;
514 local($idx) = '';
515 if (/$next_pair_rx/o) {
516 if ($STRING_INDEX_TT) {
517 $idx = "$2"; }
518 else {
519 $idx = "<tt>$2</tt>"; }
520 }
521 "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
522}
523
524sub do_cmd_dataline{
525 local($_) = @_;
526
527 s/$next_pair_pr_rx//o;
528 local($br_id, $data_name) = ($1, $2);
529 local($idx) = &make_str_index_entry($br_id, "<tt>$data_name</tt>"
530 . &get_indexsubitem);
531 $idx =~ s/ \(.*\)//;
532
533 "<dt><b>$idx</b>\n<dd>" . $_;
534}
535
536sub do_env_excdesc{ &do_env_datadesc(@_); }
537sub do_env_classdesc{ &do_env_funcdesc(@_); }
538sub do_env_fulllineitems{ &do_env_itemize(@_); }
539
540
541@col_aligns = ("<td>", "<td>", "<td>");
542
543sub setup_column_alignments{
544 local($_) = @_;
545 local($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_);
546 local($th1,$th2,$th3) = ('<th>', '<th>', '<th>');
547 $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>");
548 $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>");
549 $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>");
550 # return the aligned header start tags; only used for \begin{tableiii?}
551 $th1 = (($a1 eq "l") ? "<th align=left>"
552 : ($a1 eq "r" ? "<th align=right>" : "<th>"));
553 $th2 = (($a2 eq "l") ? "<th align=left>"
554 : ($a2 eq "r" ? "<th align=right>" : "<th>"));
555 $th3 = (($a3 eq "l") ? "<th align=left>"
556 : ($a3 eq "r" ? "<th align=right>" : "<th>"));
557 ($th1, $th2, $th3);
558}
559
560sub do_env_tableii{
561 local($_) = @_;
562 local($font,$h1,$h2) = ('', '', '');
563 local($tableiii_rx) =
564 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7";
565 if (/$tableiii_rx/o) {
566 $font = $4;
567 $h1 = $6;
568 $h2 = $8;
569 }
570 local($th1,$th2,$th3) = &setup_column_alignments($2);
571 $globals{"lineifont"} = $font;
572 "<table border align=center>"
573 . "\n <tr>$th1<b>$h1</b></th>"
574 . "\n $th2<b>$h2</b></th>$'"
575 . "\n</table>";
576}
577
578sub do_cmd_lineii{
579 local($_) = @_;
580 s/$next_pair_pr_rx//o;
581 local($c1) = $2;
582 s/$next_pair_pr_rx//o;
583 local($c2) = $2;
584 local($font) = $globals{"lineifont"};
585 local($c1align, $c2align) = @col_aligns[0,1];
586 "<tr>$c1align<$font>$c1</$font></td>\n"
587 . " $c2align$c2</td>$'";
588}
589
590sub do_env_tableiii{
591 local($_) = @_;
592 local($font,$h1,$h2,$h3) = ('', '', '', '');
593
594 local($tableiii_rx) =
595 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"
596 . "$any_next_pair_rx9";
597 if (/$tableiii_rx/o) {
598 $font = $4;
599 $h1 = $6;
600 $h2 = $8;
601 $h3 = $10;
602 }
603 local($th1,$th2,$th3) = &setup_column_alignments($2);
604 $globals{"lineifont"} = $font;
605 "<table border align=center>"
606 . "\n <tr>$th1<b>$h1</b></th>"
607 . "\n $th2<b>$h2</b></th>"
608 . "\n $th3<b>$h3</b></th>$'"
609 . "\n</table>";
610}
611
612sub do_cmd_lineiii{
613 local($_) = @_;
614 s/$next_pair_pr_rx//o;
615 local($c1) = $2;
616 s/$next_pair_pr_rx//o;
617 local($c2) = $2;
618 s/$next_pair_pr_rx//o;
619 local($c3) = $2;
620 local($font) = $globals{"lineifont"};
621 local($c1align, $c2align, $c3align) = @col_aligns;
622 "<tr>$c1align<$font>$c1</$font></td>\n"
623 . " $c2align$c2</td>\n"
624 . " $c3align$c3</td>$'";
625}
626
627sub do_env_seealso{
628 "<p><b>See Also:</b></p>\n" . @_[0];
629}
630
631sub do_cmd_seemodule{
632 # Insert the right magic to jump to the module definition. This should
633 # work most of the time, at least for repeat builds....
634 local($_) = @_;
635 local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
636 s/$next_pair_pr_rx$any_next_pair_pr_rx3//;
637 local($module,$text,$node,$key) = ($2, $4, '', "module$2");
638 $key =~ s/_//g;
639 # XXX somewhat bogus computation of $node
640# $node = $external_labels{$key} unless
641# ($node = $ref_files{$key});
642 $node = $key;
643 "<p>Module <tt><b><a href=\"$node#$key\">$module</a></b></tt>"
644 . "&nbsp;&nbsp;&nbsp;($text)</p>"
645 . $_;
646}
647
648sub do_cmd_seetext{
649 "<p>" . @_[0];
650}
651
652
653sub do_cmd_maketitle {
654 local($_) = @_;
655 local($the_title) = '';
656 if ($t_title) {
657 $the_title .= "<h1 align=\"center\">$t_title</h1>";
658 } else { &write_warnings("\nThis document has no title."); }
659 if ($t_author) {
660 if ($t_authorURL) {
661 local($href) = &translate_commands($t_authorURL);
662 $href = &make_named_href('author', $href, "<strong>${t_author}</strong>");
663 $the_title .= "\n<p align=\"center\">$href</p>";
664 } else {
665 $the_title .= "\n<p align=\"center\"><strong>$t_author</strong></p>";
666 }
667 } else { &write_warnings("\nThere is no author for this document."); }
668 if ($t_institute) {
669 $the_title .= "\n<p align=\"center\"><small>$t_institute</small></p>";}
670 if ($AUTHOR_ADDRESS) {
671 $the_title .= "\n<p align=\"center\"><small>$AUTHOR_ADDRESS";
672 $the_title .= "</small></p>";}
673 if ($t_affil) {
674 $the_title .= "\n<p align=\"center\"><i>$t_affil</i></p>";}
675 if ($t_date) {
676 $the_title .= "\n<p align=\"center\"><strong>$t_date</strong>";
677 if ($PYTHON_VERSION) {
678 $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";}
679 $the_title .= "</p>"
680 }
681 if ($t_address) {
682 $the_title .= "<br>\n<p align=\"left\"><small>$t_address</small></p>";
683 } else { $the_title .= "\n<p align=\"left\">"}
684 if ($t_email) {
685 $the_title .= "\n<p align=\"left\"><small>$t_email</small></p>";
686 } else { $the_title .= "</p>" }
687 $the_title . "<p><hr>\n" . $_ ;
688}
689
690
691# These are located down here since they screw up fontlock.
692
693sub do_cmd_file{
694 # This uses a weird HTML construct to adjust the font to be
695 # reasonable match that used in the printed form as much as
696 # possible. The expected behavior is that a browser that doesn't
697 # understand "<font face=...>" markup will use courier (or whatever
698 # the font is for <tt>).
699 local($_) = @_;
Fred Drake2da947a1998-03-04 05:30:49 +0000700 s/$any_next_pair_pr_rx/\"<tt>\2<\/tt>\"/;
Fred Drake6659c301998-03-03 22:02:19 +0000701 $_;
702}
703
704sub do_cmd_samp{
705 local($_) = @_;
Fred Drake2da947a1998-03-04 05:30:49 +0000706 s/$any_next_pair_pr_rx/\"<tt>\2<\/tt>\"/;
Fred Drake6659c301998-03-03 22:02:19 +0000707 $_;
708}
709
7101; # This must be the last line