blob: 16de5158e88536260ffd01fe18596367413692af [file] [log] [blame]
Fred Drake8ca70061997-12-08 20:59:54 +00001# myformat.perl by Guido van Rossum <guido@cwi.nl> 25 Jan 1994 -*- perl -*-
Guido van Rossum9e93fb61994-01-25 20:06:09 +00002#
3# Extension to LaTeX2HTML for documents using myformat.sty.
4# Subroutines of the form do_cmd_<name> here define translations
5# for LaTeX commands \<name> defined in the corresponding .sty file.
6#
7# XXX Not complete: \indexii etc.; \funcitem etc.
8
Fred Drake44640221996-11-11 20:51:09 +00009package main;
Guido van Rossum9e93fb61994-01-25 20:06:09 +000010
11# \bcode and \ecode brackets around verbatim
12
13sub do_cmd_bcode{ @_[0]; }
14sub do_cmd_ecode{ @_[0]; }
15
16# words typeset in a special way (not in HTML though)
17
18sub do_cmd_ABC{ join('', 'ABC', @_[0]); }
19sub do_cmd_UNIX{ join('', 'Unix', @_[0]); }
20sub do_cmd_ASCII{ join('', 'ASCII', @_[0]); }
Fred Drakebceaf351998-01-22 16:13:44 +000021sub do_cmd_POSIX{ join('', 'POSIX', @_[0]); }
Guido van Rossum9e93fb61994-01-25 20:06:09 +000022sub do_cmd_C{ join('', 'C', @_[0]); }
Guido van Rossumb8b264b1994-08-12 13:13:50 +000023sub do_cmd_Cpp{ join('', 'C++', @_[0]); }
Guido van Rossum9e93fb61994-01-25 20:06:09 +000024sub do_cmd_EOF{ join('', 'EOF', @_[0]); }
Guido van Rossumd9a26ff1997-11-18 15:31:16 +000025sub do_cmd_NULL{ join('', 'NULL', @_[0]); }
Guido van Rossum9e93fb61994-01-25 20:06:09 +000026
Fred Drake3e1fe891996-11-11 23:03:36 +000027sub do_cmd_e{ local($_) = @_; '&#92;' . $_; }
Guido van Rossum9e93fb61994-01-25 20:06:09 +000028
Fred Drakec384d751996-11-11 16:04:35 +000029sub do_cmd_optional{
Guido van Rossum9e93fb61994-01-25 20:06:09 +000030 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +000031 s/$any_next_pair_pr_rx/<\/var><big>\[<\/big><var>\2<\/var><big>\]<\/big><var>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +000032 $_;
33}
34
Fred Drakec384d751996-11-11 16:04:35 +000035sub do_cmd_varvars{
36 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +000037 s/$any_next_pair_pr_rx/<var>\2<\/var>/;
Fred Drakec384d751996-11-11 16:04:35 +000038 $_;
39}
40
Fred Drake3e1fe891996-11-11 23:03:36 +000041# texinfo-like formatting commands: \code{...} etc.
42
Fred Drakec384d751996-11-11 16:04:35 +000043sub do_cmd_code{
44 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +000045 s/$any_next_pair_pr_rx/<code>\2<\/code>/;
Fred Drakec384d751996-11-11 16:04:35 +000046 $_;
47}
48
49sub do_cmd_sectcode{ &do_cmd_code(@_); }
Fred Drakebceaf351998-01-22 16:13:44 +000050sub do_cmd_module{ &do_cmd_code(@_); }
51sub do_cmd_keyword{ &do_cmd_code(@_); }
52sub do_cmd_exception{ &do_cmd_code(@_); }
53sub do_cmd_class{ &do_cmd_code(@_); }
54sub do_cmd_function{ &do_cmd_code(@_); }
55sub do_cmd_cfunction{ &do_cmd_code(@_); }
56sub do_cmd_constant{ &do_cmd_code(@_); }
57sub do_cmd_method{ &do_cmd_code(@_); }
58sub do_cmd_email{ &do_cmd_code(@_); }
59
60sub do_cmd_url{
61 # use the URL as both text and hyperlink
62 local($_) = @_;
63 s/$any_next_pair_pr_rx/<code><a href="\2">\2<\/a><\/code>/;
64 $_;
65}
66
67sub do_cmd_manpage{
68 # two parameters: \manpage{name}{section}
69 local($_) = @_;
70 local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
71 s/$next_pair_pr_rx$any_next_pair_pr_rx3/<em>\2<\/em>(\4)/;
72 $_;
73}
Fred Drakec384d751996-11-11 16:04:35 +000074
Fred Drake42543631998-02-10 22:11:07 +000075sub do_cmd_rfc{
76 local($_) = @_;
77 s/$next_pair_pr_rx//;
78 local($br_id,$rfcnumber) = ($1, $2);
79
80 # Save the reference
81 local($nstr) = &gen_index_id("RFC!RFC $rfcnumber", '');
82 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
83 "<a name=\"$br_id\">RFC $rfcnumber<\/a>" .$_;
84}
85
Guido van Rossum9e93fb61994-01-25 20:06:09 +000086sub do_cmd_kbd{
87 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +000088 s/$any_next_pair_pr_rx/<kbd>\2<\/kbd>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +000089 $_;
90}
91
92sub do_cmd_key{
93 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +000094 s/$any_next_pair_pr_rx/<tt>\2<\/tt>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +000095 $_;
96}
97
98sub do_cmd_var{
99 local($_) = @_;
Fred Drakebceaf351998-01-22 16:13:44 +0000100 s/$any_next_pair_pr_rx/<em>\2<\/em>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000101 $_;
102}
103
104sub do_cmd_dfn{
105 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +0000106 s/$any_next_pair_pr_rx/<i><dfn>\2<\/dfn><\/i>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000107 $_;
108}
109
110sub do_cmd_emph{
111 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +0000112 s/$any_next_pair_pr_rx/<em>\2<\/em>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000113 $_;
114}
115
116sub do_cmd_strong{
117 local($_) = @_;
Fred Drake1af9e791998-01-12 23:15:29 +0000118 s/$any_next_pair_pr_rx/<b>\2<\/b>/;
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000119 $_;
120}
121
Fred Drake7c4cba81997-12-03 19:45:08 +0000122# file and samp are at the end of this file since they screw up fontlock.
123
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000124# index commands
125
Fred Drake42543631998-02-10 22:11:07 +0000126$INDEX_SUBITEM = "";
127
128sub do_cmd_setindexsubitem{
129 local($_) = @_;
130 s/$any_next_pair_pr_rx//;
131 $INDEX_SUBITEM = $2;
132 $_;
133}
134
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000135sub do_cmd_indexii{
136 local($_) = @_;
137 s/$next_pair_pr_rx//o;
138 local($br_id1, $str1) = ($1, $2);
139 s/$next_pair_pr_rx//o;
140 local($br_id2, $str2) = ($1, $2);
141 join('', &make_index_entry($br_id1, "$str1 $str2"),
142 &make_index_entry($br_id2, "$str2, $str1"), $_);
143}
144
145sub do_cmd_indexiii{
146 local($_) = @_;
147 s/$next_pair_pr_rx//o;
148 local($br_id1, $str1) = ($1, $2);
149 s/$next_pair_pr_rx//o;
150 local($br_id2, $str2) = ($1, $2);
151 s/$next_pair_pr_rx//o;
152 local($br_id3, $str3) = ($1, $2);
153 join('', &make_index_entry($br_id1, "$str1 $str2 $str3"),
154 &make_index_entry($br_id2, "$str2 $str3, $str1"),
155 &make_index_entry($br_id3, "$str3, $str1 $str2"),
Fred Drake72df9bc1997-12-16 21:13:20 +0000156 $_);
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000157}
158
159sub do_cmd_indexiv{
160 local($_) = @_;
161 s/$next_pair_pr_rx//o;
162 local($br_id1, $str1) = ($1, $2);
163 s/$next_pair_pr_rx//o;
164 local($br_id2, $str2) = ($1, $2);
165 s/$next_pair_pr_rx//o;
166 local($br_id3, $str3) = ($1, $2);
167 s/$next_pair_pr_rx//o;
168 local($br_id4, $str4) = ($1, $2);
169 join('', &make_index_entry($br_id1, "$str1 $str2 $str3 $str4"),
170 &make_index_entry($br_id2, "$str2 $str3 $str4, $str1"),
171 &make_index_entry($br_id3, "$str3 $str4, $str1 $str2"),
172 &make_index_entry($br_id4, "$str4, $str1 $str2 $str3"),
Fred Drake72df9bc1997-12-16 21:13:20 +0000173 $_);
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000174}
175
176sub do_cmd_ttindex{
177 &do_cmd_index(@_);
178}
179
180sub my_typed_index_helper{
181 local($word, $_) = @_;
182 s/$next_pair_pr_rx//o;
183 local($br_id, $str) = ($1, $2);
184 join('', &make_index_entry($br_id, "$str $word"),
185 &make_index_entry($br_id, "$word, $str"), $_);
186}
187
188sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000189sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
190sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
191sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
192
193sub my_parword_index_helper{
194 local($word, $_) = @_;
195 s/$next_pair_pr_rx//o;
196 local($br_id, $str) = ($1, $2);
Fred Drake72df9bc1997-12-16 21:13:20 +0000197 &make_index_entry($br_id, "$str ($word)") . $_;
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000198}
199
Fred Drake42543631998-02-10 22:11:07 +0000200
201# Set this to true to strip out the <tt>...</tt> from index entries;
202# this is analogous to using the second definition of \idxcode{} from
203# myformat.sty.
204#
205# It is used from &make_mod_index_entry() and &make_str_index_entry().
206#
207$STRIP_INDEX_TT = 0;
208
Fred Drake84818d71997-12-17 02:59:39 +0000209sub make_mod_index_entry {
210 local($br_id,$str,$define) = @_;
Fred Drakeab0b65d1998-01-13 04:05:11 +0000211 local($halfref) = &make_half_href("$CURRENT_FILE#$br_id");
212 # If TITLE is not yet available (i.e the \index command is in the title
213 # of the current section), use $ref_before.
Fred Drake84818d71997-12-17 02:59:39 +0000214 $TITLE = $ref_before unless $TITLE;
215 # Save the reference
Fred Drakeab0b65d1998-01-13 04:05:11 +0000216 if ($define eq "DEF") {
217 local($nstr,$garbage) = split / /, $str, 2;
218 $Modules{$nstr} .= $halfref;
219 }
Fred Drake84818d71997-12-17 02:59:39 +0000220 $str = &gen_index_id($str, $define);
Fred Drake42543631998-02-10 22:11:07 +0000221 if ($STRIP_INDEX_TT) {
222 $str =~ s/<tt>(.*)<\/tt>/\1/;
223 }
Fred Drakeab0b65d1998-01-13 04:05:11 +0000224 $index{$str} .= $halfref;
Fred Drake8da9e6a1997-12-18 14:14:16 +0000225 "<a name=\"$br_id\">$anchor_invisible_mark<\/a>";
Fred Drake84818d71997-12-17 02:59:39 +0000226}
227
228sub my_module_index_helper{
229 local($word, $_, $define) = @_;
230 s/$next_pair_pr_rx//o;
231 local($br_id, $str) = ($1, $2);
232 &make_mod_index_entry($br_id, "<tt>$str</tt> ($word module)",
233 $define) . $_;
234}
235
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000236sub do_cmd_bifuncindex{ &my_parword_index_helper('built-in function', @_); }
Fred Drake84818d71997-12-17 02:59:39 +0000237sub do_cmd_bimodindex{ &my_module_index_helper('built-in', @_, 'DEF'); }
238sub do_cmd_stmodindex{ &my_module_index_helper('standard', @_, 'DEF'); }
Guido van Rossum9e93fb61994-01-25 20:06:09 +0000239
Fred Drake84818d71997-12-17 02:59:39 +0000240sub do_cmd_refbimodindex{ &my_module_index_helper('built-in', @_, 'REF'); }
241sub do_cmd_refstmodindex{ &my_module_index_helper('standard', @_, 'REF'); }
Fred Drake72df9bc1997-12-16 21:13:20 +0000242
Fred Drakec384d751996-11-11 16:04:35 +0000243sub do_cmd_nodename{ &do_cmd_label(@_); }
244
Fred Drake1af9e791998-01-12 23:15:29 +0000245sub init_myformat{
246 # XXX need some way for this to be called after &initialise;
247 # <<2>>...<<2>>
248 $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C";
249 $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C";
250 $any_next_pair_rx7 = "$O(\\d+)$C([\\s\\S]*)$O\\7$C";
251 $any_next_pair_rx9 = "$O(\\d+)$C([\\s\\S]*)$O\\9$C";
252 # <#2#>...<#2#>
253 $any_next_pair_pr_rx_3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
254 $any_next_pair_pr_rx_5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP";
255 $any_next_pair_pr_rx_7 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP";
256 $any_next_pair_pr_rx_9 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP";
257 $new_command{"indexsubitem"} = "";
258}
259
260&init_myformat;
Fred Drakec384d751996-11-11 16:04:35 +0000261
262sub get_indexsubitem{
263 local($result) = $new_command{"indexsubitem"};
264 #print "\nget_indexsubitem ==> $result\n";
Fred Drake9597daf1997-12-22 22:37:34 +0000265 $result ? " $result" : '';
Fred Drakec384d751996-11-11 16:04:35 +0000266}
267
Fred Drake84818d71997-12-17 02:59:39 +0000268# similar to make_index_entry(), but includes the string in the result
269# instead of the dummy filler.
270#
271sub make_str_index_entry {
272 local($br_id,$str) = @_;
273 # If TITLE is not yet available (i.e the \index command is in the title
274 # of the current section), use $ref_before.
275 $TITLE = $ref_before unless $TITLE;
276 # Save the reference
277 local($nstr) = &gen_index_id($str, '');
Fred Drake42543631998-02-10 22:11:07 +0000278 if ($STRIP_INDEX_TT) {
279 $nstr =~ s/<tt>(.*)<\/tt>/\1/;
280 }
Fred Drake84818d71997-12-17 02:59:39 +0000281 $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id");
282 "<a name=\"$br_id\">$str<\/a>";
283}
284
Fred Drake7a7480d1996-10-29 15:56:57 +0000285sub do_env_cfuncdesc{
286 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +0000287 local($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
Fred Drake7a7480d1996-10-29 15:56:57 +0000288 local($cfuncdesc_rx) =
Fred Drakec384d751996-11-11 16:04:35 +0000289 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
Fred Drake7a7480d1996-10-29 15:56:57 +0000290 if (/$cfuncdesc_rx/o) {
291 $return_type = "$2";
292 $function_name = "$4";
293 $arg_list = "$6";
Fred Drake7c4cba81997-12-03 19:45:08 +0000294 $idx = &make_str_index_entry($3,
Fred Drake42543631998-02-10 22:11:07 +0000295 "<tt>$function_name()</tt>" . &get_indexsubitem);
Fred Drake7a7480d1996-10-29 15:56:57 +0000296 }
Fred Drake1af9e791998-01-12 23:15:29 +0000297 "<dl><dt>$return_type <b>$idx</b>" .
Fred Drake7c4cba81997-12-03 19:45:08 +0000298 "(<var>$arg_list</var>)\n<dd>$'\n</dl>"
Fred Drake7a7480d1996-10-29 15:56:57 +0000299}
300
Fred Drake9dcc5a91997-10-13 22:04:17 +0000301sub do_env_ctypedesc{
302 local($_) = @_;
303 local($type_name) = ('');
304 local($cfuncdesc_rx) =
305 "$next_pair_rx";
Fred Drake9dcc5a91997-10-13 22:04:17 +0000306 if (/$cfuncdesc_rx/o) {
307 $type_name = "$2";
Fred Drake7c4cba81997-12-03 19:45:08 +0000308 $idx = &make_str_index_entry($1,
Fred Drake9597daf1997-12-22 22:37:34 +0000309 "<tt>$type_name</tt>" . &get_indexsubitem);
Fred Drake9dcc5a91997-10-13 22:04:17 +0000310 }
Fred Drake1af9e791998-01-12 23:15:29 +0000311 "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
Fred Drake9dcc5a91997-10-13 22:04:17 +0000312}
313
314sub do_env_cvardesc{
315 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +0000316 local($var_type,$var_name,$idx) = ('', '', '');
Fred Drake1af9e791998-01-12 23:15:29 +0000317 local($cfuncdesc_rx) = "$next_pair_rx$any_next_pair_rx3";
Fred Drake9dcc5a91997-10-13 22:04:17 +0000318 if (/$cfuncdesc_rx/o) {
319 $var_type = "$2";
320 $var_name = "$4";
Fred Drake9597daf1997-12-22 22:37:34 +0000321 $idx = &make_str_index_entry($3,"<tt>$var_name</tt>" . &get_indexsubitem);
Fred Drake9dcc5a91997-10-13 22:04:17 +0000322 }
Fred Drake1af9e791998-01-12 23:15:29 +0000323 "<dl><dt>$var_type <b>$idx</b>\n" .
Fred Drake7c4cba81997-12-03 19:45:08 +0000324 "<dd>$'\n</dl>";
Fred Drake9dcc5a91997-10-13 22:04:17 +0000325}
326
Fred Drakec384d751996-11-11 16:04:35 +0000327sub do_env_funcdesc{
328 local($_) = @_;
Fred Drake7c4cba81997-12-03 19:45:08 +0000329 local($function_name,$arg_list,$idx) = ('', '', '');
Fred Drakec384d751996-11-11 16:04:35 +0000330 local($funcdesc_rx) = "$next_pair_rx$any_next_pair_rx3";
Fred Drakec384d751996-11-11 16:04:35 +0000331 if (/$funcdesc_rx/o) {
332 $function_name = "$2";
333 $arg_list = "$4";
Fred Drake7c4cba81997-12-03 19:45:08 +0000334 $idx = &make_str_index_entry($3,
Fred Drake42543631998-02-10 22:11:07 +0000335 "<tt>$function_name()</tt>" . &get_indexsubitem);
Fred Drakec384d751996-11-11 16:04:35 +0000336 }
Fred Drake1af9e791998-01-12 23:15:29 +0000337 "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'\n</dl>";
338}
339
340sub do_cmd_funcline{
341 local($_) = @_;
342 local($funcdesc_rx) = "$next_pair_pr_rx$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
343
344 s/$funcdesc_rx//o;
345 local($br_id, $function_name, $arg_list) = ($3, $2, $4);
Fred Drake42543631998-02-10 22:11:07 +0000346 local($idx) = &make_str_index_entry($br_id, "<tt>$function_name()</tt>");
Fred Drake1af9e791998-01-12 23:15:29 +0000347
348 "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_;
Fred Drake7c4cba81997-12-03 19:45:08 +0000349}
350
351sub do_env_opcodedesc{
352 local($_) = @_;
353 local($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
354 local($opcodedesc_rx) = "$next_pair_rx$any_next_pair_rx3";
Fred Drake7c4cba81997-12-03 19:45:08 +0000355 if (/$opcodedesc_rx/o) {
356 $opcode_name = "$2";
357 $arg_list = "$4";
Fred Drake42543631998-02-10 22:11:07 +0000358# $idx = &make_str_index_entry($3,
359# "<tt>$opcode_name</tt> (byte code instruction)");
360# $idx =~ s/ \(byte code instruction\)//;
Fred Drake7c4cba81997-12-03 19:45:08 +0000361 }
Fred Drake1af9e791998-01-12 23:15:29 +0000362 $stuff = "<dl><dt><b>$idx</b>";
Fred Drake7c4cba81997-12-03 19:45:08 +0000363 if ($arg_list) {
Fred Drake301ad2e1998-01-22 18:14:39 +0000364 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
Fred Drake7c4cba81997-12-03 19:45:08 +0000365 }
366 $stuff . "\n<dd>$'\n</dl>";
Fred Drakec384d751996-11-11 16:04:35 +0000367}
368
369sub do_env_datadesc{
370 local($_) = @_;
Fred Drake301ad2e1998-01-22 18:14:39 +0000371 local($idx) = '';
372 if (/$next_pair_rx/o) {
373 $idx = &make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem);
Fred Drakec384d751996-11-11 16:04:35 +0000374 }
Fred Drake1af9e791998-01-12 23:15:29 +0000375 "<dl><dt><b>$idx</b>\n<dd>$'\n</dl>"
376}
377
378sub do_cmd_dataline{
379 local($_) = @_;
380
381 s/$next_pair_pr_rx//o;
382 local($br_id, $data_name) = ($1, $2);
383 local($idx) = &make_str_index_entry($br_id, "<tt>$data_name</tt>");
384
385 "<dt><b>$idx</b>\n<dd>" . $_;
Fred Drakec384d751996-11-11 16:04:35 +0000386}
387
388sub do_env_excdesc{ &do_env_datadesc(@_); }
389
Fred Drake9597daf1997-12-22 22:37:34 +0000390@col_aligns = ("<td>", "<td>", "<td>");
391
392sub setup_column_alignments{
393 local($_) = @_;
394 local($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_);
Fred Drake1af9e791998-01-12 23:15:29 +0000395 local($th1,$th2,$th3) = ('<th>', '<th>', '<th>');
Fred Drake9597daf1997-12-22 22:37:34 +0000396 $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>");
397 $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>");
398 $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>");
Fred Drake1af9e791998-01-12 23:15:29 +0000399 # return the aligned header start tags; only used for \begin{tableiii?}
400 $th1 = (($a1 eq "l") ? "<th align=left>"
401 : ($a1 eq "r" ? "<th align=right>" : "<th>"));
402 $th2 = (($a2 eq "l") ? "<th align=left>"
403 : ($a2 eq "r" ? "<th align=right>" : "<th>"));
404 $th3 = (($a3 eq "l") ? "<th align=left>"
405 : ($a3 eq "r" ? "<th align=right>" : "<th>"));
406 ($th1, $th2, $th3);
Fred Drake9597daf1997-12-22 22:37:34 +0000407}
408
409sub do_env_tableii{
410 local($_) = @_;
411 local($font,$h1,$h2) = ('', '', '');
412 local($tableiii_rx) =
413 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7";
Fred Drake9597daf1997-12-22 22:37:34 +0000414 if (/$tableiii_rx/o) {
Fred Drake9597daf1997-12-22 22:37:34 +0000415 $font = $4;
416 $h1 = $6;
417 $h2 = $8;
418 }
Fred Drake1af9e791998-01-12 23:15:29 +0000419 local($th1,$th2,$th3) = &setup_column_alignments($2);
Fred Drake9597daf1997-12-22 22:37:34 +0000420 $globals{"lineifont"} = $font;
Fred Drake1af9e791998-01-12 23:15:29 +0000421 "<table border align=center>\n <tr>$th1$h1</th>\n $th2$h2</th>$'\n"
Fred Drake9597daf1997-12-22 22:37:34 +0000422 . "</table>";
423}
424
425sub do_cmd_lineii{
426 local($_) = @_;
427 s/$next_pair_pr_rx//o;
428 local($c1) = $2;
429 s/$next_pair_pr_rx//o;
430 local($c2) = $2;
431 local($font) = $globals{"lineifont"};
432 local($c1align, $c2align) = @col_aligns[0,1];
433 "<tr>$c1align<$font>$c1</$font></td>\n"
434 . " $c2align$c2</td>$'";
435}
436
437sub do_env_tableiii{
438 local($_) = @_;
439 local($font,$h1,$h2,$h3) = ('', '', '', '');
Fred Drake1af9e791998-01-12 23:15:29 +0000440
Fred Drake9597daf1997-12-22 22:37:34 +0000441 local($tableiii_rx) =
442 "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"
443 . "$any_next_pair_rx9";
Fred Drake9597daf1997-12-22 22:37:34 +0000444 if (/$tableiii_rx/o) {
Fred Drake9597daf1997-12-22 22:37:34 +0000445 $font = $4;
446 $h1 = $6;
447 $h2 = $8;
448 $h3 = $10;
449 }
Fred Drake1af9e791998-01-12 23:15:29 +0000450 local($th1,$th2,$th3) = &setup_column_alignments($2);
Fred Drake9597daf1997-12-22 22:37:34 +0000451 $globals{"lineifont"} = $font;
Fred Drake1af9e791998-01-12 23:15:29 +0000452 "<table border align=center>\n <tr>$th1$h1</th>\n $th2$h2</th>"
453 . "\n $th3$h3</th>$'\n"
Fred Drake9597daf1997-12-22 22:37:34 +0000454 . "</table>";
455}
456
457sub do_cmd_lineiii{
458 local($_) = @_;
459 s/$next_pair_pr_rx//o;
460 local($c1) = $2;
461 s/$next_pair_pr_rx//o;
462 local($c2) = $2;
463 s/$next_pair_pr_rx//o;
464 local($c3) = $2;
465 local($font) = $globals{"lineifont"};
466 local($c1align, $c2align, $c3align) = @col_aligns;
467 "<tr>$c1align<$font>$c1</$font></td>\n"
468 . " $c2align$c2</td>\n"
469 . " $c3align$c3</td>$'";
470}
471
Fred Drake9dcc5a91997-10-13 22:04:17 +0000472sub do_env_seealso{
Fred Drakebceaf351998-01-22 16:13:44 +0000473 "<p><b>See Also:</b></p>\n" . @_[0];
Fred Drake9dcc5a91997-10-13 22:04:17 +0000474}
475
476sub do_cmd_seemodule{
477 local($_) = @_;
478 local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
Fred Drake7c4cba81997-12-03 19:45:08 +0000479 s/$next_pair_pr_rx$any_next_pair_pr_rx3/<p><code><b>\2<\/b><\/code> (\4)<\/p>/;
Fred Drake9dcc5a91997-10-13 22:04:17 +0000480 $_;
481}
482
483sub do_cmd_seetext{
Fred Drakebceaf351998-01-22 16:13:44 +0000484 "<p>" . @_[0];
Fred Drake9dcc5a91997-10-13 22:04:17 +0000485}
486
Fred Drake7c4cba81997-12-03 19:45:08 +0000487# These are located down here since they screw up fontlock.
488
489sub do_cmd_file{
490 local($_) = @_;
491 s/$any_next_pair_pr_rx/`<code>\2<\/code>'/;
492 $_;
493}
494
495sub do_cmd_samp{
496 local($_) = @_;
497 s/$any_next_pair_pr_rx/`<samp>\2<\/samp>'/;
498 $_;
499}
500
Guido van Rossum9e93fb61994-01-25 20:06:09 +00005011; # This must be the last line