-
Notifications
You must be signed in to change notification settings - Fork 0
/
sbmlfaq.perl
289 lines (251 loc) · 9.75 KB
/
sbmlfaq.perl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# Description : cekarticle.perl
# Author(s) : Michael Hucka <mhucka@@cds.caltech.edu>
# Organization: CDS, California Institute of Technology
# Created : 2000-09-27 16:57 PDT
# Revision : $Id$
# $Source$
#
# Based on cekarticle.perl which I wrote and which was in turn originally
# based on article.perl by Ross Moore <[email protected]> 09-14-97
package main;
&do_require_package('article');
&do_require_package('array');
&do_require_package('alltt');
&do_require_package('booktabs');
&do_require_package('verbatim');
&do_require_package('color');
&do_require_package('graphicx');
&do_require_package('html');
&do_require_package('hyperref');
&do_require_package('natbib');
&do_require_package('listings');
#-----------------------------------------------------------------------------
# Stuff from basic article.perl/article.cls.
#-----------------------------------------------------------------------------
sub do_cekarticle_a4paper{}
sub do_cekarticle_a5paper{}
sub do_cekarticle_b5paper{}
sub do_cekarticle_legalpaper{}
sub do_cekarticle_letterpaper{}
sub do_cekarticle_executivepaper{}
sub do_cekarticle_landscape{}
sub do_cekarticle_final{}
sub do_cekarticle_draft{}
sub do_cekarticle_oneside{}
sub do_cekarticle_twoside{}
sub do_cekarticle_openright{}
sub do_cekarticle_openany{}
sub do_cekarticle_onecolumn{}
sub do_cekarticle_twocolumn{}
sub do_cekarticle_notitlepage{}
sub do_cekarticle_titlepage{}
sub do_cekarticle_openbib{}
sub do_cekarticle_10pt{ $LATEX_FONT_SIZE = '10pt' unless $LATEX_FONT_SIZE; }
sub do_cekarticle_11pt{ $LATEX_FONT_SIZE = '11pt' unless $LATEX_FONT_SIZE; }
sub do_cekarticle_12pt{ $LATEX_FONT_SIZE = '12pt' unless $LATEX_FONT_SIZE; }
sub do_cekarticle_leqno{ $EQN_TAGS = 'L'; }
sub do_cekarticle_reqno{ $EQN_TAGS = 'R'; }
sub do_cekarticle_fleqn{ $FLUSH_EQN = 1; }
sub do_cmd_thesection {
join('', &do_cmd_arabic("${O}0${C}section${O}0$C"), @_[0]) }
sub do_cmd_thesubsection {
join('',&translate_commands("\\thesection")
,".", &do_cmd_arabic("${O}0${C}subsection${O}0$C"), @_[0]) }
sub do_cmd_thesubsubsection {
join('',&translate_commands("\\thesubsection")
,"." , &do_cmd_arabic("${O}0${C}subsubsection${O}0$C"), @_[0]) }
sub do_cmd_theparagraph {
join('',&translate_commands("\\thesubsubsection")
,"." , &do_cmd_arabic("${O}0${C}paragraph${O}0$C"), @_[0]) }
sub do_cmd_thesubparagraph {
join('',&translate_commands("\\theparagraph")
,"." , &do_cmd_arabic("${O}0${C}subparagraph${O}0$C"), @_[0]) }
sub do_cmd_theequation {
join('', &do_cmd_arabic("${O}0${C}equation${O}0$C"), @_[0]) }
sub do_cmd_thefootnote {
join('', &do_cmd_arabic("${O}0${C}footnote${O}0$C"), @_[0]) }
sub do_cmd_thefigure {
join('', &do_cmd_arabic("${O}0${C}figure${O}0$C"), @_[0]) }
sub do_cmd_thetable {
join('', &do_cmd_arabic("${O}0${C}table${O}0$C"), @_[0]) }
#-----------------------------------------------------------------------------
# Additions for cekarticle.cls
#-----------------------------------------------------------------------------
$notoc = 0;
# Run this directly in order to get a white background in latex2html.
&apply_body_options("BGCOLOR", "ffffff");
sub do_cekarticle_toc{}
sub do_cekarticle_notoc{ $notoc++; }
sub do_cmd_attrib { &styled_text_chunk('TT','','font','','', '', @_); }
sub do_cmd_attribtype { &styled_text_chunk('TT','','font','','', '', @_); }
sub do_cmd_attribvalue { &styled_text_chunk('TT','','font','','', '', @_); }
sub do_cmd_class { &styled_text_chunk('TT','','font','','', '', @_); }
# There must be more direct ways of making \toprule etc be essentially
# ignored, but this is the best I could do without spending more time on it.
sub do_cmd_toprule {
local($_) = @_;
&ignore_numeric_argument;
local($pre,$post) = &minimize_open_tags('');
join('',$pre,$_);
}
sub do_cmd_midrule {
local($_) = @_;
&ignore_numeric_argument;
local($pre,$post) = &minimize_open_tags('');
join('',$pre,$_);
}
sub do_cmd_bottomrule {
local($_) = @_;
&ignore_numeric_argument;
local($pre,$post) = &minimize_open_tags('');
join('',$pre,$_);
}
sub do_cmd_tightspacing {
local($_) = @_;
&ignore_numeric_argument;
local($pre,$post) = &minimize_open_tags('<BR>');
join('',$pre,$_);
}
sub do_cmd_regularspacing {
local($_) = @_;
&ignore_numeric_argument;
local($pre,$post) = &minimize_open_tags('');
join('',$pre,$_);
}
# Titlepage stuff.
# latex2html base code already defines do_cmd_{title,author,address}.
# A version of the each of the following is defined by the latex2html base
# code, but it produces a mailto: link. We don't want that because we put
# multiple email addresses in \email{}.
sub do_cmd_authoremail {
local($_) = @_;
&get_next_optional_argument;
local($next);
$next = &missing_braces unless (
(s/$next_pair_pr_rx/$next = $2;''/eo)
||(s/$next_pair_rx/$next = $2;''/eo));
($t_email) = &translate_commands($next);
$_;
}
sub do_cmd_acknowledge {
local($_) = @_;
&get_next_optional_argument;
local($next);
$next = &missing_braces unless (
(s/$next_pair_pr_rx/$next = $2;''/eo)
||(s/$next_pair_rx/$next = $2;''/eo));
($t_acknowledge) = &simplify(&translate_commands($next));
$_;
}
# This redefines the do_cmd_maketitlepage() from the latex2html base code in
# order to handle our specialized constructs and layout.
sub do_cmd_maketitlepage {
local($_) = @_;
local($the_title) = '';
local($alignc, $alignl);
if ($HTML_VERSION > 2.1) {
$alignc = " ALIGN=\"CENTER\"";
$alignl = " ALIGN=\"LEFT\"";
}
if ($t_title) {
$the_title .= "<H1$alignc>$t_title</H1>\n";
} else { &write_warnings("\nThis document has no title."); }
if ($t_author) {
if ($t_authorURL) {
local($href) = &translate_commands($t_authorURL);
$href = &make_named_href('author'
, $href, "<STRONG>${t_author}</STRONG>");
$the_title .= "\n<P$alignc>$href</P>";
} else {
$the_title .= "\n<P$alignc><STRONG>$t_author</STRONG></P>";
}
} else { &write_warnings("\nThere is no author for this document."); }
if ($t_email&&!($t_email=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><TT>$t_email</TT></P>";}
if ($t_affil&&!($t_affil=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><I>$t_affil</I></P>";}
if ($t_address&&!($t_address=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><SMALL>$t_address</SMALL></P>";}
if ($t_acknowledge&&!($t_acknowledge=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><SMALL>$t_acknowledge</SMALL></P>";}
if ($t_date&&!($t_date=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><STRONG>$t_date</STRONG></P>";}
# Add the table of contents.
# FIXME: this should test for $notoc
$_ .= $the_title;
$_ .= &do_cmd_tableofcontents();
}
# This redefines the do_cmd_maketitle() from the latex2html base code in
# order to handle our specialized constructs and layout. This is basically
# identical to do_cmd_maketitlepage, but doesn't insert a table of contents.
sub do_cmd_maketitle {
local($_) = @_;
local($the_title) = '';
local($alignc, $alignl);
if ($HTML_VERSION > 2.1) {
$alignc = " ALIGN=\"CENTER\"";
$alignl = " ALIGN=\"LEFT\"";
}
if ($t_title) {
$the_title .= "<HR NOSHADE>\n<H1$alignc>$t_title</H1>\n<HR NOSHADE>";
} else { &write_warnings("\nThis document has no title."); }
if ($t_author) {
if ($t_authorURL) {
local($href) = &translate_commands($t_authorURL);
$href = &make_named_href('author'
, $href, "<STRONG>${t_author}</STRONG>");
$the_title .= "\n<P$alignc>$href</P>";
} else {
$the_title .= "\n<P$alignc><STRONG>$t_author</STRONG></P>";
}
} else { &write_warnings("\nThere is no author for this document."); }
if ($t_email&&!($t_email=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><TT>$t_email</TT></P>";}
if ($t_affil&&!($t_affil=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><I>$t_affil</I></P>";}
if ($t_address&&!($t_address=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><SMALL>$t_address</SMALL></P>";}
if ($t_acknowledge&&!($t_acknowledge=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><SMALL>$t_acknowledge</SMALL></P>";}
if ($t_date&&!($t_date=~/^\s*(($O|$OP)\d+($C|$CP))\s*\1\s*$/)) {
$the_title .= "\n<P$alignc><STRONG>$t_date</STRONG></P>";}
# Add the table of contents.
# FIXME: this should test for $notoc
$_ .= $the_title;
}
# Misc. commands.
sub do_cmd_texttrademark { join('', '™', $_[0]); }
# FIXME: the next one doesn't actually work.
sub do_cmd_textsuperscript {
local($_) = @_;
local($next);
$next = &missing_braces
unless ( (s/$next_pair_pr_rx/$next = $2;''/eo)
|| (s/$next_pair_rx/$next = $2;''/eo)
);
($next) = &translate_commands($next);
"<SUP>$text</SUP>" . $_;
}
# Some additional commands for hyperref commands that apparently aren't
# provided in latex2html's hyperref bindings.
# 2003-07-27 <[email protected]> Pulled from html.perl v1.38
sub do_cmd_href{
local($_) = @_;
local($text, $url, $href);
local($name, $dummy) = &get_next_optional_argument;
$text = &missing_braces unless
((s/$next_pair_pr_rx/$url = $2; ''/eo)
||(s/$next_pair_rx/$url = $2; ''/eo));
$url = &missing_braces unless
((s/$next_pair_pr_rx/$text = $2; ''/eo)
||(s/$next_pair_rx/$text = $2; ''/eo));
$*=1; s/^\s+/\n/; $*=0;
if ($name) { $href = &make_named_href($name,$url,$text) }
else { $href = &make_href($url,$text) }
print "\nHREF:$href" if ($VERBOSITY > 3);
join ('',$href,$_);
}
#-----------------------------------------------------------------------------
# End of file.
#-----------------------------------------------------------------------------
1; # Must be last line