blob: 890066ffc7caebf488c3d76b380508a11b0358df [file] [log] [blame]
Fred Drake6659c301998-03-03 22:02:19 +00001# python.perl by Fred L. Drake, Jr. <fdrake@acm.org> -*- perl -*-
2#
3# Heavily based on Guido van Rossum's myformat.perl (now obsolete).
4#
5# Extension to LaTeX2HTML for documents using myformat.sty.
6# Subroutines of the form do_cmd_<name> here define translations
7# for LaTeX commands \<name> defined in the corresponding .sty file.
8
9package main;
10
Fred Drake7a40c072000-10-02 14:43:38 +000011use File::Basename;
12
Fred Drake6659c301998-03-03 22:02:19 +000013
Fred Drake08932051998-04-17 02:15:42 +000014sub next_argument{
Fred Drakeccc62721999-01-05 22:16:29 +000015 my $param;
16 $param = missing_braces()
17 unless ((s/$next_pair_pr_rx/$param=$2;''/eo)
18 ||(s/$next_pair_rx/$param=$2;''/eo));
Fred Drake62e43691998-08-10 19:40:44 +000019 return $param;
Fred Drake08932051998-04-17 02:15:42 +000020}
21
22sub next_optional_argument{
23 my($param,$rx) = ('', "^\\s*(\\[([^]]*)\\])?");
Fred Drake5ccf3301998-04-17 20:04:09 +000024 s/$rx/$param=$2;''/eo;
Fred Drake62e43691998-08-10 19:40:44 +000025 return $param;
Fred Drake08932051998-04-17 02:15:42 +000026}
27
Fred Drake7a40c072000-10-02 14:43:38 +000028sub make_icon_filename($){
29 my($myname, $mydir, $myext) = fileparse(@_[0], '\..*');
30 chop $mydir;
31 if ($mydir eq '.') {
32 $mydir = $ICONSERVER;
33 }
34 $myext = ".$IMAGE_TYPE"
35 unless $myext;
36 return "$mydir$dd$myname$myext";
37}
38
Fred Drake7a40c072000-10-02 14:43:38 +000039sub get_link_icon($){
40 my $url = @_[0];
41 if ($OFF_SITE_LINK_ICON && ($url =~ /^[-a-zA-Z0-9.]+:/)) {
42 # absolute URL; assume it points off-site
43 my $icon = make_icon_filename($OFF_SITE_LINK_ICON);
44 return (" <img src='$icon'\n"
Fred Drake5f84c9b2000-10-03 06:05:25 +000045 . " border='0' class='offsitelink'"
46 . ($OFF_SITE_LINK_ICON_HEIGHT
47 ? " height='$OFF_SITE_LINK_ICON_HEIGHT'"
48 : '')
49 . ($OFF_SITE_LINK_ICON_WIDTH
50 ? " width='$OFF_SITE_LINK_ICON_WIDTH'"
51 : '')
52 . " alt='[off-site link]'\n"
Fred Drake7a40c072000-10-02 14:43:38 +000053 . " >");
54 }
55 return '';
56}
Fred Drakee16f6791998-05-15 04:28:37 +000057
58# This is a fairly simple hack; it supports \let when it is used to create
59# (or redefine) a macro to exactly be some other macro: \let\newname=\oldname.
Fred Drake5b73cdf1998-05-15 16:59:38 +000060# Many possible uses of \let aren't supported or aren't supported correctly.
Fred Drakee16f6791998-05-15 04:28:37 +000061#
62sub do_cmd_let{
63 local($_) = @_;
64 my $matched = 0;
Fred Drake7a4ad0f1998-05-15 13:45:54 +000065 s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
Fred Drakee16f6791998-05-15 04:28:37 +000066 if ($matched) {
67 my($new, $old) = ($1, $3);
68 eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }';
69 print "\ndefining handler for \\$new using \\$old\n";
70 }
Fred Drake7a4ad0f1998-05-15 13:45:54 +000071 else {
72 s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es;
73 if ($matched) {
74 my($new, $char) = ($1, $3);
75 eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }";
76 print "\ndefining handler for \\$new to insert '$char'\n";
77 }
78 else {
79 write_warnings("Could not interpret \\let construct...");
80 }
81 }
Fred Drake62e43691998-08-10 19:40:44 +000082 return $_;
Fred Drakee16f6791998-05-15 04:28:37 +000083}
84
85
Fred Drakec3fd45f2000-06-15 22:41:48 +000086# the older version of LaTeX2HTML we use doesn't support this, but we use it:
87
88sub do_cmd_textasciitilde{ '~' . @_[0]; }
89
90
Fred Drake6659c301998-03-03 22:02:19 +000091# words typeset in a special way (not in HTML though)
92
93sub do_cmd_ABC{ 'ABC' . @_[0]; }
94sub do_cmd_UNIX{ 'Unix'. @_[0]; }
95sub do_cmd_ASCII{ 'ASCII' . @_[0]; }
96sub do_cmd_POSIX{ 'POSIX' . @_[0]; }
97sub do_cmd_C{ 'C' . @_[0]; }
98sub do_cmd_Cpp{ 'C++' . @_[0]; }
99sub do_cmd_EOF{ 'EOF' . @_[0]; }
Fred Drakee15956b2000-04-03 04:51:13 +0000100sub do_cmd_NULL{ '<tt class="constant">NULL</tt>' . @_[0]; }
Fred Drake6659c301998-03-03 22:02:19 +0000101
102sub do_cmd_e{ '&#92;' . @_[0]; }
103
Fred Draked07868a1998-05-14 21:00:28 +0000104$DEVELOPER_ADDRESS = '';
Fred Drake3cdb89d2000-09-14 20:17:23 +0000105$SHORT_VERSION = '';
Fred Draked04592a2000-10-25 16:15:13 +0000106$PACKAGE_VERSION = '';
Fred Drake6659c301998-03-03 22:02:19 +0000107
Fred Draked04592a2000-10-25 16:15:13 +0000108sub do_cmd_version{ $PACKAGE_VERSION . @_[0]; }
Fred Drake3cdb89d2000-09-14 20:17:23 +0000109sub do_cmd_shortversion{ $SHORT_VERSION . @_[0]; }
Fred Drake6659c301998-03-03 22:02:19 +0000110sub do_cmd_release{
111 local($_) = @_;
Fred Draked04592a2000-10-25 16:15:13 +0000112 $PACKAGE_VERSION = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000113 return $_;
Fred Drake6659c301998-03-03 22:02:19 +0000114}
115
Fred Drake3cdb89d2000-09-14 20:17:23 +0000116sub do_cmd_setshortversion{
117 local($_) = @_;
118 $SHORT_VERSION = next_argument();
119 return $_;
120}
121
Fred Drake6659c301998-03-03 22:02:19 +0000122sub do_cmd_authoraddress{
123 local($_) = @_;
Fred Draked07868a1998-05-14 21:00:28 +0000124 $DEVELOPER_ADDRESS = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000125 return $_;
Fred Drake6659c301998-03-03 22:02:19 +0000126}
127
Fred Drakee16f6791998-05-15 04:28:37 +0000128#sub do_cmd_developer{ do_cmd_author(@_[0]); }
129#sub do_cmd_developers{ do_cmd_author(@_[0]); }
130#sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); }
Fred Draked07868a1998-05-14 21:00:28 +0000131
Fred Drake6659c301998-03-03 22:02:19 +0000132sub do_cmd_hackscore{
133 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000134 next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000135 return '_' . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000136}
137
Fred Drake08932051998-04-17 02:15:42 +0000138sub use_wrappers{
139 local($_,$before,$after) = @_;
140 my $stuff = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000141 return $before . $stuff . $after . $_;
Fred Drake08932051998-04-17 02:15:42 +0000142}
143
Fred Drake3cdb89d2000-09-14 20:17:23 +0000144$IN_DESC_HANDLER = 0;
Fred Drake6659c301998-03-03 22:02:19 +0000145sub do_cmd_optional{
Fred Drake3cdb89d2000-09-14 20:17:23 +0000146 if ($IN_DESC_HANDLER) {
147 return use_wrappers(@_[0], "</var><big>\[</big><var>",
148 "</var><big>\]</big><var>");
149 }
150 else {
151 return use_wrappers(@_[0], "<big>\[</big>", "<big>\]</big>");
152 }
Fred Drake6659c301998-03-03 22:02:19 +0000153}
154
Fred Drakec9a44381998-03-17 06:29:13 +0000155# Logical formatting (some based on texinfo), needs to be converted to
156# minimalist HTML. The "minimalist" is primarily to reduce the size of
157# output files for users that read them over the network rather than
158# from local repositories.
Fred Drake6659c301998-03-03 22:02:19 +0000159
Fred Drake2cafcbb1999-03-25 16:57:04 +0000160# \file and \samp are at the end of this file since they screw up fontlock.
161
Fred Drake2ff880e1999-02-05 18:31:29 +0000162sub do_cmd_pytype{ return @_[0]; }
Fred Drake3d5a04a2000-08-03 17:25:44 +0000163sub do_cmd_makevar{
164 return use_wrappers(@_[0], '<span class="makevar">', '</span>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000165sub do_cmd_code{
Fred Drakee15956b2000-04-03 04:51:13 +0000166 return use_wrappers(@_[0], '<code>', '</code>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000167sub do_cmd_module{
Fred Drakee15956b2000-04-03 04:51:13 +0000168 return use_wrappers(@_[0], '<tt class="module">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000169sub do_cmd_keyword{
Fred Drakee15956b2000-04-03 04:51:13 +0000170 return use_wrappers(@_[0], '<tt class="keyword">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000171sub do_cmd_exception{
Fred Drakee15956b2000-04-03 04:51:13 +0000172 return use_wrappers(@_[0], '<tt class="exception">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000173sub do_cmd_class{
Fred Drakee15956b2000-04-03 04:51:13 +0000174 return use_wrappers(@_[0], '<tt class="class">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000175sub do_cmd_function{
Fred Drakee15956b2000-04-03 04:51:13 +0000176 return use_wrappers(@_[0], '<tt class="function">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000177sub do_cmd_constant{
Fred Drakee15956b2000-04-03 04:51:13 +0000178 return use_wrappers(@_[0], '<tt class="constant">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000179sub do_cmd_member{
Fred Drakee15956b2000-04-03 04:51:13 +0000180 return use_wrappers(@_[0], '<tt class="member">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000181sub do_cmd_method{
Fred Drakee15956b2000-04-03 04:51:13 +0000182 return use_wrappers(@_[0], '<tt class="method">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000183sub do_cmd_cfunction{
Fred Drakee15956b2000-04-03 04:51:13 +0000184 return use_wrappers(@_[0], '<tt class="cfunction">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000185sub do_cmd_cdata{
Fred Drakee15956b2000-04-03 04:51:13 +0000186 return use_wrappers(@_[0], '<tt class="cdata">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000187sub do_cmd_ctype{
Fred Drakee15956b2000-04-03 04:51:13 +0000188 return use_wrappers(@_[0], '<tt class="ctype">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000189sub do_cmd_regexp{
Fred Drakee15956b2000-04-03 04:51:13 +0000190 return use_wrappers(@_[0], '<tt class="regexp">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000191sub do_cmd_character{
Fred Drakee15956b2000-04-03 04:51:13 +0000192 return use_wrappers(@_[0], '"<tt class="character">', '</tt>"'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000193sub do_cmd_program{
Fred Drakee15956b2000-04-03 04:51:13 +0000194 return use_wrappers(@_[0], '<b class="program">', '</b>'); }
Fred Drakec9f5fe01999-11-09 16:59:42 +0000195sub do_cmd_programopt{
196 return use_wrappers(@_[0], '<b class="programopt">', '</b>'); }
Fred Drake0cd60212000-04-11 18:46:59 +0000197sub do_cmd_longprogramopt{
198 # note that the --- will be later converted to -- by LaTeX2HTML
199 return use_wrappers(@_[0], '<b class="programopt">---', '</b>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000200sub do_cmd_email{
Fred Drakee15956b2000-04-03 04:51:13 +0000201 return use_wrappers(@_[0], '<span class="email">', '</span>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000202sub do_cmd_mimetype{
Fred Drakee15956b2000-04-03 04:51:13 +0000203 return use_wrappers(@_[0], '<span class="mimetype">', '</span>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000204sub do_cmd_var{
205 return use_wrappers(@_[0], "<var>", "</var>"); }
206sub do_cmd_dfn{
Fred Drakee15956b2000-04-03 04:51:13 +0000207 return use_wrappers(@_[0], '<i class="dfn">', '</i>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000208sub do_cmd_emph{
Fred Drake38178fd2000-09-22 17:05:04 +0000209 return use_wrappers(@_[0], '<i>', '</i>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000210sub do_cmd_file{
Fred Drake3d5a04a2000-08-03 17:25:44 +0000211 return use_wrappers(@_[0], '<span class="file">', '</span>'); }
Fred Drakef74e5b71999-04-28 14:58:49 +0000212sub do_cmd_filenq{
Fred Drakee15956b2000-04-03 04:51:13 +0000213 return do_cmd_file(@_[0]); }
Fred Drake90fdda51999-02-16 20:27:42 +0000214sub do_cmd_samp{
Fred Drakee15956b2000-04-03 04:51:13 +0000215 return use_wrappers(@_[0], '"<tt class="samp">', '</tt>"'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000216sub do_cmd_kbd{
217 return use_wrappers(@_[0], '<kbd>', '</kbd>'); }
218sub do_cmd_strong{
219 return use_wrappers(@_[0], '<b>', '</b>'); }
Fred Drake2cafcbb1999-03-25 16:57:04 +0000220sub do_cmd_textbf{
221 return use_wrappers(@_[0], '<b>', '</b>'); }
222sub do_cmd_textit{
223 return use_wrappers(@_[0], '<i>', '</i>'); }
224
Fred Drake3d5a04a2000-08-03 17:25:44 +0000225sub do_cmd_moreargs{
226 return '...' . @_[0]; }
227sub do_cmd_unspecified{
228 return '...' . @_[0]; }
229
Fred Drakec9a44381998-03-17 06:29:13 +0000230
Fred Drake25817041999-01-13 17:06:34 +0000231sub do_cmd_refmodule{
232 # Insert the right magic to jump to the module definition.
233 local($_) = @_;
234 my $key = next_optional_argument();
235 my $module = next_argument();
236 $key = $module
237 unless $key;
Fred Drakee15956b2000-04-03 04:51:13 +0000238 return "<tt class='module'><a href='module-$key.html'>$module</a></tt>"
239 . $_;
Fred Drake25817041999-01-13 17:06:34 +0000240}
241
Fred Drake1a7af391998-04-01 22:44:56 +0000242sub do_cmd_newsgroup{
243 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000244 my $newsgroup = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +0000245 my $icon = get_link_icon("news:$newsgroup");
Fred Drakeafc7ce12001-01-22 17:33:24 +0000246 my $stuff = "<a class='newsgroup' href='news:$newsgroup'>"
247 . "$newsgroup$icon</a>";
Fred Drake62e43691998-08-10 19:40:44 +0000248 return $stuff . $_;
Fred Drake1a7af391998-04-01 22:44:56 +0000249}
Fred Drakefc16e781998-03-12 21:03:26 +0000250
251sub do_cmd_envvar{
252 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000253 my $envvar = next_argument();
254 my($name,$aname,$ahref) = new_link_info();
Fred Drake166abba1998-04-08 23:10:54 +0000255 # The <tt> here is really to keep buildindex.py from making
256 # the variable name case-insensitive.
Fred Drakeafc7ce12001-01-22 17:33:24 +0000257 add_index_entry("environment variables!$envvar@<tt>$envvar</tt>",
Fred Drake166abba1998-04-08 23:10:54 +0000258 $ahref);
Fred Drakeafc7ce12001-01-22 17:33:24 +0000259 add_index_entry("$envvar (environment variable)", $ahref);
Fred Drakee15956b2000-04-03 04:51:13 +0000260 $aname =~ s/<a/<a class="envvar"/;
Fred Drakeafc7ce12001-01-22 17:33:24 +0000261 return "$aname$envvar</a>" . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000262}
263
Fred Drake6659c301998-03-03 22:02:19 +0000264sub do_cmd_url{
265 # use the URL as both text and hyperlink
266 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000267 my $url = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +0000268 my $icon = get_link_icon($url);
Fred Drake6659c301998-03-03 22:02:19 +0000269 $url =~ s/~/&#126;/g;
Fred Drake7a40c072000-10-02 14:43:38 +0000270 return "<a class=\"url\" href=\"$url\">$url$icon</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000271}
272
273sub do_cmd_manpage{
274 # two parameters: \manpage{name}{section}
275 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000276 my $page = next_argument();
277 my $section = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000278 return "<span class='manpage'><i>$page</i>($section)</span>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000279}
280
Fred Drakeafc7ce12001-01-22 17:33:24 +0000281$PEP_FORMAT = "http://python.sourceforge.net/peps/pep-XXXX.html";
282$RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt";
283
284sub get_rfc_url($$){
285 my($rfcnum, $format) = @_;
286 $rfcnum = sprintf("%04d", $rfcnum);
287 $format = "$format";
288 $format =~ s/XXXX/$rfcnum/;
289 return $format;
Fred Drake643d76d2000-09-09 06:07:37 +0000290}
291
292sub do_cmd_pep{
293 local($_) = @_;
294 my $rfcnumber = next_argument();
295 my $id = "rfcref-" . ++$global{'max_id'};
Fred Drakeafc7ce12001-01-22 17:33:24 +0000296 my $href = get_rfc_url($rfcnumber, $PEP_FORMAT);
Fred Drake7a40c072000-10-02 14:43:38 +0000297 my $icon = get_link_icon($href);
Fred Drake643d76d2000-09-09 06:07:37 +0000298 # Save the reference
299 my $nstr = gen_index_id("Python Enhancement Proposals!PEP $rfcnumber", '');
300 $index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
Fred Drake7a40c072000-10-02 14:43:38 +0000301 return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">PEP $rfcnumber"
302 . "$icon</a>" . $_);
Fred Drake643d76d2000-09-09 06:07:37 +0000303}
304
Fred Drake6659c301998-03-03 22:02:19 +0000305sub do_cmd_rfc{
306 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000307 my $rfcnumber = next_argument();
308 my $id = "rfcref-" . ++$global{'max_id'};
Fred Drakeafc7ce12001-01-22 17:33:24 +0000309 my $href = get_rfc_url($rfcnumber, $RFC_FORMAT);
Fred Drake7a40c072000-10-02 14:43:38 +0000310 my $icon = get_link_icon($href);
Fred Drake6659c301998-03-03 22:02:19 +0000311 # Save the reference
Fred Drake08932051998-04-17 02:15:42 +0000312 my $nstr = gen_index_id("RFC!RFC $rfcnumber", '');
Fred Drakeccc62721999-01-05 22:16:29 +0000313 $index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
Fred Drake7a40c072000-10-02 14:43:38 +0000314 return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">RFC $rfcnumber"
315 . "$icon</a>" . $_);
Fred Drake6659c301998-03-03 22:02:19 +0000316}
317
Fred Drakec9f5fe01999-11-09 16:59:42 +0000318sub do_cmd_citetitle{
319 local($_) = @_;
320 my $url = next_optional_argument();
321 my $title = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +0000322 my $icon = get_link_icon($url);
Fred Drakec9f5fe01999-11-09 16:59:42 +0000323 my $repl = '';
324 if ($url) {
325 $repl = ("<em class='citetitle'><a\n"
326 . " href='$url'\n"
327 . " title='$title'\n"
Fred Drake7a40c072000-10-02 14:43:38 +0000328 . " >$title$icon</a></em>");
Fred Drakec9f5fe01999-11-09 16:59:42 +0000329 }
330 else {
331 $repl = "<em class='citetitle'\n >$title</em>";
332 }
333 return $repl . $_;
334}
335
Fred Drake6659c301998-03-03 22:02:19 +0000336sub do_cmd_deprecated{
337 # two parameters: \deprecated{version}{whattodo}
338 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000339 my $release = next_argument();
340 my $reason = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +0000341 return ('<div class="versionnote">'
342 . "<b>Deprecated since release $release.</b>"
343 . "\n$reason</div><p>"
344 . $_);
Fred Drake6659c301998-03-03 22:02:19 +0000345}
346
Fred Drake897d12b1998-07-27 20:33:17 +0000347sub do_cmd_versionadded{
348 # one parameter: \versionadded{version}
349 local($_) = @_;
350 my $release = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +0000351 return ("\n<span class='versionnote'>New in version $release.</span>\n"
352 . $_);
Fred Drake897d12b1998-07-27 20:33:17 +0000353}
354
355sub do_cmd_versionchanged{
356 # one parameter: \versionchanged{version}
357 local($_) = @_;
Fred Drake52e76842000-05-02 17:37:42 +0000358 my $explanation = next_optional_argument();
Fred Drake897d12b1998-07-27 20:33:17 +0000359 my $release = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +0000360 my $text = "Changed in version $release.";
361 if ($explanation) {
362 $text = "Changed in version $release:\n$explanation.";
Fred Drake52e76842000-05-02 17:37:42 +0000363 }
Fred Drakeafc7ce12001-01-22 17:33:24 +0000364 return "\n<span class='versionnote'>$text</span>\n" . $_;
Fred Drake897d12b1998-07-27 20:33:17 +0000365}
366
Fred Drake557460c1999-03-02 16:05:35 +0000367#
Fred Drake2cafcbb1999-03-25 16:57:04 +0000368# These function handle platform dependency tracking.
Fred Drake557460c1999-03-02 16:05:35 +0000369#
370sub do_cmd_platform{
371 local($_) = @_;
372 my $platform = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000373 $ModulePlatforms{"<tt class='module'>$THIS_MODULE</tt>"} = $platform;
Fred Drake557460c1999-03-02 16:05:35 +0000374 $platform = "Macintosh"
Fred Drake085b8121999-04-21 14:00:29 +0000375 if $platform eq 'Mac';
Fred Drakee15956b2000-04-03 04:51:13 +0000376 return "\n<p class='availability'>Availability: <span"
377 . "\n class='platform'>$platform</span>.</p>\n" . $_;
Fred Drake557460c1999-03-02 16:05:35 +0000378}
379
Fred Drake557460c1999-03-02 16:05:35 +0000380$IGNORE_PLATFORM_ANNOTATION = '';
381sub do_cmd_ignorePlatformAnnotation{
382 local($_) = @_;
383 $IGNORE_PLATFORM_ANNOTATION = next_argument();
384 return $_;
385}
386
Fred Drake6659c301998-03-03 22:02:19 +0000387
388# index commands
389
390$INDEX_SUBITEM = "";
391
392sub get_indexsubitem{
Fred Drake7d45f6d1999-01-05 14:39:27 +0000393 return $INDEX_SUBITEM ? " $INDEX_SUBITEM" : '';
Fred Drake6659c301998-03-03 22:02:19 +0000394}
395
396sub do_cmd_setindexsubitem{
397 local($_) = @_;
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000398 $INDEX_SUBITEM = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000399 return $_;
Fred Drake6659c301998-03-03 22:02:19 +0000400}
401
Fred Drakefc16e781998-03-12 21:03:26 +0000402sub do_cmd_withsubitem{
Fred Drake7d45f6d1999-01-05 14:39:27 +0000403 # We can't really do the right thing, because LaTeX2HTML doesn't
Fred Drakefc16e781998-03-12 21:03:26 +0000404 # do things in the right order, but we need to at least strip this stuff
405 # out, and leave anything that the second argument expanded out to.
406 #
407 local($_) = @_;
Fred Drake7d45f6d1999-01-05 14:39:27 +0000408 my $oldsubitem = $INDEX_SUBITEM;
409 $INDEX_SUBITEM = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000410 my $stuff = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000411 my $br_id = ++$globals{'max_id'};
412 my $marker = "$O$br_id$C";
Fred Drake7d45f6d1999-01-05 14:39:27 +0000413 return
414 $stuff
Fred Drakeccc62721999-01-05 22:16:29 +0000415 . "\\setindexsubitem$marker$oldsubitem$marker"
Fred Drake7d45f6d1999-01-05 14:39:27 +0000416 . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000417}
418
Fred Drake08932051998-04-17 02:15:42 +0000419# This is the prologue macro which is required to start writing the
Fred Drakeab032151999-05-13 18:36:54 +0000420# mod\jobname.idx file; we can just ignore it. (Defining this suppresses
421# a warning that \makemodindex is unknown.)
Fred Drake08932051998-04-17 02:15:42 +0000422#
Fred Drake62e43691998-08-10 19:40:44 +0000423sub do_cmd_makemodindex{ return @_[0]; }
Fred Drakefc16e781998-03-12 21:03:26 +0000424
Fred Drake42b31a51998-03-27 05:16:10 +0000425# We're in the document subdirectory when this happens!
Fred Drake166abba1998-04-08 23:10:54 +0000426#
Fred Drake08932051998-04-17 02:15:42 +0000427open(IDXFILE, '>index.dat') || die "\n$!\n";
428open(INTLABELS, '>intlabels.pl') || die "\n$!\n";
Fred Drake166abba1998-04-08 23:10:54 +0000429print INTLABELS "%internal_labels = ();\n";
430print INTLABELS "1; # hack in case there are no entries\n\n";
431
432# Using \0 for this is bad because we can't use common tools to work with the
433# resulting files. Things like grep can be useful with this stuff!
434#
435$IDXFILE_FIELD_SEP = "\1";
436
Fred Drakeccc62721999-01-05 22:16:29 +0000437sub write_idxfile{
438 my ($ahref, $str) = @_;
439 print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n";
Fred Drake42b31a51998-03-27 05:16:10 +0000440}
441
Fred Drake42b31a51998-03-27 05:16:10 +0000442
443sub gen_link{
444 my($node,$target) = @_;
445 print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n";
Fred Drakee15956b2000-04-03 04:51:13 +0000446 return "<a href='$node#$target'>";
Fred Drake42b31a51998-03-27 05:16:10 +0000447}
448
Fred Drake42b31a51998-03-27 05:16:10 +0000449sub add_index_entry{
450 # add an entry to the index structures; ignore the return value
451 my($str,$ahref) = @_;
452 $str = gen_index_id($str, '');
453 $index{$str} .= $ahref;
Fred Drakeccc62721999-01-05 22:16:29 +0000454 write_idxfile($ahref, $str);
Fred Drake42b31a51998-03-27 05:16:10 +0000455}
456
Fred Drakeccc62721999-01-05 22:16:29 +0000457sub new_link_info{
458 my $name = "l2h-" . ++$globals{'max_id'};
Fred Drakee15956b2000-04-03 04:51:13 +0000459 my $aname = "<a name='$name'>";
Fred Drake42b31a51998-03-27 05:16:10 +0000460 my $ahref = gen_link($CURRENT_FILE, $name);
461 return ($name, $aname, $ahref);
462}
463
Fred Drakeab032151999-05-13 18:36:54 +0000464$IndexMacroPattern = '';
465sub define_indexing_macro{
466 my $count = @_;
467 my $i = 0;
468 for (; $i < $count; ++$i) {
469 my $name = @_[$i];
470 my $cmd = "idx_cmd_$name";
471 die "\nNo function $cmd() defined!\n"
472 if (!defined &$cmd);
473 eval ("sub do_cmd_$name { return process_index_macros("
474 . "\@_[0], '$name'); }");
475 if (length($IndexMacroPattern) == 0) {
476 $IndexMacroPattern = "$name";
477 }
478 else {
479 $IndexMacroPattern .= "|$name";
480 }
481 }
482}
483
484$DEBUG_INDEXING = 0;
485sub process_index_macros{
Fred Drake42b31a51998-03-27 05:16:10 +0000486 local($_) = @_;
Fred Drakeab032151999-05-13 18:36:54 +0000487 my $cmdname = @_[1]; # This is what triggered us in the first place;
488 # we know it's real, so just process it.
Fred Drakeccc62721999-01-05 22:16:29 +0000489 my($name,$aname,$ahref) = new_link_info();
Fred Drakeab032151999-05-13 18:36:54 +0000490 my $cmd = "idx_cmd_$cmdname";
491 print "\nIndexing: \\$cmdname"
492 if $DEBUG_INDEXING;
493 &$cmd($ahref); # modifies $_ and adds index entries
494 while (/^[\s\n]*\\($IndexMacroPattern)</) {
495 $cmdname = "$1";
496 print " \\$cmdname"
497 if $DEBUG_INDEXING;
498 $cmd = "idx_cmd_$cmdname";
499 if (!defined &$cmd) {
500 last;
501 }
502 else {
503 s/^[\s\n]*\\$cmdname//;
504 &$cmd($ahref);
505 }
506 }
Fred Drakeafc7ce12001-01-22 17:33:24 +0000507 if (/^[ \t\r\n]/) {
508 $_ = substr($_, 1);
509 }
Fred Drake62e43691998-08-10 19:40:44 +0000510 return "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake42b31a51998-03-27 05:16:10 +0000511}
512
Fred Drakeab032151999-05-13 18:36:54 +0000513define_indexing_macro('index');
514sub idx_cmd_index{
Fred Drakeccc62721999-01-05 22:16:29 +0000515 my $str = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000516 add_index_entry("$str", @_[0]);
Fred Drake2e7edb81998-05-11 18:31:17 +0000517}
518
Fred Drakeab032151999-05-13 18:36:54 +0000519define_indexing_macro('kwindex');
520sub idx_cmd_kwindex{
521 my $str = next_argument();
522 add_index_entry("<tt>$str</tt>!keyword", @_[0]);
523 add_index_entry("keyword!<tt>$str</tt>", @_[0]);
524}
525
526define_indexing_macro('indexii');
527sub idx_cmd_indexii{
Fred Drakeccc62721999-01-05 22:16:29 +0000528 my $str1 = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000529 my $str2 = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000530 add_index_entry("$str1!$str2", @_[0]);
531 add_index_entry("$str2!$str1", @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000532}
533
Fred Drakeab032151999-05-13 18:36:54 +0000534define_indexing_macro('indexiii');
535sub idx_cmd_indexiii{
Fred Drakeccc62721999-01-05 22:16:29 +0000536 my $str1 = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000537 my $str2 = next_argument();
538 my $str3 = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000539 add_index_entry("$str1!$str2 $str3", @_[0]);
540 add_index_entry("$str2!$str3, $str1", @_[0]);
541 add_index_entry("$str3!$str1 $str2", @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000542}
543
Fred Drakeab032151999-05-13 18:36:54 +0000544define_indexing_macro('indexiv');
545sub idx_cmd_indexiv{
Fred Drakeccc62721999-01-05 22:16:29 +0000546 my $str1 = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000547 my $str2 = next_argument();
548 my $str3 = next_argument();
549 my $str4 = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000550 add_index_entry("$str1!$str2 $str3 $str4", @_[0]);
551 add_index_entry("$str2!$str3 $str4, $str1", @_[0]);
552 add_index_entry("$str3!$str4, $str1 $str2", @_[0]);
553 add_index_entry("$str4!$$str1 $str2 $str3", @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000554}
555
Fred Drakeab032151999-05-13 18:36:54 +0000556define_indexing_macro('ttindex');
557sub idx_cmd_ttindex{
Fred Drakeccc62721999-01-05 22:16:29 +0000558 my $str = next_argument();
559 my $entry = $str . get_indexsubitem();
Fred Drakeab032151999-05-13 18:36:54 +0000560 add_index_entry($entry, @_[0]);
Fred Drakec9a44381998-03-17 06:29:13 +0000561}
Fred Drake6659c301998-03-03 22:02:19 +0000562
563sub my_typed_index_helper{
Fred Drakeab032151999-05-13 18:36:54 +0000564 my($word,$ahref) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000565 my $str = next_argument();
Fred Drake42b31a51998-03-27 05:16:10 +0000566 add_index_entry("$str $word", $ahref);
567 add_index_entry("$word!$str", $ahref);
Fred Drake6659c301998-03-03 22:02:19 +0000568}
569
Fred Drakeab032151999-05-13 18:36:54 +0000570define_indexing_macro('stindex', 'opindex', 'exindex', 'obindex');
571sub idx_cmd_stindex{ my_typed_index_helper('statement', @_[0]); }
572sub idx_cmd_opindex{ my_typed_index_helper('operator', @_[0]); }
573sub idx_cmd_exindex{ my_typed_index_helper('exception', @_[0]); }
574sub idx_cmd_obindex{ my_typed_index_helper('object', @_[0]); }
Fred Drake6659c301998-03-03 22:02:19 +0000575
Fred Drakeab032151999-05-13 18:36:54 +0000576define_indexing_macro('bifuncindex');
577sub idx_cmd_bifuncindex{
Fred Drakeccc62721999-01-05 22:16:29 +0000578 my $str = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000579 add_index_entry("<tt class='function'>$str()</tt> (built-in function)",
580 @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000581}
582
583
Fred Drake6659c301998-03-03 22:02:19 +0000584sub make_mod_index_entry{
Fred Drakeccc62721999-01-05 22:16:29 +0000585 my($str,$define) = @_;
586 my($name,$aname,$ahref) = new_link_info();
Fred Drake42b31a51998-03-27 05:16:10 +0000587 # equivalent of add_index_entry() using $define instead of ''
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000588 $ahref =~ s/\#[-_a-zA-Z0-9]*\"/\"/
589 if ($define eq 'DEF');
Fred Drake42b31a51998-03-27 05:16:10 +0000590 $str = gen_index_id($str, $define);
591 $index{$str} .= $ahref;
Fred Drakeccc62721999-01-05 22:16:29 +0000592 write_idxfile($ahref, $str);
Fred Drake42b31a51998-03-27 05:16:10 +0000593
Fred Drakec9a44381998-03-17 06:29:13 +0000594 if ($define eq 'DEF') {
Fred Drake42b31a51998-03-27 05:16:10 +0000595 # add to the module index
Fred Drakee15956b2000-04-03 04:51:13 +0000596 $str =~ /(<tt.*<\/tt>)/;
597 my $nstr = $1;
Fred Drake42b31a51998-03-27 05:16:10 +0000598 $Modules{$nstr} .= $ahref;
Fred Drake6659c301998-03-03 22:02:19 +0000599 }
Fred Drakeafc7ce12001-01-22 17:33:24 +0000600 return "$aname$anchor_invisible_mark2</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000601}
602
Fred Drake557460c1999-03-02 16:05:35 +0000603
Fred Drakec9a44381998-03-17 06:29:13 +0000604$THIS_MODULE = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000605$THIS_CLASS = '';
Fred Drakec9a44381998-03-17 06:29:13 +0000606
Fred Drakea0f4c941998-07-24 22:16:04 +0000607sub define_module{
608 my($word,$name) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000609 my $section_tag = join('', @curr_sec_id);
Fred Drake3e4c6141999-05-17 15:00:32 +0000610 if ($word ne "built-in" && $word ne "extension"
611 && $word ne "standard" && $word ne "") {
612 write_warnings("Bad module type '$word'"
613 . " for \\declaremodule (module $name)");
614 $word = "";
615 }
Fred Drake6659c301998-03-03 22:02:19 +0000616 $word = "$word " if $word;
Fred Drakea0f4c941998-07-24 22:16:04 +0000617 $THIS_MODULE = "$name";
Fred Drake5942b432000-10-30 06:24:56 +0000618 $INDEX_SUBITEM = "(in module $name)";
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000619 print "[$name]";
Fred Drakee15956b2000-04-03 04:51:13 +0000620 return make_mod_index_entry(
621 "<tt class='module'>$name</tt> (${word}module)", 'DEF');
Fred Drakea0f4c941998-07-24 22:16:04 +0000622}
623
624sub my_module_index_helper{
625 local($word, $_) = @_;
626 my $name = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000627 return define_module($word, $name) . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000628}
629
Fred Drake62e43691998-08-10 19:40:44 +0000630sub do_cmd_modindex{ return my_module_index_helper('', @_); }
631sub do_cmd_bimodindex{ return my_module_index_helper('built-in', @_); }
632sub do_cmd_exmodindex{ return my_module_index_helper('extension', @_); }
633sub do_cmd_stmodindex{ return my_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000634
Fred Drakeab032151999-05-13 18:36:54 +0000635sub ref_module_index_helper{
Fred Drake37cc0c02000-04-26 18:05:24 +0000636 my($word, $ahref) = @_;
Fred Drakeab032151999-05-13 18:36:54 +0000637 my $str = next_argument();
638 $word = "$word " if $word;
Fred Drakee15956b2000-04-03 04:51:13 +0000639 $str = "<tt class='module'>$str</tt> (${word}module)";
Fred Drakeab032151999-05-13 18:36:54 +0000640 # can't use add_index_entry() since the 2nd arg to gen_index_id() is used;
641 # just inline it all here
642 $str = gen_index_id($str, 'REF');
643 $index{$str} .= $ahref;
644 write_idxfile($ahref, $str);
645}
646
Fred Drake6659c301998-03-03 22:02:19 +0000647# these should be adjusted a bit....
Fred Drakeab032151999-05-13 18:36:54 +0000648define_indexing_macro('refmodindex', 'refbimodindex',
649 'refexmodindex', 'refstmodindex');
650sub idx_cmd_refmodindex{ return ref_module_index_helper('', @_); }
651sub idx_cmd_refbimodindex{ return ref_module_index_helper('built-in', @_); }
652sub idx_cmd_refexmodindex{ return ref_module_index_helper('extension', @_); }
653sub idx_cmd_refstmodindex{ return ref_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000654
Fred Drake62e43691998-08-10 19:40:44 +0000655sub do_cmd_nodename{ return do_cmd_label(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000656
657sub init_myformat{
Fred Drakeafc7ce12001-01-22 17:33:24 +0000658 $anchor_invisible_mark = '&nbsp;';
659 $anchor_invisible_mark2 = '';
Fred Drake6659c301998-03-03 22:02:19 +0000660 $anchor_mark = '';
661 $icons{'anchor_mark'} = '';
Fred Drake6659c301998-03-03 22:02:19 +0000662}
Fred Drake42b31a51998-03-27 05:16:10 +0000663init_myformat();
Fred Drake6659c301998-03-03 22:02:19 +0000664
Fred Drakeab032151999-05-13 18:36:54 +0000665# Create an index entry, but include the string in the target anchor
Fred Drake6659c301998-03-03 22:02:19 +0000666# instead of the dummy filler.
667#
668sub make_str_index_entry{
Fred Drakeccc62721999-01-05 22:16:29 +0000669 my($str) = @_;
670 my($name,$aname,$ahref) = new_link_info();
Fred Drake42b31a51998-03-27 05:16:10 +0000671 add_index_entry($str, $ahref);
Fred Drake62e43691998-08-10 19:40:44 +0000672 return "$aname$str</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000673}
674
Fred Drakee15956b2000-04-03 04:51:13 +0000675$REFCOUNTS_LOADED = 0;
676
677sub load_refcounts{
678 $REFCOUNTS_LOADED = 1;
679
Fred Drakee15956b2000-04-03 04:51:13 +0000680 my $myname, $mydir, $myext;
681 ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*');
682 chop $mydir; # remove trailing '/'
683 ($myname, $mydir, $myext) = fileparse($mydir, '\..*');
684 chop $mydir; # remove trailing '/'
685 $mydir = getcwd() . "$dd$mydir"
686 unless $mydir =~ s|^/|/|;
687 local $_;
688 my $filename = "$mydir${dd}api${dd}refcounts.dat";
689 open(REFCOUNT_FILE, "<$filename") || die "\n$!\n";
690 print "[loading API refcount data]";
691 while (<REFCOUNT_FILE>) {
Fred Drakec2578c52000-04-10 18:26:45 +0000692 if (/([a-zA-Z0-9_]+):PyObject\*:([a-zA-Z0-9_]*):(0|[-+]1|null):(.*)$/) {
Fred Drakee15956b2000-04-03 04:51:13 +0000693 my($func, $param, $count, $comment) = ($1, $2, $3, $4);
694 #print "\n$func($param) --> $count";
695 $REFCOUNTS{"$func:$param"} = $count;
696 }
697 }
698}
699
700sub get_refcount{
701 my ($func, $param) = @_;
702 load_refcounts()
703 unless $REFCOUNTS_LOADED;
704 return $REFCOUNTS{"$func:$param"};
705}
706
Fred Drake6659c301998-03-03 22:02:19 +0000707sub do_env_cfuncdesc{
708 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000709 my $return_type = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000710 my $function_name = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000711 my $arg_list = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000712 my $idx = make_str_index_entry(
713 "<tt class='cfunction'>$function_name()</tt>" . get_indexsubitem());
Fred Drake08932051998-04-17 02:15:42 +0000714 $idx =~ s/ \(.*\)//;
Fred Drake241551c2000-08-11 20:04:19 +0000715 $idx =~ s/\(\)//; # ???? - why both of these?
Fred Drakee15956b2000-04-03 04:51:13 +0000716 my $result_rc = get_refcount($function_name, '');
717 my $rcinfo = '';
718 if ($result_rc eq '+1') {
Fred Drake241551c2000-08-11 20:04:19 +0000719 $rcinfo = 'New reference';
Fred Drakee15956b2000-04-03 04:51:13 +0000720 }
721 elsif ($result_rc eq '0') {
Fred Drake241551c2000-08-11 20:04:19 +0000722 $rcinfo = 'Borrowed reference';
Fred Drakee15956b2000-04-03 04:51:13 +0000723 }
Fred Drakec2578c52000-04-10 18:26:45 +0000724 elsif ($result_rc eq 'null') {
Fred Drake241551c2000-08-11 20:04:19 +0000725 $rcinfo = 'Always <tt class="constant">NULL</tt>';
Fred Drakec2578c52000-04-10 18:26:45 +0000726 }
Fred Drakee15956b2000-04-03 04:51:13 +0000727 if ($rcinfo ne '') {
Fred Drake241551c2000-08-11 20:04:19 +0000728 $rcinfo = ( "\n<div class=\"refcount-info\">"
729 . "\n <span class=\"label\">Return value:</span>"
730 . "\n <span class=\"value\">$rcinfo.</span>"
731 . "\n</div>");
Fred Drakee15956b2000-04-03 04:51:13 +0000732 }
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000733 return "<dl><dt>$return_type <b>$idx</b> (<var>$arg_list</var>)\n<dd>"
Fred Drakee15956b2000-04-03 04:51:13 +0000734 . $rcinfo
Fred Drake62e43691998-08-10 19:40:44 +0000735 . $_
736 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000737}
738
Fred Drakee15956b2000-04-03 04:51:13 +0000739sub do_env_csimplemacrodesc{
740 local($_) = @_;
741 my $name = next_argument();
742 my $idx = make_str_index_entry("<tt class='macro'>$name</tt>");
743 return "<dl><dt><b>$idx</b>\n<dd>"
744 . $_
745 . '</dl>'
746}
747
Fred Drake6659c301998-03-03 22:02:19 +0000748sub do_env_ctypedesc{
749 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +0000750 my $index_name = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000751 my $type_name = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000752 $index_name = $type_name
753 unless $index_name;
754 my($name,$aname,$ahref) = new_link_info();
755 add_index_entry("<tt class='ctype'>$index_name</tt> (C type)", $ahref);
756 return "<dl><dt><b><tt class='ctype'>$aname$type_name</a></tt></b>\n<dd>"
Fred Drake62e43691998-08-10 19:40:44 +0000757 . $_
758 . '</dl>'
Fred Drake6659c301998-03-03 22:02:19 +0000759}
760
761sub do_env_cvardesc{
762 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000763 my $var_type = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000764 my $var_name = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000765 my $idx = make_str_index_entry("<tt class='cdata'>$var_name</tt>"
Fred Drake90fdda51999-02-16 20:27:42 +0000766 . get_indexsubitem());
Fred Drake08932051998-04-17 02:15:42 +0000767 $idx =~ s/ \(.*\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000768 return "<dl><dt>$var_type <b>$idx</b>\n"
769 . '<dd>'
770 . $_
771 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000772}
773
Fred Drake3cdb89d2000-09-14 20:17:23 +0000774sub convert_args($){
775 local($IN_DESC_HANDLER) = 1;
776 local($_) = @_;
777 return translate_commands($_);
778}
779
Fred Drake6659c301998-03-03 22:02:19 +0000780sub do_env_funcdesc{
781 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000782 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000783 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000784 my $idx = make_str_index_entry("<tt class='function'>$function_name()</tt>"
Fred Drake08932051998-04-17 02:15:42 +0000785 . get_indexsubitem());
786 $idx =~ s/ \(.*\)//;
Fred Drakeccc62721999-01-05 22:16:29 +0000787 $idx =~ s/\(\)<\/tt>/<\/tt>/;
Fred Drake62e43691998-08-10 19:40:44 +0000788 return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000789}
790
791sub do_env_funcdescni{
792 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000793 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000794 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000795 return "<dl><dt><b><tt class='function'>$function_name</tt></b>"
Fred Drake90fdda51999-02-16 20:27:42 +0000796 . " (<var>$arg_list</var>)\n"
797 . '<dd>'
798 . $_
799 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000800}
801
802sub do_cmd_funcline{
803 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000804 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000805 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000806 my $prefix = "<tt class='function'>$function_name()</tt>";
Fred Drakeca675e41999-04-21 15:58:58 +0000807 my $idx = make_str_index_entry($prefix . get_indexsubitem());
808 $prefix =~ s/\(\)//;
809
810 return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000811}
812
Fred Drake6b3fb781999-07-12 16:50:09 +0000813sub do_cmd_funclineni{
814 local($_) = @_;
815 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000816 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000817 my $prefix = "<tt class='function'>$function_name</tt>";
Fred Drake6b3fb781999-07-12 16:50:09 +0000818
819 return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_;
820}
821
Fred Drake6659c301998-03-03 22:02:19 +0000822# Change this flag to index the opcode entries. I don't think it's very
823# useful to index them, since they're only presented to describe the dis
824# module.
825#
826$INDEX_OPCODES = 0;
827
828sub do_env_opcodedesc{
829 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000830 my $opcode_name = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000831 my $arg_list = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000832 my $idx;
833 if ($INDEX_OPCODES) {
Fred Drakee15956b2000-04-03 04:51:13 +0000834 $idx = make_str_index_entry("<tt class='opcode'>$opcode_name</tt>"
835 . " (byte code instruction)");
Fred Drake08932051998-04-17 02:15:42 +0000836 $idx =~ s/ \(byte code instruction\)//;
837 }
838 else {
Fred Drakee15956b2000-04-03 04:51:13 +0000839 $idx = "<tt class='opcode'>$opcode_name</tt>";
Fred Drake08932051998-04-17 02:15:42 +0000840 }
841 my $stuff = "<dl><dt><b>$idx</b>";
Fred Drake6659c301998-03-03 22:02:19 +0000842 if ($arg_list) {
843 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
844 }
Fred Drake62e43691998-08-10 19:40:44 +0000845 return $stuff . "\n<dd>" . $_ . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000846}
847
848sub do_env_datadesc{
849 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000850 my $dataname = next_argument();
851 my $idx = make_str_index_entry("<tt>$dataname</tt>" . get_indexsubitem());
Fred Drake08932051998-04-17 02:15:42 +0000852 $idx =~ s/ \(.*\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000853 return "<dl><dt><b>$idx</b>\n<dd>"
854 . $_
855 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000856}
857
858sub do_env_datadescni{
859 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000860 my $idx = next_argument();
861 if (! $STRING_INDEX_TT) {
862 $idx = "<tt>$idx</tt>";
Fred Drake6659c301998-03-03 22:02:19 +0000863 }
Fred Drake62e43691998-08-10 19:40:44 +0000864 return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000865}
866
867sub do_cmd_dataline{
868 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000869 my $data_name = next_argument();
870 my $idx = make_str_index_entry("<tt>$data_name</tt>" . get_indexsubitem());
Fred Drake6659c301998-03-03 22:02:19 +0000871 $idx =~ s/ \(.*\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000872 return "<dt><b>$idx</b><dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000873}
874
Fred Drakeadb272c2000-04-10 17:47:14 +0000875sub do_cmd_datalineni{
876 local($_) = @_;
877 my $data_name = next_argument();
878 return "<dt><b><tt>$data_name</tt></b><dd>" . $_;
879}
880
Fred Drake42b31a51998-03-27 05:16:10 +0000881sub do_env_excdesc{
882 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000883 my $excname = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000884 my $idx = make_str_index_entry("<tt class='exception'>$excname</tt>");
Fred Drakeab357ec2001-03-02 18:57:05 +0000885 return "<dl><dt><b>exception $idx</b>\n<dd>" . $_ . '</dl>'
Fred Drake42b31a51998-03-27 05:16:10 +0000886}
887
Fred Drake62e43691998-08-10 19:40:44 +0000888sub do_env_fulllineitems{ return do_env_itemize(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000889
890
Fred Drake643d76d2000-09-09 06:07:37 +0000891sub handle_classlike_descriptor{
892 local($_, $what) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000893 $THIS_CLASS = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000894 my $arg_list = convert_args(next_argument());
Fred Drakeccc62721999-01-05 22:16:29 +0000895 $idx = make_str_index_entry(
Fred Drake643d76d2000-09-09 06:07:37 +0000896 "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" );
Fred Drake08932051998-04-17 02:15:42 +0000897 $idx =~ s/ \(.*\)//;
Fred Drakeab357ec2001-03-02 18:57:05 +0000898 return ("<dl><dt><b>$what $idx</b> (<var>$arg_list</var>)\n<dd>"
899 . $_
900 . '</dl>');
Fred Drakec9a44381998-03-17 06:29:13 +0000901}
902
Fred Drake643d76d2000-09-09 06:07:37 +0000903sub do_env_classdesc{
904 return handle_classlike_descriptor(@_[0], "class");
905}
906
907sub do_env_excclassdesc{
908 return handle_classlike_descriptor(@_[0], "exception");
909}
910
Fred Drake42b31a51998-03-27 05:16:10 +0000911
912sub do_env_methoddesc{
913 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000914 my $class_name = next_optional_argument();
915 $class_name = $THIS_CLASS
916 unless $class_name;
Fred Drake5a0ca4e1999-01-12 04:16:51 +0000917 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000918 my $arg_list = convert_args(next_argument());
Fred Drake08932051998-04-17 02:15:42 +0000919 my $extra = '';
920 if ($class_name) {
921 $extra = " ($class_name method)";
Fred Drake42b31a51998-03-27 05:16:10 +0000922 }
Fred Drakee15956b2000-04-03 04:51:13 +0000923 my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra");
Fred Drake08932051998-04-17 02:15:42 +0000924 $idx =~ s/ \(.*\)//;
925 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000926 return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000927}
928
929
Fred Drake7d45f6d1999-01-05 14:39:27 +0000930sub do_cmd_methodline{
931 local($_) = @_;
932 my $class_name = next_optional_argument();
933 $class_name = $THIS_CLASS
934 unless $class_name;
935 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000936 my $arg_list = convert_args(next_argument());
Fred Drake7d45f6d1999-01-05 14:39:27 +0000937 my $extra = '';
938 if ($class_name) {
939 $extra = " ($class_name method)";
940 }
Fred Drakee15956b2000-04-03 04:51:13 +0000941 my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra");
Fred Drake7d45f6d1999-01-05 14:39:27 +0000942 $idx =~ s/ \(.*\)//;
943 $idx =~ s/\(\)//;
944 return "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>"
945 . $_;
946}
947
948
Fred Draked64a40d1998-09-10 18:59:13 +0000949sub do_cmd_methodlineni{
950 local($_) = @_;
951 next_optional_argument();
952 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000953 my $arg_list = convert_args(next_argument());
Fred Draked64a40d1998-09-10 18:59:13 +0000954 return "<dt><b>$method</b> (<var>$arg_list</var>)\n<dd>"
955 . $_;
956}
957
Fred Drake42b31a51998-03-27 05:16:10 +0000958sub do_env_methoddescni{
959 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000960 next_optional_argument();
961 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000962 my $arg_list = convert_args(next_argument());
Fred Drake62e43691998-08-10 19:40:44 +0000963 return "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>"
964 . $_
965 . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000966}
967
968
969sub do_env_memberdesc{
970 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000971 my $class = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000972 my $member = next_argument();
Fred Drake42b31a51998-03-27 05:16:10 +0000973 $class = $THIS_CLASS
974 unless $class;
Fred Drake08932051998-04-17 02:15:42 +0000975 my $extra = '';
Fred Drake085b8121999-04-21 14:00:29 +0000976 $extra = " ($class attribute)"
977 if ($class ne '');
Fred Drakee15956b2000-04-03 04:51:13 +0000978 my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra");
Fred Drake42b31a51998-03-27 05:16:10 +0000979 $idx =~ s/ \(.*\)//;
980 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000981 return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000982}
983
984
Fred Drake5ccf3301998-04-17 20:04:09 +0000985sub do_cmd_memberline{
986 local($_) = @_;
987 my $class = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000988 my $member = next_argument();
Fred Drake5ccf3301998-04-17 20:04:09 +0000989 $class = $THIS_CLASS
990 unless $class;
991 my $extra = '';
Fred Drake085b8121999-04-21 14:00:29 +0000992 $extra = " ($class attribute)"
993 if ($class ne '');
Fred Drakee15956b2000-04-03 04:51:13 +0000994 my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra");
Fred Drake5ccf3301998-04-17 20:04:09 +0000995 $idx =~ s/ \(.*\)//;
996 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000997 return "<dt><b>$idx</b><dd>" . $_;
Fred Drake5ccf3301998-04-17 20:04:09 +0000998}
999
Fred Drake42b31a51998-03-27 05:16:10 +00001000sub do_env_memberdescni{
1001 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +00001002 next_optional_argument();
1003 my $member = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001004 return "<dl><dt><b><tt class='member'>$member</tt></b>\n<dd>"
1005 . $_
1006 . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +00001007}
1008
1009
Fred Drake5ccf3301998-04-17 20:04:09 +00001010sub do_cmd_memberlineni{
1011 local($_) = @_;
1012 next_optional_argument();
1013 my $member = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001014 return "<dt><b><tt class='member'>$member</tt></b><dd>" . $_;
Fred Drake5ccf3301998-04-17 20:04:09 +00001015}
1016
Fred Drakee15956b2000-04-03 04:51:13 +00001017@col_aligns = ('<td>', '<td>', '<td>', '<td>');
Fred Drake6659c301998-03-03 22:02:19 +00001018
Fred Drakef74e5b71999-04-28 14:58:49 +00001019sub fix_font{
1020 # do a little magic on a font name to get the right behavior in the first
1021 # column of the output table
1022 my $font = @_[0];
1023 if ($font eq 'textrm') {
1024 $font = '';
1025 }
1026 elsif ($font eq 'file' || $font eq 'filenq') {
Fred Drakee15956b2000-04-03 04:51:13 +00001027 $font = 'tt class="file"';
1028 }
1029 elsif ($font eq 'member') {
1030 $font = 'tt class="member"';
Fred Drakef74e5b71999-04-28 14:58:49 +00001031 }
Fred Drakee463f8e2000-11-30 07:17:27 +00001032 elsif ($font eq 'class') {
1033 $font = 'tt class="class"';
1034 }
Fred Drake7388f732000-06-28 21:06:08 +00001035 elsif ($font eq 'constant') {
1036 $font = 'tt class="constant"';
1037 }
Fred Drakecb0fc9c2000-08-09 13:45:04 +00001038 elsif ($font eq 'kbd') {
1039 $font = 'kbd';
1040 }
Fred Draked04592a2000-10-25 16:15:13 +00001041 elsif ($font eq 'programopt') {
1042 $font = 'b';
1043 }
Fred Drakeafc7ce12001-01-22 17:33:24 +00001044 elsif ($font eq 'exception') {
1045 $font = 'tt class="exception"';
1046 }
Fred Drakef74e5b71999-04-28 14:58:49 +00001047 return $font;
1048}
1049
Fred Drakee15956b2000-04-03 04:51:13 +00001050sub figure_column_alignment{
1051 my $a = @_[0];
1052 my $mark = substr($a, 0, 1);
1053 my $r = '';
1054 if ($mark eq 'c')
1055 { $r = ' align="center"'; }
1056 elsif ($mark eq 'r')
1057 { $r = ' align="right"'; }
1058 elsif ($mark eq 'l')
1059 { $r = ' align="left"'; }
1060 elsif ($mark eq 'p')
1061 { $r = ' align="left"'; }
1062 return $r;
1063}
1064
Fred Drake6659c301998-03-03 22:02:19 +00001065sub setup_column_alignments{
1066 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001067 my($s1,$s2,$s3,$s4) = split(/[|]/,$_);
1068 my $a1 = figure_column_alignment($s1);
1069 my $a2 = figure_column_alignment($s2);
1070 my $a3 = figure_column_alignment($s3);
1071 my $a4 = figure_column_alignment($s4);
1072 $col_aligns[0] = "<td$a1 valign=\"baseline\">";
1073 $col_aligns[1] = "<td$a2>";
1074 $col_aligns[2] = "<td$a3>";
1075 $col_aligns[3] = "<td$a4>";
Fred Drake79189b51999-04-28 13:54:30 +00001076 # return the aligned header start tags
Fred Drakee15956b2000-04-03 04:51:13 +00001077 return ("<th$a1>", "<th$a2>", "<th$a3>", "<th$a4>");
1078}
1079
1080sub get_table_col1_fonts{
1081 my $font = $globals{'lineifont'};
1082 my ($sfont,$efont) = ('', '');
1083 if ($font) {
1084 $sfont = "<$font>";
1085 $efont = "</$font>";
1086 $efont =~ s/ .*>/>/;
1087 }
Fred Drakee463f8e2000-11-30 07:17:27 +00001088 return ($sfont, $efont);
Fred Drake6659c301998-03-03 22:02:19 +00001089}
1090
1091sub do_env_tableii{
1092 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001093 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001094 my $font = fix_font(next_argument());
Fred Drake08932051998-04-17 02:15:42 +00001095 my $h1 = next_argument();
1096 my $h2 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001097 s/[\s\n]+//;
Fred Drake08932051998-04-17 02:15:42 +00001098 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001099 my $a1 = $col_aligns[0];
1100 my $a2 = $col_aligns[1];
1101 s/\\lineii</\\lineii[$a1|$a2]</g;
1102 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001103 . "\n <thead>"
1104 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001105 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1106 . "\n $th2<b>$h2</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001107 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001108 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001109 . "\n <tbody valign='baseline'>"
Fred Drake351960d2000-10-26 20:14:58 +00001110 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001111 . "\n </tbody>"
1112 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001113}
1114
Fred Drakeda72b932000-09-21 15:58:02 +00001115sub do_env_longtableii{
1116 return do_env_tableii(@_);
1117}
1118
Fred Drake6659c301998-03-03 22:02:19 +00001119sub do_cmd_lineii{
1120 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001121 my $aligns = next_optional_argument();
Fred Drake08932051998-04-17 02:15:42 +00001122 my $c1 = next_argument();
1123 my $c2 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001124 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001125 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001126 $c2 = '&nbsp;' if ($c2 eq '');
1127 my($c1align,$c2align) = split('\|', $aligns);
1128 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001129 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001130 $padding = '&nbsp;';
Fred Drake58b2bfd1998-04-02 20:14:04 +00001131 }
Fred Drakee15956b2000-04-03 04:51:13 +00001132 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
1133 . " $c2align$c2</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001134 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001135}
1136
1137sub do_env_tableiii{
1138 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001139 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001140 my $font = fix_font(next_argument());
Fred Drake08932051998-04-17 02:15:42 +00001141 my $h1 = next_argument();
1142 my $h2 = next_argument();
1143 my $h3 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001144 s/[\s\n]+//;
Fred Drake08932051998-04-17 02:15:42 +00001145 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001146 my $a1 = $col_aligns[0];
1147 my $a2 = $col_aligns[1];
1148 my $a3 = $col_aligns[2];
1149 s/\\lineiii</\\lineiii[$a1|$a2|$a3]</g;
1150 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001151 . "\n <thead>"
1152 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001153 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1154 . "\n $th2<b>$h2</b>\&nbsp;</th>"
1155 . "\n $th3<b>$h3</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001156 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001157 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001158 . "\n <tbody valign='baseline'>"
Fred Drake62e43691998-08-10 19:40:44 +00001159 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001160 . "\n </tbody>"
1161 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001162}
1163
Fred Drakeda72b932000-09-21 15:58:02 +00001164sub do_env_longtableiii{
1165 return do_env_tableiii(@_);
1166}
1167
Fred Drake6659c301998-03-03 22:02:19 +00001168sub do_cmd_lineiii{
1169 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001170 my $aligns = next_optional_argument();
Fred Drake08932051998-04-17 02:15:42 +00001171 my $c1 = next_argument();
1172 my $c2 = next_argument();
1173 my $c3 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001174 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001175 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001176 $c3 = '&nbsp;' if ($c3 eq '');
1177 my($c1align,$c2align,$c3align) = split('\|', $aligns);
1178 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001179 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001180 $padding = '&nbsp;';
Fred Drake58b2bfd1998-04-02 20:14:04 +00001181 }
Fred Drakee15956b2000-04-03 04:51:13 +00001182 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
Fred Drakef74e5b71999-04-28 14:58:49 +00001183 . " $c2align$c2</td>\n"
Fred Drakee15956b2000-04-03 04:51:13 +00001184 . " $c3align$c3</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001185 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001186}
1187
Fred Drakea0f4c941998-07-24 22:16:04 +00001188sub do_env_tableiv{
1189 local($_) = @_;
1190 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001191 my $font = fix_font(next_argument());
Fred Drakea0f4c941998-07-24 22:16:04 +00001192 my $h1 = next_argument();
1193 my $h2 = next_argument();
1194 my $h3 = next_argument();
1195 my $h4 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001196 s/[\s\n]+//;
Fred Drakea0f4c941998-07-24 22:16:04 +00001197 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001198 my $a1 = $col_aligns[0];
1199 my $a2 = $col_aligns[1];
1200 my $a3 = $col_aligns[2];
1201 my $a4 = $col_aligns[3];
1202 s/\\lineiv</\\lineiv[$a1|$a2|$a3|$a4]</g;
1203 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001204 . "\n <thead>"
1205 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001206 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1207 . "\n $th2<b>$h2</b>\&nbsp;</th>"
1208 . "\n $th3<b>$h3</b>\&nbsp;</th>"
1209 . "\n $th4<b>$h4</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001210 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001211 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001212 . "\n <tbody valign='baseline'>"
Fred Drake62e43691998-08-10 19:40:44 +00001213 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001214 . "\n </tbody>"
1215 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001216}
1217
Fred Drakeda72b932000-09-21 15:58:02 +00001218sub do_env_longtableiv{
1219 return do_env_tableiv(@_);
1220}
1221
Fred Drakea0f4c941998-07-24 22:16:04 +00001222sub do_cmd_lineiv{
Fred Drake6659c301998-03-03 22:02:19 +00001223 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001224 my $aligns = next_optional_argument();
Fred Drakea0f4c941998-07-24 22:16:04 +00001225 my $c1 = next_argument();
1226 my $c2 = next_argument();
1227 my $c3 = next_argument();
1228 my $c4 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001229 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001230 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001231 $c4 = '&nbsp;' if ($c4 eq '');
1232 my($c1align,$c2align,$c3align,$c4align) = split('\|', $aligns);
1233 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001234 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001235 $padding = '&nbsp;';
Fred Drakea0f4c941998-07-24 22:16:04 +00001236 }
Fred Drakee15956b2000-04-03 04:51:13 +00001237 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
Fred Drakef74e5b71999-04-28 14:58:49 +00001238 . " $c2align$c2</td>\n"
1239 . " $c3align$c3</td>\n"
Fred Drakee15956b2000-04-03 04:51:13 +00001240 . " $c4align$c4</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001241 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001242}
1243
Fred Drake3be20742000-08-31 06:22:54 +00001244
1245# These can be used to control the title page appearance;
1246# they need a little bit of documentation.
1247#
1248# If $TITLE_PAGE_GRAPHIC is set, it should be the name of a file in the
1249# $ICONSERVER directory, or include path information (other than "./"). The
1250# default image type will be assumed if an extension is not provided.
1251#
1252# If specified, the "title page" will contain two colums: one containing the
1253# title/author/etc., and the other containing the graphic. Use the other
1254# four variables listed here to control specific details of the layout; all
1255# are optional.
1256#
1257# $TITLE_PAGE_GRAPHIC = "my-company-logo";
1258# $TITLE_PAGE_GRAPHIC_COLWIDTH = "30%";
1259# $TITLE_PAGE_GRAPHIC_WIDTH = 150;
1260# $TITLE_PAGE_GRAPHIC_HEIGHT = 150;
1261# $TITLE_PAGE_GRAPHIC_ON_RIGHT = 0;
1262
1263sub make_my_titlepage() {
1264 my $the_title = "";
Fred Drake6659c301998-03-03 22:02:19 +00001265 if ($t_title) {
Fred Drake90fdda51999-02-16 20:27:42 +00001266 $the_title .= "\n<h1>$t_title</h1>";
Fred Drake3be20742000-08-31 06:22:54 +00001267 }
1268 else {
1269 write_warnings("\nThis document has no title.");
1270 }
Fred Drake6659c301998-03-03 22:02:19 +00001271 if ($t_author) {
1272 if ($t_authorURL) {
Fred Drake08932051998-04-17 02:15:42 +00001273 my $href = translate_commands($t_authorURL);
Fred Drake2d1f81e1999-02-09 16:03:31 +00001274 $href = make_named_href('author', $href,
1275 "<b><font size='+2'>$t_author</font></b>");
Fred Drakec9a44381998-03-17 06:29:13 +00001276 $the_title .= "\n<p>$href</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001277 }
1278 else {
Fred Drake2d1f81e1999-02-09 16:03:31 +00001279 $the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>");
Fred Drake6659c301998-03-03 22:02:19 +00001280 }
Fred Drake3be20742000-08-31 06:22:54 +00001281 }
1282 else {
1283 write_warnings("\nThere is no author for this document.");
1284 }
Fred Drake6659c301998-03-03 22:02:19 +00001285 if ($t_institute) {
Fred Drake3be20742000-08-31 06:22:54 +00001286 $the_title .= "\n<p>$t_institute</p>";
1287 }
Fred Draked07868a1998-05-14 21:00:28 +00001288 if ($DEVELOPER_ADDRESS) {
Fred Drake3be20742000-08-31 06:22:54 +00001289 $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";
1290 }
Fred Drake6659c301998-03-03 22:02:19 +00001291 if ($t_affil) {
Fred Drake3be20742000-08-31 06:22:54 +00001292 $the_title .= "\n<p><i>$t_affil</i></p>";
1293 }
Fred Drake6659c301998-03-03 22:02:19 +00001294 if ($t_date) {
Fred Drakede77bc52000-12-14 18:36:12 +00001295 $the_title .= "\n<p>";
Fred Draked04592a2000-10-25 16:15:13 +00001296 if ($PACKAGE_VERSION) {
Fred Drakede77bc52000-12-14 18:36:12 +00001297 $the_title .= "<strong>Release $PACKAGE_VERSION</strong><br>\n";
Fred Drake3be20742000-08-31 06:22:54 +00001298 }
Fred Drakede77bc52000-12-14 18:36:12 +00001299 $the_title .= "<strong>$t_date</strong></p>"
Fred Drake6659c301998-03-03 22:02:19 +00001300 }
1301 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +00001302 $the_title .= "\n<p>$t_address</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001303 }
1304 else {
1305 $the_title .= "\n<p>";
1306 }
Fred Drake6659c301998-03-03 22:02:19 +00001307 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +00001308 $the_title .= "\n<p>$t_email</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001309 }
1310 return $the_title;
1311}
1312
Fred Drake3be20742000-08-31 06:22:54 +00001313sub make_my_titlegraphic() {
Fred Drake7a40c072000-10-02 14:43:38 +00001314 my $filename = make_icon_filename($TITLE_PAGE_GRAPHIC);
Fred Drake3be20742000-08-31 06:22:54 +00001315 my $graphic = "<td class=\"titlegraphic\"";
1316 $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_COLWIDTH\""
1317 if ($TITLE_PAGE_GRAPHIC_COLWIDTH);
1318 $graphic .= "><img";
1319 $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_WIDTH\""
1320 if ($TITLE_PAGE_GRAPHIC_WIDTH);
1321 $graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\""
1322 if ($TITLE_PAGE_GRAPHIC_HEIGHT);
Fred Drake5f84c9b2000-10-03 06:05:25 +00001323 $graphic .= "\n src=\"$filename\"></td>\n";
Fred Drake3be20742000-08-31 06:22:54 +00001324 return $graphic;
1325}
1326
1327sub do_cmd_maketitle {
1328 local($_) = @_;
1329 my $the_title = "\n<div class=\"titlepage\">";
1330 if ($TITLE_PAGE_GRAPHIC) {
1331 if ($TITLE_PAGE_GRAPHIC_ON_RIGHT) {
1332 $the_title .= ("\n<table border=\"0\" width=\"100%\">"
1333 . "<tr align=\"right\">\n<td>"
1334 . make_my_titlepage()
1335 . "</td>\n"
1336 . make_my_titlegraphic()
1337 . "</tr>\n</table>");
1338 }
1339 else {
1340 $the_title .= ("\n<table border=\"0\" width=\"100%\"><tr>\n"
1341 . make_my_titlegraphic()
1342 . "<td>"
1343 . make_my_titlepage()
1344 . "</td></tr>\n</table>");
1345 }
1346 }
1347 else {
1348 $the_title .= ("\n<center>"
1349 . make_my_titlepage()
1350 . "\n</center>");
1351 }
1352 $the_title .= "\n</div>";
1353 return $the_title . $_;
Fred Drake90fdda51999-02-16 20:27:42 +00001354 $the_title .= "\n</center></div>";
Fred Drake62e43691998-08-10 19:40:44 +00001355 return $the_title . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +00001356}
1357
1358
Fred Drake885215c1998-05-20 21:32:09 +00001359#
Fred Drakea0f4c941998-07-24 22:16:04 +00001360# Module synopsis support
1361#
1362
1363require SynopsisTable;
1364
Fred Drakef7685d71998-07-25 03:31:46 +00001365sub get_chapter_id(){
1366 my $id = do_cmd_thechapter('');
Fred Drake45f26011998-08-04 22:07:18 +00001367 $id =~ s/<SPAN CLASS="arabic">(\d+)<\/SPAN>/\1/;
1368 $id =~ s/\.//;
Fred Drakef7685d71998-07-25 03:31:46 +00001369 return $id;
Fred Drakea0f4c941998-07-24 22:16:04 +00001370}
1371
Fred Drake643d76d2000-09-09 06:07:37 +00001372# 'chapter' => 'SynopsisTable instance'
1373%ModuleSynopses = ();
Fred Drakef7685d71998-07-25 03:31:46 +00001374
1375sub get_synopsis_table($){
1376 my($chap) = @_;
Fred Drakef7685d71998-07-25 03:31:46 +00001377 my $key;
1378 foreach $key (keys %ModuleSynopses) {
1379 if ($key eq $chap) {
1380 return $ModuleSynopses{$chap};
1381 }
Fred Drakea0f4c941998-07-24 22:16:04 +00001382 }
Fred Drake643d76d2000-09-09 06:07:37 +00001383 my $st = SynopsisTable->new();
Fred Drakef7685d71998-07-25 03:31:46 +00001384 $ModuleSynopses{$chap} = $st;
Fred Drakea0f4c941998-07-24 22:16:04 +00001385 return $st;
1386}
1387
Fred Drake62e43691998-08-10 19:40:44 +00001388sub do_cmd_moduleauthor{
1389 local($_) = @_;
1390 next_argument();
1391 next_argument();
1392 return $_;
1393}
1394
1395sub do_cmd_sectionauthor{
1396 local($_) = @_;
1397 next_argument();
1398 next_argument();
1399 return $_;
1400}
1401
Fred Drakea0f4c941998-07-24 22:16:04 +00001402sub do_cmd_declaremodule{
1403 local($_) = @_;
1404 my $key = next_optional_argument();
1405 my $type = next_argument();
1406 my $name = next_argument();
1407 my $st = get_synopsis_table(get_chapter_id());
1408 #
1409 $key = $name unless $key;
1410 $type = 'built-in' if $type eq 'builtin';
1411 $st->declare($name, $key, $type);
1412 define_module($type, $name);
Fred Drake62e43691998-08-10 19:40:44 +00001413 return anchor_label("module-$key",$CURRENT_FILE,$_)
Fred Drakea0f4c941998-07-24 22:16:04 +00001414}
1415
1416sub do_cmd_modulesynopsis{
1417 local($_) = @_;
1418 my $st = get_synopsis_table(get_chapter_id());
Fred Drake1cc58991999-04-13 22:08:59 +00001419 $st->set_synopsis($THIS_MODULE, translate_commands(next_argument()));
Fred Drake62e43691998-08-10 19:40:44 +00001420 return $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001421}
1422
1423sub do_cmd_localmoduletable{
1424 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001425 my $chap = get_chapter_id();
Fred Drake643d76d2000-09-09 06:07:37 +00001426 my $st = get_synopsis_table($chap);
1427 $st->set_file("$CURRENT_FILE");
Fred Drake557460c1999-03-02 16:05:35 +00001428 return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001429}
1430
1431sub process_all_localmoduletables{
Fred Drake643d76d2000-09-09 06:07:37 +00001432 my $key;
1433 my $st, $file;
1434 foreach $key (keys %ModuleSynopses) {
1435 $st = $ModuleSynopses{$key};
1436 $file = $st->get_file();
1437 if ($file) {
1438 process_localmoduletables_in_file($file);
1439 }
1440 else {
1441 print "\nsynopsis table $key has no file association";
1442 }
1443 }
1444}
1445
1446sub process_localmoduletables_in_file{
1447 my $file = @_[0];
1448 open(MYFILE, "<$file");
1449 local($_);
1450 sysread(MYFILE, $_, 1024*1024);
1451 close(MYFILE);
1452 # need to get contents of file in $_
Fred Drake557460c1999-03-02 16:05:35 +00001453 while (/<tex2html-localmoduletable><(\d+)>/) {
Fred Drakef7685d71998-07-25 03:31:46 +00001454 my $match = $&;
Fred Drakea0f4c941998-07-24 22:16:04 +00001455 my $chap = $1;
1456 my $st = get_synopsis_table($chap);
1457 my $data = $st->tohtml();
Fred Drakef7685d71998-07-25 03:31:46 +00001458 s/$match/$data/;
Fred Drakea0f4c941998-07-24 22:16:04 +00001459 }
Fred Drake643d76d2000-09-09 06:07:37 +00001460 open(MYFILE,">$file");
1461 print MYFILE $_;
1462 close(MYFILE);
Fred Drakea0f4c941998-07-24 22:16:04 +00001463}
Fred Drake557460c1999-03-02 16:05:35 +00001464sub process_python_state{
1465 process_all_localmoduletables();
Fred Drake557460c1999-03-02 16:05:35 +00001466}
Fred Drakea0f4c941998-07-24 22:16:04 +00001467
1468
1469#
1470# "See also:" -- references placed at the end of a \section
1471#
1472
1473sub do_env_seealso{
Fred Drakee15956b2000-04-03 04:51:13 +00001474 return "<div class='seealso'>\n "
1475 . "<p class='heading'><b>See Also:</b></p>\n"
Fred Drake90fdda51999-02-16 20:27:42 +00001476 . @_[0]
1477 . '</div>';
Fred Drakea0f4c941998-07-24 22:16:04 +00001478}
1479
1480sub do_cmd_seemodule{
1481 # Insert the right magic to jump to the module definition. This should
1482 # work most of the time, at least for repeat builds....
1483 local($_) = @_;
1484 my $key = next_optional_argument();
1485 my $module = next_argument();
1486 my $text = next_argument();
Fred Drake84bd6f31999-05-11 15:42:51 +00001487 my $period = '.';
Fred Drakea0f4c941998-07-24 22:16:04 +00001488 $key = $module
1489 unless $key;
Fred Drake84bd6f31999-05-11 15:42:51 +00001490 if ($text =~ /\.$/) {
1491 $period = '';
1492 }
Fred Drakee15956b2000-04-03 04:51:13 +00001493 return '<dl compact class="seemodule">'
1494 . "\n <dt>Module <b><tt class='module'><a href='module-$key.html'>"
Fred Drake84bd6f31999-05-11 15:42:51 +00001495 . "$module</a></tt>:</b>"
1496 . "\n <dd>$text$period\n </dl>"
Fred Drake90fdda51999-02-16 20:27:42 +00001497 . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001498}
1499
Fred Drake643d76d2000-09-09 06:07:37 +00001500sub handle_rfclike_reference{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001501 local($_, $what, $format) = @_;
Fred Drake37cc0c02000-04-26 18:05:24 +00001502 my $rfcnum = next_argument();
1503 my $title = next_argument();
1504 my $text = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +00001505 my $url = get_rfc_url($rfcnum, $format);
Fred Drake7a40c072000-10-02 14:43:38 +00001506 my $icon = get_link_icon($url);
Fred Drake37cc0c02000-04-26 18:05:24 +00001507 return '<dl compact class="seerfc">'
1508 . "\n <dt><a href=\"$url\""
1509 . "\n title=\"$title\""
Fred Drake5f84c9b2000-10-03 06:05:25 +00001510 . "\n >$what $rfcnum, <em>$title</em>$icon</a>"
Fred Drake37cc0c02000-04-26 18:05:24 +00001511 . "\n <dd>$text\n </dl>"
1512 . $_;
1513}
1514
Fred Drake643d76d2000-09-09 06:07:37 +00001515sub do_cmd_seepep{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001516 return handle_rfclike_reference(@_[0], "PEP", $PEP_FORMAT);
Fred Drake643d76d2000-09-09 06:07:37 +00001517}
1518
1519sub do_cmd_seerfc{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001520 return handle_rfclike_reference(@_[0], "RFC", $RFC_FORMAT);
Fred Drake643d76d2000-09-09 06:07:37 +00001521}
1522
Fred Drake48449982000-09-12 17:52:33 +00001523sub do_cmd_seetitle{
1524 local($_) = @_;
1525 my $url = next_optional_argument();
1526 my $title = next_argument();
1527 my $text = next_argument();
1528 if ($url) {
Fred Drake5f84c9b2000-10-03 06:05:25 +00001529 my $icon = get_link_icon($url);
Fred Drake48449982000-09-12 17:52:33 +00001530 return '<dl compact class="seetitle">'
1531 . "\n <dt><em class=\"citetitle\"><a href=\"$url\""
Fred Drake7a40c072000-10-02 14:43:38 +00001532 . "\n >$title$icon</a></em>"
Fred Drake48449982000-09-12 17:52:33 +00001533 . "\n <dd>$text\n </dl>"
1534 . $_;
1535 }
1536 return '<dl compact class="seetitle">'
1537 . "\n <dt><em class=\"citetitle\""
1538 . "\n >$title</em>"
1539 . "\n <dd>$text\n </dl>"
1540 . $_;
1541}
1542
Fred Drakeef4d1112000-05-09 16:17:51 +00001543sub do_cmd_seeurl{
1544 local($_) = @_;
1545 my $url = next_argument();
1546 my $text = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +00001547 my $icon = get_link_icon($url);
Fred Drakeef4d1112000-05-09 16:17:51 +00001548 return '<dl compact class="seeurl">'
1549 . "\n <dt><a href=\"$url\""
Fred Drake7a40c072000-10-02 14:43:38 +00001550 . "\n class=\"url\">$url$icon</a>"
Fred Drakeef4d1112000-05-09 16:17:51 +00001551 . "\n <dd>$text\n </dl>"
1552 . $_;
1553}
1554
Fred Drakea0f4c941998-07-24 22:16:04 +00001555sub do_cmd_seetext{
Fred Drake79189b51999-04-28 13:54:30 +00001556 local($_) = @_;
1557 my $content = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001558 return '<div class="seetext"><p>' . $content . '</div>' . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001559}
1560
1561
1562#
Fred Drake885215c1998-05-20 21:32:09 +00001563# Definition list support.
1564#
1565
1566sub do_env_definitions{
Fred Drake37cc0c02000-04-26 18:05:24 +00001567 return "<dl class='definitions'>" . @_[0] . "</dl>\n";
Fred Drake885215c1998-05-20 21:32:09 +00001568}
1569
1570sub do_cmd_term{
1571 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +00001572 my $term = next_argument();
1573 my($name,$aname,$ahref) = new_link_info();
Fred Drake885215c1998-05-20 21:32:09 +00001574 # could easily add an index entry here...
Fred Drake62e43691998-08-10 19:40:44 +00001575 return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_;
Fred Drake885215c1998-05-20 21:32:09 +00001576}
1577
1578
Fred Drake38178fd2000-09-22 17:05:04 +00001579# I don't recall exactly why this was needed, but it was very much needed.
1580# We'll see if anything breaks when I move the "code" line out -- some
1581# things broke with it in.
1582
1583#code # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001584process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_);
Fred Drake2e1ee3e1999-02-10 21:17:04 +00001585declaremodule # [] # {} # {}
1586memberline # [] # {}
1587methodline # [] # {} # {}
1588modulesynopsis # {}
Fred Drake557460c1999-03-02 16:05:35 +00001589platform # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001590samp # {}
Fred Drake2e1ee3e1999-02-10 21:17:04 +00001591setindexsubitem # {}
Fred Drakef32834c1999-02-12 22:06:32 +00001592withsubitem # {} # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001593_RAW_ARG_DEFERRED_CMDS_
1594
1595
Fred Drake6659c301998-03-03 22:02:19 +000015961; # This must be the last line