Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e93fb6

Browse files
committed
Support for latex2html (at version 0.5.1)
1 parent 23d1939 commit 9e93fb6

1 file changed

Lines changed: 152 additions & 0 deletions

File tree

Doc/myformat.perl

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# myformat.perl by Guido van Rossum <[email protected]> 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+
9+
package main;
10+
11+
# \bcode and \ecode brackets around verbatim
12+
13+
sub do_cmd_bcode{ @_[0]; }
14+
sub do_cmd_ecode{ @_[0]; }
15+
16+
# words typeset in a special way (not in HTML though)
17+
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_EOF{ join('', 'EOF', @_[0]); }
23+
24+
# texinfo-like formatting commands: \code{...} etc.
25+
26+
sub do_cmd_code{
27+
local($_) = @_;
28+
s/(<#[0-9]+#>)(.*)(\1)/<CODE>\2<\/CODE>/;
29+
$_;
30+
}
31+
32+
sub do_cmd_kbd{
33+
local($_) = @_;
34+
s/(<#[0-9]+#>)(.*)(\1)/<KBD>\2<\/KBD>/;
35+
$_;
36+
}
37+
38+
sub do_cmd_key{
39+
local($_) = @_;
40+
s/(<#[0-9]+#>)(.*)(\1)/<TT>\2<\/TT>/;
41+
$_;
42+
}
43+
44+
sub do_cmd_samp{
45+
local($_) = @_;
46+
s/(<#[0-9]+#>)(.*)(\1)/`<SAMP>\2<\/SAMP>'/;
47+
$_;
48+
}
49+
50+
sub do_cmd_var{
51+
local($_) = @_;
52+
s/(<#[0-9]+#>)(.*)(\1)/<VAR>\2<\/VAR>/;
53+
$_;
54+
}
55+
56+
sub do_cmd_file{
57+
local($_) = @_;
58+
s/(<#[0-9]+#>)(.*)(\1)/`<CODE>\2<\/CODE>'/;
59+
$_;
60+
}
61+
62+
sub do_cmd_dfn{
63+
local($_) = @_;
64+
s/(<#[0-9]+#>)(.*)(\1)/<I><DFN>\2<\/DFN><\/I>/;
65+
$_;
66+
}
67+
68+
sub do_cmd_emph{
69+
local($_) = @_;
70+
s/(<#[0-9]+#>)(.*)(\1)/<EM>\2<\/EM>/;
71+
$_;
72+
}
73+
74+
sub do_cmd_strong{
75+
local($_) = @_;
76+
s/(<#[0-9]+#>)(.*)(\1)/<STRONG>\2<\/STRONG>/;
77+
$_;
78+
}
79+
80+
# index commands
81+
82+
sub do_cmd_indexii{
83+
local($_) = @_;
84+
s/$next_pair_pr_rx//o;
85+
local($br_id1, $str1) = ($1, $2);
86+
s/$next_pair_pr_rx//o;
87+
local($br_id2, $str2) = ($1, $2);
88+
join('', &make_index_entry($br_id1, "$str1 $str2"),
89+
&make_index_entry($br_id2, "$str2, $str1"), $_);
90+
}
91+
92+
sub do_cmd_indexiii{
93+
local($_) = @_;
94+
s/$next_pair_pr_rx//o;
95+
local($br_id1, $str1) = ($1, $2);
96+
s/$next_pair_pr_rx//o;
97+
local($br_id2, $str2) = ($1, $2);
98+
s/$next_pair_pr_rx//o;
99+
local($br_id3, $str3) = ($1, $2);
100+
join('', &make_index_entry($br_id1, "$str1 $str2 $str3"),
101+
&make_index_entry($br_id2, "$str2 $str3, $str1"),
102+
&make_index_entry($br_id3, "$str3, $str1 $str2"),
103+
$_);
104+
}
105+
106+
sub do_cmd_indexiv{
107+
local($_) = @_;
108+
s/$next_pair_pr_rx//o;
109+
local($br_id1, $str1) = ($1, $2);
110+
s/$next_pair_pr_rx//o;
111+
local($br_id2, $str2) = ($1, $2);
112+
s/$next_pair_pr_rx//o;
113+
local($br_id3, $str3) = ($1, $2);
114+
s/$next_pair_pr_rx//o;
115+
local($br_id4, $str4) = ($1, $2);
116+
join('', &make_index_entry($br_id1, "$str1 $str2 $str3 $str4"),
117+
&make_index_entry($br_id2, "$str2 $str3 $str4, $str1"),
118+
&make_index_entry($br_id3, "$str3 $str4, $str1 $str2"),
119+
&make_index_entry($br_id4, "$str4, $str1 $str2 $str3"),
120+
$_);
121+
}
122+
123+
sub do_cmd_ttindex{
124+
&do_cmd_index(@_);
125+
}
126+
127+
sub my_typed_index_helper{
128+
local($word, $_) = @_;
129+
s/$next_pair_pr_rx//o;
130+
local($br_id, $str) = ($1, $2);
131+
join('', &make_index_entry($br_id, "$str $word"),
132+
&make_index_entry($br_id, "$word, $str"), $_);
133+
}
134+
135+
sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); }
136+
sub do_cmd_kwindex{ &my_typed_index_helper('keyword', @_); }
137+
sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); }
138+
sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); }
139+
sub do_cmd_obindex{ &my_typed_index_helper('object', @_); }
140+
141+
sub my_parword_index_helper{
142+
local($word, $_) = @_;
143+
s/$next_pair_pr_rx//o;
144+
local($br_id, $str) = ($1, $2);
145+
join('', &make_index_entry($br_id, "$str ($word)"), $_);
146+
}
147+
148+
sub do_cmd_bifuncindex{ &my_parword_index_helper('built-in function', @_); }
149+
sub do_cmd_bimodindex{ &my_parword_index_helper('built-in module', @_); }
150+
sub do_cmd_bifuncindex{ &my_parword_index_helper('standard module', @_); }
151+
152+
1; # This must be the last line

0 commit comments

Comments
 (0)