blob: 289bb05845b76b0a405dc2e72e20d081df5e844e [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 Drake62e43691998-08-10 19:40:44 +0000885 return "<dl><dt><b>$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 Drake62e43691998-08-10 19:40:44 +0000898 return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
Fred Drakec9a44381998-03-17 06:29:13 +0000899}
900
Fred Drake643d76d2000-09-09 06:07:37 +0000901sub do_env_classdesc{
902 return handle_classlike_descriptor(@_[0], "class");
903}
904
905sub do_env_excclassdesc{
906 return handle_classlike_descriptor(@_[0], "exception");
907}
908
Fred Drake42b31a51998-03-27 05:16:10 +0000909
910sub do_env_methoddesc{
911 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000912 my $class_name = next_optional_argument();
913 $class_name = $THIS_CLASS
914 unless $class_name;
Fred Drake5a0ca4e1999-01-12 04:16:51 +0000915 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000916 my $arg_list = convert_args(next_argument());
Fred Drake08932051998-04-17 02:15:42 +0000917 my $extra = '';
918 if ($class_name) {
919 $extra = " ($class_name method)";
Fred Drake42b31a51998-03-27 05:16:10 +0000920 }
Fred Drakee15956b2000-04-03 04:51:13 +0000921 my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra");
Fred Drake08932051998-04-17 02:15:42 +0000922 $idx =~ s/ \(.*\)//;
923 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000924 return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000925}
926
927
Fred Drake7d45f6d1999-01-05 14:39:27 +0000928sub do_cmd_methodline{
929 local($_) = @_;
930 my $class_name = next_optional_argument();
931 $class_name = $THIS_CLASS
932 unless $class_name;
933 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000934 my $arg_list = convert_args(next_argument());
Fred Drake7d45f6d1999-01-05 14:39:27 +0000935 my $extra = '';
936 if ($class_name) {
937 $extra = " ($class_name method)";
938 }
Fred Drakee15956b2000-04-03 04:51:13 +0000939 my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra");
Fred Drake7d45f6d1999-01-05 14:39:27 +0000940 $idx =~ s/ \(.*\)//;
941 $idx =~ s/\(\)//;
942 return "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>"
943 . $_;
944}
945
946
Fred Draked64a40d1998-09-10 18:59:13 +0000947sub do_cmd_methodlineni{
948 local($_) = @_;
949 next_optional_argument();
950 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000951 my $arg_list = convert_args(next_argument());
Fred Draked64a40d1998-09-10 18:59:13 +0000952 return "<dt><b>$method</b> (<var>$arg_list</var>)\n<dd>"
953 . $_;
954}
955
Fred Drake42b31a51998-03-27 05:16:10 +0000956sub do_env_methoddescni{
957 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000958 next_optional_argument();
959 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000960 my $arg_list = convert_args(next_argument());
Fred Drake62e43691998-08-10 19:40:44 +0000961 return "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>"
962 . $_
963 . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000964}
965
966
967sub do_env_memberdesc{
968 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000969 my $class = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000970 my $member = next_argument();
Fred Drake42b31a51998-03-27 05:16:10 +0000971 $class = $THIS_CLASS
972 unless $class;
Fred Drake08932051998-04-17 02:15:42 +0000973 my $extra = '';
Fred Drake085b8121999-04-21 14:00:29 +0000974 $extra = " ($class attribute)"
975 if ($class ne '');
Fred Drakee15956b2000-04-03 04:51:13 +0000976 my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra");
Fred Drake42b31a51998-03-27 05:16:10 +0000977 $idx =~ s/ \(.*\)//;
978 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000979 return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000980}
981
982
Fred Drake5ccf3301998-04-17 20:04:09 +0000983sub do_cmd_memberline{
984 local($_) = @_;
985 my $class = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000986 my $member = next_argument();
Fred Drake5ccf3301998-04-17 20:04:09 +0000987 $class = $THIS_CLASS
988 unless $class;
989 my $extra = '';
Fred Drake085b8121999-04-21 14:00:29 +0000990 $extra = " ($class attribute)"
991 if ($class ne '');
Fred Drakee15956b2000-04-03 04:51:13 +0000992 my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra");
Fred Drake5ccf3301998-04-17 20:04:09 +0000993 $idx =~ s/ \(.*\)//;
994 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000995 return "<dt><b>$idx</b><dd>" . $_;
Fred Drake5ccf3301998-04-17 20:04:09 +0000996}
997
Fred Drake42b31a51998-03-27 05:16:10 +0000998sub do_env_memberdescni{
999 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +00001000 next_optional_argument();
1001 my $member = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001002 return "<dl><dt><b><tt class='member'>$member</tt></b>\n<dd>"
1003 . $_
1004 . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +00001005}
1006
1007
Fred Drake5ccf3301998-04-17 20:04:09 +00001008sub do_cmd_memberlineni{
1009 local($_) = @_;
1010 next_optional_argument();
1011 my $member = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001012 return "<dt><b><tt class='member'>$member</tt></b><dd>" . $_;
Fred Drake5ccf3301998-04-17 20:04:09 +00001013}
1014
Fred Drakee15956b2000-04-03 04:51:13 +00001015@col_aligns = ('<td>', '<td>', '<td>', '<td>');
Fred Drake6659c301998-03-03 22:02:19 +00001016
Fred Drakef74e5b71999-04-28 14:58:49 +00001017sub fix_font{
1018 # do a little magic on a font name to get the right behavior in the first
1019 # column of the output table
1020 my $font = @_[0];
1021 if ($font eq 'textrm') {
1022 $font = '';
1023 }
1024 elsif ($font eq 'file' || $font eq 'filenq') {
Fred Drakee15956b2000-04-03 04:51:13 +00001025 $font = 'tt class="file"';
1026 }
1027 elsif ($font eq 'member') {
1028 $font = 'tt class="member"';
Fred Drakef74e5b71999-04-28 14:58:49 +00001029 }
Fred Drakee463f8e2000-11-30 07:17:27 +00001030 elsif ($font eq 'class') {
1031 $font = 'tt class="class"';
1032 }
Fred Drake7388f732000-06-28 21:06:08 +00001033 elsif ($font eq 'constant') {
1034 $font = 'tt class="constant"';
1035 }
Fred Drakecb0fc9c2000-08-09 13:45:04 +00001036 elsif ($font eq 'kbd') {
1037 $font = 'kbd';
1038 }
Fred Draked04592a2000-10-25 16:15:13 +00001039 elsif ($font eq 'programopt') {
1040 $font = 'b';
1041 }
Fred Drakeafc7ce12001-01-22 17:33:24 +00001042 elsif ($font eq 'exception') {
1043 $font = 'tt class="exception"';
1044 }
Fred Drakef74e5b71999-04-28 14:58:49 +00001045 return $font;
1046}
1047
Fred Drakee15956b2000-04-03 04:51:13 +00001048sub figure_column_alignment{
1049 my $a = @_[0];
1050 my $mark = substr($a, 0, 1);
1051 my $r = '';
1052 if ($mark eq 'c')
1053 { $r = ' align="center"'; }
1054 elsif ($mark eq 'r')
1055 { $r = ' align="right"'; }
1056 elsif ($mark eq 'l')
1057 { $r = ' align="left"'; }
1058 elsif ($mark eq 'p')
1059 { $r = ' align="left"'; }
1060 return $r;
1061}
1062
Fred Drake6659c301998-03-03 22:02:19 +00001063sub setup_column_alignments{
1064 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001065 my($s1,$s2,$s3,$s4) = split(/[|]/,$_);
1066 my $a1 = figure_column_alignment($s1);
1067 my $a2 = figure_column_alignment($s2);
1068 my $a3 = figure_column_alignment($s3);
1069 my $a4 = figure_column_alignment($s4);
1070 $col_aligns[0] = "<td$a1 valign=\"baseline\">";
1071 $col_aligns[1] = "<td$a2>";
1072 $col_aligns[2] = "<td$a3>";
1073 $col_aligns[3] = "<td$a4>";
Fred Drake79189b51999-04-28 13:54:30 +00001074 # return the aligned header start tags
Fred Drakee15956b2000-04-03 04:51:13 +00001075 return ("<th$a1>", "<th$a2>", "<th$a3>", "<th$a4>");
1076}
1077
1078sub get_table_col1_fonts{
1079 my $font = $globals{'lineifont'};
1080 my ($sfont,$efont) = ('', '');
1081 if ($font) {
1082 $sfont = "<$font>";
1083 $efont = "</$font>";
1084 $efont =~ s/ .*>/>/;
1085 }
Fred Drakee463f8e2000-11-30 07:17:27 +00001086 return ($sfont, $efont);
Fred Drake6659c301998-03-03 22:02:19 +00001087}
1088
1089sub do_env_tableii{
1090 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001091 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001092 my $font = fix_font(next_argument());
Fred Drake08932051998-04-17 02:15:42 +00001093 my $h1 = next_argument();
1094 my $h2 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001095 s/[\s\n]+//;
Fred Drake08932051998-04-17 02:15:42 +00001096 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001097 my $a1 = $col_aligns[0];
1098 my $a2 = $col_aligns[1];
1099 s/\\lineii</\\lineii[$a1|$a2]</g;
1100 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001101 . "\n <thead>"
1102 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001103 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1104 . "\n $th2<b>$h2</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001105 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001106 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001107 . "\n <tbody valign='baseline'>"
Fred Drake351960d2000-10-26 20:14:58 +00001108 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001109 . "\n </tbody>"
1110 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001111}
1112
Fred Drakeda72b932000-09-21 15:58:02 +00001113sub do_env_longtableii{
1114 return do_env_tableii(@_);
1115}
1116
Fred Drake6659c301998-03-03 22:02:19 +00001117sub do_cmd_lineii{
1118 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001119 my $aligns = next_optional_argument();
Fred Drake08932051998-04-17 02:15:42 +00001120 my $c1 = next_argument();
1121 my $c2 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001122 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001123 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001124 $c2 = '&nbsp;' if ($c2 eq '');
1125 my($c1align,$c2align) = split('\|', $aligns);
1126 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001127 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001128 $padding = '&nbsp;';
Fred Drake58b2bfd1998-04-02 20:14:04 +00001129 }
Fred Drakee15956b2000-04-03 04:51:13 +00001130 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
1131 . " $c2align$c2</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001132 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001133}
1134
1135sub do_env_tableiii{
1136 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001137 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001138 my $font = fix_font(next_argument());
Fred Drake08932051998-04-17 02:15:42 +00001139 my $h1 = next_argument();
1140 my $h2 = next_argument();
1141 my $h3 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001142 s/[\s\n]+//;
Fred Drake08932051998-04-17 02:15:42 +00001143 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001144 my $a1 = $col_aligns[0];
1145 my $a2 = $col_aligns[1];
1146 my $a3 = $col_aligns[2];
1147 s/\\lineiii</\\lineiii[$a1|$a2|$a3]</g;
1148 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001149 . "\n <thead>"
1150 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001151 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1152 . "\n $th2<b>$h2</b>\&nbsp;</th>"
1153 . "\n $th3<b>$h3</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001154 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001155 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001156 . "\n <tbody valign='baseline'>"
Fred Drake62e43691998-08-10 19:40:44 +00001157 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001158 . "\n </tbody>"
1159 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001160}
1161
Fred Drakeda72b932000-09-21 15:58:02 +00001162sub do_env_longtableiii{
1163 return do_env_tableiii(@_);
1164}
1165
Fred Drake6659c301998-03-03 22:02:19 +00001166sub do_cmd_lineiii{
1167 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001168 my $aligns = next_optional_argument();
Fred Drake08932051998-04-17 02:15:42 +00001169 my $c1 = next_argument();
1170 my $c2 = next_argument();
1171 my $c3 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001172 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001173 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001174 $c3 = '&nbsp;' if ($c3 eq '');
1175 my($c1align,$c2align,$c3align) = split('\|', $aligns);
1176 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001177 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001178 $padding = '&nbsp;';
Fred Drake58b2bfd1998-04-02 20:14:04 +00001179 }
Fred Drakee15956b2000-04-03 04:51:13 +00001180 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
Fred Drakef74e5b71999-04-28 14:58:49 +00001181 . " $c2align$c2</td>\n"
Fred Drakee15956b2000-04-03 04:51:13 +00001182 . " $c3align$c3</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001183 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001184}
1185
Fred Drakea0f4c941998-07-24 22:16:04 +00001186sub do_env_tableiv{
1187 local($_) = @_;
1188 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001189 my $font = fix_font(next_argument());
Fred Drakea0f4c941998-07-24 22:16:04 +00001190 my $h1 = next_argument();
1191 my $h2 = next_argument();
1192 my $h3 = next_argument();
1193 my $h4 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001194 s/[\s\n]+//;
Fred Drakea0f4c941998-07-24 22:16:04 +00001195 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001196 my $a1 = $col_aligns[0];
1197 my $a2 = $col_aligns[1];
1198 my $a3 = $col_aligns[2];
1199 my $a4 = $col_aligns[3];
1200 s/\\lineiv</\\lineiv[$a1|$a2|$a3|$a4]</g;
1201 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001202 . "\n <thead>"
1203 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001204 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1205 . "\n $th2<b>$h2</b>\&nbsp;</th>"
1206 . "\n $th3<b>$h3</b>\&nbsp;</th>"
1207 . "\n $th4<b>$h4</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001208 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001209 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001210 . "\n <tbody valign='baseline'>"
Fred Drake62e43691998-08-10 19:40:44 +00001211 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001212 . "\n </tbody>"
1213 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001214}
1215
Fred Drakeda72b932000-09-21 15:58:02 +00001216sub do_env_longtableiv{
1217 return do_env_tableiv(@_);
1218}
1219
Fred Drakea0f4c941998-07-24 22:16:04 +00001220sub do_cmd_lineiv{
Fred Drake6659c301998-03-03 22:02:19 +00001221 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001222 my $aligns = next_optional_argument();
Fred Drakea0f4c941998-07-24 22:16:04 +00001223 my $c1 = next_argument();
1224 my $c2 = next_argument();
1225 my $c3 = next_argument();
1226 my $c4 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001227 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001228 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001229 $c4 = '&nbsp;' if ($c4 eq '');
1230 my($c1align,$c2align,$c3align,$c4align) = split('\|', $aligns);
1231 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001232 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001233 $padding = '&nbsp;';
Fred Drakea0f4c941998-07-24 22:16:04 +00001234 }
Fred Drakee15956b2000-04-03 04:51:13 +00001235 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
Fred Drakef74e5b71999-04-28 14:58:49 +00001236 . " $c2align$c2</td>\n"
1237 . " $c3align$c3</td>\n"
Fred Drakee15956b2000-04-03 04:51:13 +00001238 . " $c4align$c4</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001239 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001240}
1241
Fred Drake3be20742000-08-31 06:22:54 +00001242
1243# These can be used to control the title page appearance;
1244# they need a little bit of documentation.
1245#
1246# If $TITLE_PAGE_GRAPHIC is set, it should be the name of a file in the
1247# $ICONSERVER directory, or include path information (other than "./"). The
1248# default image type will be assumed if an extension is not provided.
1249#
1250# If specified, the "title page" will contain two colums: one containing the
1251# title/author/etc., and the other containing the graphic. Use the other
1252# four variables listed here to control specific details of the layout; all
1253# are optional.
1254#
1255# $TITLE_PAGE_GRAPHIC = "my-company-logo";
1256# $TITLE_PAGE_GRAPHIC_COLWIDTH = "30%";
1257# $TITLE_PAGE_GRAPHIC_WIDTH = 150;
1258# $TITLE_PAGE_GRAPHIC_HEIGHT = 150;
1259# $TITLE_PAGE_GRAPHIC_ON_RIGHT = 0;
1260
1261sub make_my_titlepage() {
1262 my $the_title = "";
Fred Drake6659c301998-03-03 22:02:19 +00001263 if ($t_title) {
Fred Drake90fdda51999-02-16 20:27:42 +00001264 $the_title .= "\n<h1>$t_title</h1>";
Fred Drake3be20742000-08-31 06:22:54 +00001265 }
1266 else {
1267 write_warnings("\nThis document has no title.");
1268 }
Fred Drake6659c301998-03-03 22:02:19 +00001269 if ($t_author) {
1270 if ($t_authorURL) {
Fred Drake08932051998-04-17 02:15:42 +00001271 my $href = translate_commands($t_authorURL);
Fred Drake2d1f81e1999-02-09 16:03:31 +00001272 $href = make_named_href('author', $href,
1273 "<b><font size='+2'>$t_author</font></b>");
Fred Drakec9a44381998-03-17 06:29:13 +00001274 $the_title .= "\n<p>$href</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001275 }
1276 else {
Fred Drake2d1f81e1999-02-09 16:03:31 +00001277 $the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>");
Fred Drake6659c301998-03-03 22:02:19 +00001278 }
Fred Drake3be20742000-08-31 06:22:54 +00001279 }
1280 else {
1281 write_warnings("\nThere is no author for this document.");
1282 }
Fred Drake6659c301998-03-03 22:02:19 +00001283 if ($t_institute) {
Fred Drake3be20742000-08-31 06:22:54 +00001284 $the_title .= "\n<p>$t_institute</p>";
1285 }
Fred Draked07868a1998-05-14 21:00:28 +00001286 if ($DEVELOPER_ADDRESS) {
Fred Drake3be20742000-08-31 06:22:54 +00001287 $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";
1288 }
Fred Drake6659c301998-03-03 22:02:19 +00001289 if ($t_affil) {
Fred Drake3be20742000-08-31 06:22:54 +00001290 $the_title .= "\n<p><i>$t_affil</i></p>";
1291 }
Fred Drake6659c301998-03-03 22:02:19 +00001292 if ($t_date) {
Fred Drakede77bc52000-12-14 18:36:12 +00001293 $the_title .= "\n<p>";
Fred Draked04592a2000-10-25 16:15:13 +00001294 if ($PACKAGE_VERSION) {
Fred Drakede77bc52000-12-14 18:36:12 +00001295 $the_title .= "<strong>Release $PACKAGE_VERSION</strong><br>\n";
Fred Drake3be20742000-08-31 06:22:54 +00001296 }
Fred Drakede77bc52000-12-14 18:36:12 +00001297 $the_title .= "<strong>$t_date</strong></p>"
Fred Drake6659c301998-03-03 22:02:19 +00001298 }
1299 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +00001300 $the_title .= "\n<p>$t_address</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001301 }
1302 else {
1303 $the_title .= "\n<p>";
1304 }
Fred Drake6659c301998-03-03 22:02:19 +00001305 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +00001306 $the_title .= "\n<p>$t_email</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001307 }
1308 return $the_title;
1309}
1310
Fred Drake3be20742000-08-31 06:22:54 +00001311sub make_my_titlegraphic() {
Fred Drake7a40c072000-10-02 14:43:38 +00001312 my $filename = make_icon_filename($TITLE_PAGE_GRAPHIC);
Fred Drake3be20742000-08-31 06:22:54 +00001313 my $graphic = "<td class=\"titlegraphic\"";
1314 $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_COLWIDTH\""
1315 if ($TITLE_PAGE_GRAPHIC_COLWIDTH);
1316 $graphic .= "><img";
1317 $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_WIDTH\""
1318 if ($TITLE_PAGE_GRAPHIC_WIDTH);
1319 $graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\""
1320 if ($TITLE_PAGE_GRAPHIC_HEIGHT);
Fred Drake5f84c9b2000-10-03 06:05:25 +00001321 $graphic .= "\n src=\"$filename\"></td>\n";
Fred Drake3be20742000-08-31 06:22:54 +00001322 return $graphic;
1323}
1324
1325sub do_cmd_maketitle {
1326 local($_) = @_;
1327 my $the_title = "\n<div class=\"titlepage\">";
1328 if ($TITLE_PAGE_GRAPHIC) {
1329 if ($TITLE_PAGE_GRAPHIC_ON_RIGHT) {
1330 $the_title .= ("\n<table border=\"0\" width=\"100%\">"
1331 . "<tr align=\"right\">\n<td>"
1332 . make_my_titlepage()
1333 . "</td>\n"
1334 . make_my_titlegraphic()
1335 . "</tr>\n</table>");
1336 }
1337 else {
1338 $the_title .= ("\n<table border=\"0\" width=\"100%\"><tr>\n"
1339 . make_my_titlegraphic()
1340 . "<td>"
1341 . make_my_titlepage()
1342 . "</td></tr>\n</table>");
1343 }
1344 }
1345 else {
1346 $the_title .= ("\n<center>"
1347 . make_my_titlepage()
1348 . "\n</center>");
1349 }
1350 $the_title .= "\n</div>";
1351 return $the_title . $_;
Fred Drake90fdda51999-02-16 20:27:42 +00001352 $the_title .= "\n</center></div>";
Fred Drake62e43691998-08-10 19:40:44 +00001353 return $the_title . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +00001354}
1355
1356
Fred Drake885215c1998-05-20 21:32:09 +00001357#
Fred Drakea0f4c941998-07-24 22:16:04 +00001358# Module synopsis support
1359#
1360
1361require SynopsisTable;
1362
Fred Drakef7685d71998-07-25 03:31:46 +00001363sub get_chapter_id(){
1364 my $id = do_cmd_thechapter('');
Fred Drake45f26011998-08-04 22:07:18 +00001365 $id =~ s/<SPAN CLASS="arabic">(\d+)<\/SPAN>/\1/;
1366 $id =~ s/\.//;
Fred Drakef7685d71998-07-25 03:31:46 +00001367 return $id;
Fred Drakea0f4c941998-07-24 22:16:04 +00001368}
1369
Fred Drake643d76d2000-09-09 06:07:37 +00001370# 'chapter' => 'SynopsisTable instance'
1371%ModuleSynopses = ();
Fred Drakef7685d71998-07-25 03:31:46 +00001372
1373sub get_synopsis_table($){
1374 my($chap) = @_;
Fred Drakef7685d71998-07-25 03:31:46 +00001375 my $key;
1376 foreach $key (keys %ModuleSynopses) {
1377 if ($key eq $chap) {
1378 return $ModuleSynopses{$chap};
1379 }
Fred Drakea0f4c941998-07-24 22:16:04 +00001380 }
Fred Drake643d76d2000-09-09 06:07:37 +00001381 my $st = SynopsisTable->new();
Fred Drakef7685d71998-07-25 03:31:46 +00001382 $ModuleSynopses{$chap} = $st;
Fred Drakea0f4c941998-07-24 22:16:04 +00001383 return $st;
1384}
1385
Fred Drake62e43691998-08-10 19:40:44 +00001386sub do_cmd_moduleauthor{
1387 local($_) = @_;
1388 next_argument();
1389 next_argument();
1390 return $_;
1391}
1392
1393sub do_cmd_sectionauthor{
1394 local($_) = @_;
1395 next_argument();
1396 next_argument();
1397 return $_;
1398}
1399
Fred Drakea0f4c941998-07-24 22:16:04 +00001400sub do_cmd_declaremodule{
1401 local($_) = @_;
1402 my $key = next_optional_argument();
1403 my $type = next_argument();
1404 my $name = next_argument();
1405 my $st = get_synopsis_table(get_chapter_id());
1406 #
1407 $key = $name unless $key;
1408 $type = 'built-in' if $type eq 'builtin';
1409 $st->declare($name, $key, $type);
1410 define_module($type, $name);
Fred Drake62e43691998-08-10 19:40:44 +00001411 return anchor_label("module-$key",$CURRENT_FILE,$_)
Fred Drakea0f4c941998-07-24 22:16:04 +00001412}
1413
1414sub do_cmd_modulesynopsis{
1415 local($_) = @_;
1416 my $st = get_synopsis_table(get_chapter_id());
Fred Drake1cc58991999-04-13 22:08:59 +00001417 $st->set_synopsis($THIS_MODULE, translate_commands(next_argument()));
Fred Drake62e43691998-08-10 19:40:44 +00001418 return $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001419}
1420
1421sub do_cmd_localmoduletable{
1422 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001423 my $chap = get_chapter_id();
Fred Drake643d76d2000-09-09 06:07:37 +00001424 my $st = get_synopsis_table($chap);
1425 $st->set_file("$CURRENT_FILE");
Fred Drake557460c1999-03-02 16:05:35 +00001426 return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001427}
1428
1429sub process_all_localmoduletables{
Fred Drake643d76d2000-09-09 06:07:37 +00001430 my $key;
1431 my $st, $file;
1432 foreach $key (keys %ModuleSynopses) {
1433 $st = $ModuleSynopses{$key};
1434 $file = $st->get_file();
1435 if ($file) {
1436 process_localmoduletables_in_file($file);
1437 }
1438 else {
1439 print "\nsynopsis table $key has no file association";
1440 }
1441 }
1442}
1443
1444sub process_localmoduletables_in_file{
1445 my $file = @_[0];
1446 open(MYFILE, "<$file");
1447 local($_);
1448 sysread(MYFILE, $_, 1024*1024);
1449 close(MYFILE);
1450 # need to get contents of file in $_
Fred Drake557460c1999-03-02 16:05:35 +00001451 while (/<tex2html-localmoduletable><(\d+)>/) {
Fred Drakef7685d71998-07-25 03:31:46 +00001452 my $match = $&;
Fred Drakea0f4c941998-07-24 22:16:04 +00001453 my $chap = $1;
1454 my $st = get_synopsis_table($chap);
1455 my $data = $st->tohtml();
Fred Drakef7685d71998-07-25 03:31:46 +00001456 s/$match/$data/;
Fred Drakea0f4c941998-07-24 22:16:04 +00001457 }
Fred Drake643d76d2000-09-09 06:07:37 +00001458 open(MYFILE,">$file");
1459 print MYFILE $_;
1460 close(MYFILE);
Fred Drakea0f4c941998-07-24 22:16:04 +00001461}
Fred Drake557460c1999-03-02 16:05:35 +00001462sub process_python_state{
1463 process_all_localmoduletables();
Fred Drake557460c1999-03-02 16:05:35 +00001464}
Fred Drakea0f4c941998-07-24 22:16:04 +00001465
1466
1467#
1468# "See also:" -- references placed at the end of a \section
1469#
1470
1471sub do_env_seealso{
Fred Drakee15956b2000-04-03 04:51:13 +00001472 return "<div class='seealso'>\n "
1473 . "<p class='heading'><b>See Also:</b></p>\n"
Fred Drake90fdda51999-02-16 20:27:42 +00001474 . @_[0]
1475 . '</div>';
Fred Drakea0f4c941998-07-24 22:16:04 +00001476}
1477
1478sub do_cmd_seemodule{
1479 # Insert the right magic to jump to the module definition. This should
1480 # work most of the time, at least for repeat builds....
1481 local($_) = @_;
1482 my $key = next_optional_argument();
1483 my $module = next_argument();
1484 my $text = next_argument();
Fred Drake84bd6f31999-05-11 15:42:51 +00001485 my $period = '.';
Fred Drakea0f4c941998-07-24 22:16:04 +00001486 $key = $module
1487 unless $key;
Fred Drake84bd6f31999-05-11 15:42:51 +00001488 if ($text =~ /\.$/) {
1489 $period = '';
1490 }
Fred Drakee15956b2000-04-03 04:51:13 +00001491 return '<dl compact class="seemodule">'
1492 . "\n <dt>Module <b><tt class='module'><a href='module-$key.html'>"
Fred Drake84bd6f31999-05-11 15:42:51 +00001493 . "$module</a></tt>:</b>"
1494 . "\n <dd>$text$period\n </dl>"
Fred Drake90fdda51999-02-16 20:27:42 +00001495 . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001496}
1497
Fred Drake643d76d2000-09-09 06:07:37 +00001498sub handle_rfclike_reference{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001499 local($_, $what, $format) = @_;
Fred Drake37cc0c02000-04-26 18:05:24 +00001500 my $rfcnum = next_argument();
1501 my $title = next_argument();
1502 my $text = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +00001503 my $url = get_rfc_url($rfcnum, $format);
Fred Drake7a40c072000-10-02 14:43:38 +00001504 my $icon = get_link_icon($url);
Fred Drake37cc0c02000-04-26 18:05:24 +00001505 return '<dl compact class="seerfc">'
1506 . "\n <dt><a href=\"$url\""
1507 . "\n title=\"$title\""
Fred Drake5f84c9b2000-10-03 06:05:25 +00001508 . "\n >$what $rfcnum, <em>$title</em>$icon</a>"
Fred Drake37cc0c02000-04-26 18:05:24 +00001509 . "\n <dd>$text\n </dl>"
1510 . $_;
1511}
1512
Fred Drake643d76d2000-09-09 06:07:37 +00001513sub do_cmd_seepep{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001514 return handle_rfclike_reference(@_[0], "PEP", $PEP_FORMAT);
Fred Drake643d76d2000-09-09 06:07:37 +00001515}
1516
1517sub do_cmd_seerfc{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001518 return handle_rfclike_reference(@_[0], "RFC", $RFC_FORMAT);
Fred Drake643d76d2000-09-09 06:07:37 +00001519}
1520
Fred Drake48449982000-09-12 17:52:33 +00001521sub do_cmd_seetitle{
1522 local($_) = @_;
1523 my $url = next_optional_argument();
1524 my $title = next_argument();
1525 my $text = next_argument();
1526 if ($url) {
Fred Drake5f84c9b2000-10-03 06:05:25 +00001527 my $icon = get_link_icon($url);
Fred Drake48449982000-09-12 17:52:33 +00001528 return '<dl compact class="seetitle">'
1529 . "\n <dt><em class=\"citetitle\"><a href=\"$url\""
Fred Drake7a40c072000-10-02 14:43:38 +00001530 . "\n >$title$icon</a></em>"
Fred Drake48449982000-09-12 17:52:33 +00001531 . "\n <dd>$text\n </dl>"
1532 . $_;
1533 }
1534 return '<dl compact class="seetitle">'
1535 . "\n <dt><em class=\"citetitle\""
1536 . "\n >$title</em>"
1537 . "\n <dd>$text\n </dl>"
1538 . $_;
1539}
1540
Fred Drakeef4d1112000-05-09 16:17:51 +00001541sub do_cmd_seeurl{
1542 local($_) = @_;
1543 my $url = next_argument();
1544 my $text = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +00001545 my $icon = get_link_icon($url);
Fred Drakeef4d1112000-05-09 16:17:51 +00001546 return '<dl compact class="seeurl">'
1547 . "\n <dt><a href=\"$url\""
Fred Drake7a40c072000-10-02 14:43:38 +00001548 . "\n class=\"url\">$url$icon</a>"
Fred Drakeef4d1112000-05-09 16:17:51 +00001549 . "\n <dd>$text\n </dl>"
1550 . $_;
1551}
1552
Fred Drakea0f4c941998-07-24 22:16:04 +00001553sub do_cmd_seetext{
Fred Drake79189b51999-04-28 13:54:30 +00001554 local($_) = @_;
1555 my $content = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001556 return '<div class="seetext"><p>' . $content . '</div>' . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001557}
1558
1559
1560#
Fred Drake885215c1998-05-20 21:32:09 +00001561# Definition list support.
1562#
1563
1564sub do_env_definitions{
Fred Drake37cc0c02000-04-26 18:05:24 +00001565 return "<dl class='definitions'>" . @_[0] . "</dl>\n";
Fred Drake885215c1998-05-20 21:32:09 +00001566}
1567
1568sub do_cmd_term{
1569 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +00001570 my $term = next_argument();
1571 my($name,$aname,$ahref) = new_link_info();
Fred Drake885215c1998-05-20 21:32:09 +00001572 # could easily add an index entry here...
Fred Drake62e43691998-08-10 19:40:44 +00001573 return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_;
Fred Drake885215c1998-05-20 21:32:09 +00001574}
1575
1576
Fred Drake38178fd2000-09-22 17:05:04 +00001577# I don't recall exactly why this was needed, but it was very much needed.
1578# We'll see if anything breaks when I move the "code" line out -- some
1579# things broke with it in.
1580
1581#code # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001582process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_);
Fred Drake2e1ee3e1999-02-10 21:17:04 +00001583declaremodule # [] # {} # {}
1584memberline # [] # {}
1585methodline # [] # {} # {}
1586modulesynopsis # {}
Fred Drake557460c1999-03-02 16:05:35 +00001587platform # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001588samp # {}
Fred Drake2e1ee3e1999-02-10 21:17:04 +00001589setindexsubitem # {}
Fred Drakef32834c1999-02-12 22:06:32 +00001590withsubitem # {} # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001591_RAW_ARG_DEFERRED_CMDS_
1592
1593
Fred Drake6659c301998-03-03 22:02:19 +000015941; # This must be the last line