blob: bfb482144ff43ad3dc41f901462a378f6aea8b02 [file] [log] [blame]
Guido van Rossum9e93fb61994-01-25 20:06:09 +00001# myformat.perl by Guido van Rossum <guido@cwi.nl> 25 Jan 1994
2#
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
9package main;
10
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]); }
21sub do_cmd_C{ join('', 'C', @_[0]); }
Guido van Rossumb8b264b1994-08-12 13:13:50 +000022sub do_cmd_Cpp{ join('', 'C++', @_[0]); }
Guido van Rossum9e93fb61994-01-25 20:06:09 +000023sub do_cmd_EOF{ join('', 'EOF', @_[0]); }
24
25# texinfo-like formatting commands: \code{...} etc.
26
27sub do_cmd_code{
28 local($_) = @_;
29 s/(<#[0-9]+#>)(.*)(\1)/<CODE>\2<\/CODE>/;
30 $_;
31}
32
33sub do_cmd_kbd{
34 local($_) = @_;
35 s/(<#[0-9]+#>)(.*)(\1)/<KBD>\2<\/KBD>/;
36 $_;
37}
38
39sub do_cmd_key{
40 local($_) = @_;
41 s/(<#[0-9]+#>)(.*)(\1)/<TT>\2<\/TT>/;
42 $_;
43}
44
45sub do_cmd_samp{
46 local($_) = @_;
47 s/(<#[0-9]+#>)(.*)(\1)/`<SAMP>\2<\/SAMP>'/;
48 $_;
49}
50
51sub do_cmd_var{
52 local($_) = @_;
53 s/(<#[0-9]+#>)(.*)(\1)/<VAR>\2<\/VAR>/;
54 $_;
55}
56
57sub do_cmd_file{
58 local($_) = @_;
59 s/(<#[0-9]+#>)(.*)(\1)/`<CODE>\2<\/CODE>'/;
60 $_;
61}
62
63sub do_cmd_dfn{
64 local($_) = @_;
65 s/(<#[0-9]+#>)(.*)(\1)/<I><DFN>\2<\/DFN><\/I>/;
66 $_;
67}
68
69sub do_cmd_emph{
70 local($_) = @_;
71 s/(<#[0-9]+#>)(.*)(\1)/<EM>\2<\/EM>/;
72 $_;
73}
74
75sub do_cmd_strong{
76 local($_) = @_;
77 s/(<#[0-9]+#>)(.*)(\1)/<STRONG>\2<\/STRONG>/;
78 $_;
79}
80
81# index commands
82
83sub do_cmd_indexii{
84 local($_) = @_;
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"), $_);
91}
92
93sub do_cmd_indexiii{
94 local($_) = @_;
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"),
104 $_);
105}
106
107sub do_cmd_indexiv{
108 local($_) = @_;
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"),
121 $_);
122}
123
124sub do_cmd_ttindex{
125 &do_cmd_index(@_);
126}
127
128sub 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"), $_);
134}
135
136sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
137sub do_cmd_kwindex{ &my_typed_index_helper('keyword', @_); }
138sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
139sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
140sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
141
142sub 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)"), $_);
147}
148
149sub do_cmd_bifuncindex{ &my_parword_index_helper('built-in function', @_); }
150sub do_cmd_bimodindex{ &my_parword_index_helper('built-in module', @_); }
151sub do_cmd_bifuncindex{ &my_parword_index_helper('standard module', @_); }
152
1531; # This must be the last line