1 # myformat.perl by Guido van Rossum <guido@cwi.nl> 25 Jan 1994
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.
7 # XXX Not complete: \indexii etc.; \funcitem etc.
11 # \bcode and \ecode brackets around verbatim
13 sub do_cmd_bcode
{ @_[0]; }
14 sub do_cmd_ecode
{ @_[0]; }
16 # words typeset in a special way (not in HTML though)
18 sub do_cmd_ABC
{ join('', 'ABC', @_[0]); }
19 sub do_cmd_UNIX
{ join('', 'Unix', @_[0]); }
20 sub do_cmd_ASCII
{ join('', 'ASCII', @_[0]); }
21 sub do_cmd_C
{ join('', 'C', @_[0]); }
22 sub do_cmd_Cpp
{ join('', 'C++', @_[0]); }
23 sub do_cmd_EOF
{ join('', 'EOF', @_[0]); }
25 # texinfo-like formatting commands: \code{...} etc.
29 s/(<#[0-9]+#>)(.*)(\1)/<CODE>\2<\/CODE
>/;
35 s/(<#[0-9]+#>)(.*)(\1)/<KBD>\2<\/KBD
>/;
41 s/(<#[0-9]+#>)(.*)(\1)/<TT>\2<\/TT
>/;
47 s/(<#[0-9]+#>)(.*)(\1)/`<SAMP>\2<\/SAMP
>'/;
53 s/(<#[0-9]+#>)(.*)(\1)/<VAR>\2<\/VAR>/;
59 s/(<#[0-9]+#>)(.*)(\1)/`<CODE>\2<\/CODE>'/;
65 s/(<#[0-9]+#>)(.*)(\1)/<I><DFN>\2<\/DFN
><\
/I>/;
71 s/(<#[0-9]+#>)(.*)(\1)/<EM>\2<\/EM
>/;
77 s/(<#[0-9]+#>)(.*)(\1)/<STRONG>\2<\/STRONG
>/;
85 s/$next_pair_pr_rx//o;
86 local($br_id1, $str1) = ($1, $2);
87 s/$next_pair_pr_rx//o;
88 local($br_id2, $str2) = ($1, $2);
89 join('', &make_index_entry
($br_id1, "$str1 $str2"),
90 &make_index_entry
($br_id2, "$str2, $str1"), $_);
95 s/$next_pair_pr_rx//o;
96 local($br_id1, $str1) = ($1, $2);
97 s/$next_pair_pr_rx//o;
98 local($br_id2, $str2) = ($1, $2);
99 s/$next_pair_pr_rx//o;
100 local($br_id3, $str3) = ($1, $2);
101 join('', &make_index_entry
($br_id1, "$str1 $str2 $str3"),
102 &make_index_entry
($br_id2, "$str2 $str3, $str1"),
103 &make_index_entry
($br_id3, "$str3, $str1 $str2"),
109 s/$next_pair_pr_rx//o;
110 local($br_id1, $str1) = ($1, $2);
111 s/$next_pair_pr_rx//o;
112 local($br_id2, $str2) = ($1, $2);
113 s/$next_pair_pr_rx//o;
114 local($br_id3, $str3) = ($1, $2);
115 s/$next_pair_pr_rx//o;
116 local($br_id4, $str4) = ($1, $2);
117 join('', &make_index_entry
($br_id1, "$str1 $str2 $str3 $str4"),
118 &make_index_entry
($br_id2, "$str2 $str3 $str4, $str1"),
119 &make_index_entry
($br_id3, "$str3 $str4, $str1 $str2"),
120 &make_index_entry
($br_id4, "$str4, $str1 $str2 $str3"),
128 sub my_typed_index_helper
{
129 local($word, $_) = @_;
130 s/$next_pair_pr_rx//o;
131 local($br_id, $str) = ($1, $2);
132 join('', &make_index_entry
($br_id, "$str $word"),
133 &make_index_entry
($br_id, "$word, $str"), $_);
136 sub do_cmd_stindex
{ &my_typed_index_helper
('statement', @_); }
137 sub do_cmd_kwindex
{ &my_typed_index_helper
('keyword', @_); }
138 sub do_cmd_opindex
{ &my_typed_index_helper
('operator', @_); }
139 sub do_cmd_exindex
{ &my_typed_index_helper
('exception', @_); }
140 sub do_cmd_obindex
{ &my_typed_index_helper
('object', @_); }
142 sub my_parword_index_helper
{
143 local($word, $_) = @_;
144 s/$next_pair_pr_rx//o;
145 local($br_id, $str) = ($1, $2);
146 join('', &make_index_entry
($br_id, "$str ($word)"), $_);
149 sub do_cmd_bifuncindex
{ &my_parword_index_helper
('built-in function', @_); }
150 sub do_cmd_bimodindex
{ &my_parword_index_helper
('built-in module', @_); }
151 sub do_cmd_bifuncindex
{ &my_parword_index_helper
('standard module', @_); }
153 1; # This must be the last line