Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1 | # 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 | |
| 9 | package main; |
| 10 | |
| 11 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 12 | sub next_argument{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 13 | my $param; |
| 14 | $param = missing_braces() |
| 15 | unless ((s/$next_pair_pr_rx/$param=$2;''/eo) |
| 16 | ||(s/$next_pair_rx/$param=$2;''/eo)); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 17 | return $param; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | sub next_optional_argument{ |
| 21 | my($param,$rx) = ('', "^\\s*(\\[([^]]*)\\])?"); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 22 | s/$rx/$param=$2;''/eo; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 23 | return $param; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 24 | } |
| 25 | |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 26 | |
| 27 | # This is a fairly simple hack; it supports \let when it is used to create |
| 28 | # (or redefine) a macro to exactly be some other macro: \let\newname=\oldname. |
Fred Drake | 5b73cdf | 1998-05-15 16:59:38 +0000 | [diff] [blame] | 29 | # Many possible uses of \let aren't supported or aren't supported correctly. |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 30 | # |
| 31 | sub do_cmd_let{ |
| 32 | local($_) = @_; |
| 33 | my $matched = 0; |
Fred Drake | 7a4ad0f | 1998-05-15 13:45:54 +0000 | [diff] [blame] | 34 | s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e; |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 35 | if ($matched) { |
| 36 | my($new, $old) = ($1, $3); |
| 37 | eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }'; |
| 38 | print "\ndefining handler for \\$new using \\$old\n"; |
| 39 | } |
Fred Drake | 7a4ad0f | 1998-05-15 13:45:54 +0000 | [diff] [blame] | 40 | else { |
| 41 | s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es; |
| 42 | if ($matched) { |
| 43 | my($new, $char) = ($1, $3); |
| 44 | eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }"; |
| 45 | print "\ndefining handler for \\$new to insert '$char'\n"; |
| 46 | } |
| 47 | else { |
| 48 | write_warnings("Could not interpret \\let construct..."); |
| 49 | } |
| 50 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 51 | return $_; |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 55 | # words typeset in a special way (not in HTML though) |
| 56 | |
| 57 | sub do_cmd_ABC{ 'ABC' . @_[0]; } |
| 58 | sub do_cmd_UNIX{ 'Unix'. @_[0]; } |
| 59 | sub do_cmd_ASCII{ 'ASCII' . @_[0]; } |
| 60 | sub do_cmd_POSIX{ 'POSIX' . @_[0]; } |
| 61 | sub do_cmd_C{ 'C' . @_[0]; } |
| 62 | sub do_cmd_Cpp{ 'C++' . @_[0]; } |
| 63 | sub do_cmd_EOF{ 'EOF' . @_[0]; } |
| 64 | sub do_cmd_NULL{ '<tt>NULL</tt>' . @_[0]; } |
| 65 | |
| 66 | sub do_cmd_e{ '\' . @_[0]; } |
| 67 | |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 68 | $DEVELOPER_ADDRESS = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 69 | $PYTHON_VERSION = ''; |
| 70 | |
| 71 | sub do_cmd_version{ $PYTHON_VERSION . @_[0]; } |
| 72 | sub do_cmd_release{ |
| 73 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 74 | $PYTHON_VERSION = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 75 | return $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | sub do_cmd_authoraddress{ |
| 79 | local($_) = @_; |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 80 | $DEVELOPER_ADDRESS = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 81 | return $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 84 | #sub do_cmd_developer{ do_cmd_author(@_[0]); } |
| 85 | #sub do_cmd_developers{ do_cmd_author(@_[0]); } |
| 86 | #sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); } |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 87 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 88 | sub do_cmd_hackscore{ |
| 89 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 90 | next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 91 | return '_' . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 92 | } |
| 93 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 94 | sub use_wrappers{ |
| 95 | local($_,$before,$after) = @_; |
| 96 | my $stuff = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 97 | return $before . $stuff . $after . $_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 98 | } |
| 99 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 100 | sub use_sans_serif{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 101 | return use_wrappers(@_[0], '<font face="sans-serif">', '</font>'); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 102 | } |
| 103 | sub use_italics{ |
| 104 | return use_wrappers(@_[0], '<i>', '</i>'); |
| 105 | } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 106 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 107 | sub do_cmd_optional{ |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 108 | return use_wrappers(@_[0], "</var><big>\[</big><var>", |
| 109 | "</var><big>\]</big><var>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 112 | # Logical formatting (some based on texinfo), needs to be converted to |
| 113 | # minimalist HTML. The "minimalist" is primarily to reduce the size of |
| 114 | # output files for users that read them over the network rather than |
| 115 | # from local repositories. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 116 | |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 117 | # \file and \samp are at the end of this file since they screw up fontlock. |
| 118 | |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 119 | sub do_cmd_pytype{ return @_[0]; } |
| 120 | sub do_cmd_makevar{ return @_[0]; } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 121 | sub do_cmd_code{ |
| 122 | return use_wrappers(@_[0], '<tt>', '</tt>'); } |
| 123 | sub do_cmd_module{ |
| 124 | return use_wrappers(@_[0], '<tt class=module>', '</tt>'); } |
| 125 | sub do_cmd_keyword{ |
| 126 | return use_wrappers(@_[0], '<tt class=keyword>', '</tt>'); } |
| 127 | sub do_cmd_exception{ |
| 128 | return use_wrappers(@_[0], '<tt class=exception>', '</tt>'); } |
| 129 | sub do_cmd_class{ |
| 130 | return use_wrappers(@_[0], '<tt class=class>', '</tt>'); } |
| 131 | sub do_cmd_function{ |
| 132 | return use_wrappers(@_[0], '<tt class=function>', '</tt>'); } |
| 133 | sub do_cmd_constant{ |
| 134 | return use_wrappers(@_[0], '<tt class=constant>', '</tt>'); } |
| 135 | sub do_cmd_member{ |
| 136 | return use_wrappers(@_[0], '<tt class=member>', '</tt>'); } |
| 137 | sub do_cmd_method{ |
| 138 | return use_wrappers(@_[0], '<tt class=method>', '</tt>'); } |
| 139 | sub do_cmd_cfunction{ |
| 140 | return use_wrappers(@_[0], '<tt class=cfunction>', '</tt>'); } |
| 141 | sub do_cmd_cdata{ |
| 142 | return use_wrappers(@_[0], '<tt class=cdata>', '</tt>'); } |
| 143 | sub do_cmd_ctype{ |
| 144 | return use_wrappers(@_[0], '<tt class=ctype>', '</tt>'); } |
| 145 | sub do_cmd_regexp{ |
| 146 | return use_wrappers(@_[0], '<tt class=regexp>', '</tt>'); } |
| 147 | sub do_cmd_character{ |
| 148 | return use_wrappers(@_[0], '"<tt class=character>', '</tt>"'); } |
| 149 | sub do_cmd_program{ |
| 150 | return use_wrappers(@_[0], '<b class=program>', '</b>'); } |
| 151 | sub do_cmd_email{ |
| 152 | return use_wrappers(@_[0], '<span class=email>', '</span>'); } |
| 153 | sub do_cmd_mimetype{ |
| 154 | return use_wrappers(@_[0], '<span class=mimetype>', '</span>'); } |
| 155 | sub do_cmd_var{ |
| 156 | return use_wrappers(@_[0], "<var>", "</var>"); } |
| 157 | sub do_cmd_dfn{ |
| 158 | return use_wrappers(@_[0], '<i class=dfn>', '</i>'); } |
| 159 | sub do_cmd_emph{ |
| 160 | return use_italics(@_); } |
| 161 | sub do_cmd_file{ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 162 | return use_wrappers(@_[0], '<tt class=file>', '</tt>'); } |
| 163 | sub do_cmd_filenq{ |
| 164 | return use_wrappers(@_[0], '<tt class=file>', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 165 | sub do_cmd_samp{ |
| 166 | return use_wrappers(@_[0], '"<tt class=samp>', '</tt>"'); } |
| 167 | sub do_cmd_kbd{ |
| 168 | return use_wrappers(@_[0], '<kbd>', '</kbd>'); } |
| 169 | sub do_cmd_strong{ |
| 170 | return use_wrappers(@_[0], '<b>', '</b>'); } |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 171 | sub do_cmd_textbf{ |
| 172 | return use_wrappers(@_[0], '<b>', '</b>'); } |
| 173 | sub do_cmd_textit{ |
| 174 | return use_wrappers(@_[0], '<i>', '</i>'); } |
| 175 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 176 | |
Fred Drake | 2581704 | 1999-01-13 17:06:34 +0000 | [diff] [blame] | 177 | sub do_cmd_refmodule{ |
| 178 | # Insert the right magic to jump to the module definition. |
| 179 | local($_) = @_; |
| 180 | my $key = next_optional_argument(); |
| 181 | my $module = next_argument(); |
| 182 | $key = $module |
| 183 | unless $key; |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 184 | return "<tt class=module><a href=\"module-$key.html\">$module</a></tt>" . $_; |
Fred Drake | 2581704 | 1999-01-13 17:06:34 +0000 | [diff] [blame] | 185 | } |
| 186 | |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 187 | sub do_cmd_newsgroup{ |
| 188 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 189 | my $newsgroup = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 190 | my $stuff = "<span class=newsgroup><a href=\"news:$newsgroup\">" |
| 191 | . "$newsgroup</a></span>"; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 192 | return $stuff . $_; |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 193 | } |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 194 | |
| 195 | sub do_cmd_envvar{ |
| 196 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 197 | my $envvar = next_argument(); |
| 198 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 199 | # The <tt> here is really to keep buildindex.py from making |
| 200 | # the variable name case-insensitive. |
| 201 | add_index_entry("environment variables!$envvar@<tt>\$$envvar</tt>", |
| 202 | $ahref); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 203 | add_index_entry("$envvar@\$$envvar", $ahref); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 204 | return "<span class=envvar>$aname\$$envvar</a></span>" . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 205 | } |
| 206 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 207 | sub do_cmd_url{ |
| 208 | # use the URL as both text and hyperlink |
| 209 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 210 | my $url = next_argument(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 211 | $url =~ s/~/~/g; |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 212 | return "<span class=url><a href=\"$url\">$url</a></span>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | sub do_cmd_manpage{ |
| 216 | # two parameters: \manpage{name}{section} |
| 217 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 218 | my $page = next_argument(); |
| 219 | my $section = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 220 | return "<span class=manpage><i>$page</i>($section)</span>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | sub do_cmd_rfc{ |
| 224 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 225 | my $rfcnumber = next_argument(); |
| 226 | my $id = "rfcref-" . ++$global{'max_id'}; |
Fred Drake | 2eff3c5 | 1998-12-22 18:02:25 +0000 | [diff] [blame] | 227 | my $href = |
| 228 | "http://info.internet.isi.edu/in-notes/rfc/files/rfc$rfcnumber.txt"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 229 | # Save the reference |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 230 | my $nstr = gen_index_id("RFC!RFC $rfcnumber", ''); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 231 | $index{$nstr} .= make_half_href("$CURRENT_FILE#$id"); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 232 | return ("<span class=rfc><a name=\"$id\"\nhref=\"$href\">" |
| 233 | . "RFC $rfcnumber</a></span>" .$_); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 234 | } |
| 235 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 236 | sub do_cmd_deprecated{ |
| 237 | # two parameters: \deprecated{version}{whattodo} |
| 238 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 239 | my $release = next_argument(); |
| 240 | my $reason = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 241 | return "<b>Deprecated since release $release.</b>\n$reason<p>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 242 | } |
| 243 | |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 244 | sub do_cmd_versionadded{ |
| 245 | # one parameter: \versionadded{version} |
| 246 | local($_) = @_; |
| 247 | my $release = next_argument(); |
Fred Drake | 2116d98 | 1999-02-02 18:02:48 +0000 | [diff] [blame] | 248 | return "\nNew in version $release.\n" . $_; |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | sub do_cmd_versionchanged{ |
| 252 | # one parameter: \versionchanged{version} |
| 253 | local($_) = @_; |
| 254 | my $release = next_argument(); |
Fred Drake | 2116d98 | 1999-02-02 18:02:48 +0000 | [diff] [blame] | 255 | return "\nChanged in version $release.\n" . $_; |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 256 | } |
| 257 | |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 258 | # |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 259 | # These function handle platform dependency tracking. |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 260 | # |
| 261 | sub do_cmd_platform{ |
| 262 | local($_) = @_; |
| 263 | my $platform = next_argument(); |
| 264 | $ModulePlatforms{$THIS_MODULE} = $platform; |
| 265 | $platform = "Macintosh" |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 266 | if $platform eq 'Mac'; |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 267 | return "\n<p class=availability>Availability: <span" |
| 268 | . "\n class=platform>$platform</span>.</p>\n" . $_; |
| 269 | } |
| 270 | |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 271 | $IGNORE_PLATFORM_ANNOTATION = ''; |
| 272 | sub do_cmd_ignorePlatformAnnotation{ |
| 273 | local($_) = @_; |
| 274 | $IGNORE_PLATFORM_ANNOTATION = next_argument(); |
| 275 | return $_; |
| 276 | } |
| 277 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 278 | |
| 279 | # index commands |
| 280 | |
| 281 | $INDEX_SUBITEM = ""; |
| 282 | |
| 283 | sub get_indexsubitem{ |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 284 | return $INDEX_SUBITEM ? " $INDEX_SUBITEM" : ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | sub do_cmd_setindexsubitem{ |
| 288 | local($_) = @_; |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 289 | $INDEX_SUBITEM = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 290 | return $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 291 | } |
| 292 | |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 293 | sub do_cmd_withsubitem{ |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 294 | # We can't really do the right thing, because LaTeX2HTML doesn't |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 295 | # do things in the right order, but we need to at least strip this stuff |
| 296 | # out, and leave anything that the second argument expanded out to. |
| 297 | # |
| 298 | local($_) = @_; |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 299 | my $oldsubitem = $INDEX_SUBITEM; |
| 300 | $INDEX_SUBITEM = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 301 | my $stuff = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 302 | my $br_id = ++$globals{'max_id'}; |
| 303 | my $marker = "$O$br_id$C"; |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 304 | return |
| 305 | $stuff |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 306 | . "\\setindexsubitem$marker$oldsubitem$marker" |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 307 | . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 310 | # This is the prologue macro which is required to start writing the |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 311 | # mod\jobname.idx file; we can just ignore it. (Defining this suppresses |
| 312 | # a warning that \makemodindex is unknown.) |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 313 | # |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 314 | sub do_cmd_makemodindex{ return @_[0]; } |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 315 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 316 | # We're in the document subdirectory when this happens! |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 317 | # |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 318 | open(IDXFILE, '>index.dat') || die "\n$!\n"; |
| 319 | open(INTLABELS, '>intlabels.pl') || die "\n$!\n"; |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 320 | print INTLABELS "%internal_labels = ();\n"; |
| 321 | print INTLABELS "1; # hack in case there are no entries\n\n"; |
| 322 | |
| 323 | # Using \0 for this is bad because we can't use common tools to work with the |
| 324 | # resulting files. Things like grep can be useful with this stuff! |
| 325 | # |
| 326 | $IDXFILE_FIELD_SEP = "\1"; |
| 327 | |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 328 | sub write_idxfile{ |
| 329 | my ($ahref, $str) = @_; |
| 330 | print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 331 | } |
| 332 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 333 | |
| 334 | sub gen_link{ |
| 335 | my($node,$target) = @_; |
| 336 | print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 337 | return "<a href=\"$node#$target\">"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 338 | } |
| 339 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 340 | sub add_index_entry{ |
| 341 | # add an entry to the index structures; ignore the return value |
| 342 | my($str,$ahref) = @_; |
| 343 | $str = gen_index_id($str, ''); |
| 344 | $index{$str} .= $ahref; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 345 | write_idxfile($ahref, $str); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 346 | } |
| 347 | |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 348 | sub new_link_info{ |
| 349 | my $name = "l2h-" . ++$globals{'max_id'}; |
| 350 | my $aname = '<a name="' . $name . '">'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 351 | my $ahref = gen_link($CURRENT_FILE, $name); |
| 352 | return ($name, $aname, $ahref); |
| 353 | } |
| 354 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 355 | $IndexMacroPattern = ''; |
| 356 | sub define_indexing_macro{ |
| 357 | my $count = @_; |
| 358 | my $i = 0; |
| 359 | for (; $i < $count; ++$i) { |
| 360 | my $name = @_[$i]; |
| 361 | my $cmd = "idx_cmd_$name"; |
| 362 | die "\nNo function $cmd() defined!\n" |
| 363 | if (!defined &$cmd); |
| 364 | eval ("sub do_cmd_$name { return process_index_macros(" |
| 365 | . "\@_[0], '$name'); }"); |
| 366 | if (length($IndexMacroPattern) == 0) { |
| 367 | $IndexMacroPattern = "$name"; |
| 368 | } |
| 369 | else { |
| 370 | $IndexMacroPattern .= "|$name"; |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | $DEBUG_INDEXING = 0; |
| 376 | sub process_index_macros{ |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 377 | local($_) = @_; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 378 | my $cmdname = @_[1]; # This is what triggered us in the first place; |
| 379 | # we know it's real, so just process it. |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 380 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 381 | my $cmd = "idx_cmd_$cmdname"; |
| 382 | print "\nIndexing: \\$cmdname" |
| 383 | if $DEBUG_INDEXING; |
| 384 | &$cmd($ahref); # modifies $_ and adds index entries |
| 385 | while (/^[\s\n]*\\($IndexMacroPattern)</) { |
| 386 | $cmdname = "$1"; |
| 387 | print " \\$cmdname" |
| 388 | if $DEBUG_INDEXING; |
| 389 | $cmd = "idx_cmd_$cmdname"; |
| 390 | if (!defined &$cmd) { |
| 391 | last; |
| 392 | } |
| 393 | else { |
| 394 | s/^[\s\n]*\\$cmdname//; |
| 395 | &$cmd($ahref); |
| 396 | } |
| 397 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 398 | return "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 399 | } |
| 400 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 401 | define_indexing_macro('index'); |
| 402 | sub idx_cmd_index{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 403 | my $str = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 404 | add_index_entry("$str", @_[0]); |
Fred Drake | 2e7edb8 | 1998-05-11 18:31:17 +0000 | [diff] [blame] | 405 | } |
| 406 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 407 | define_indexing_macro('kwindex'); |
| 408 | sub idx_cmd_kwindex{ |
| 409 | my $str = next_argument(); |
| 410 | add_index_entry("<tt>$str</tt>!keyword", @_[0]); |
| 411 | add_index_entry("keyword!<tt>$str</tt>", @_[0]); |
| 412 | } |
| 413 | |
| 414 | define_indexing_macro('indexii'); |
| 415 | sub idx_cmd_indexii{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 416 | my $str1 = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 417 | my $str2 = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 418 | add_index_entry("$str1!$str2", @_[0]); |
| 419 | add_index_entry("$str2!$str1", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 420 | } |
| 421 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 422 | define_indexing_macro('indexiii'); |
| 423 | sub idx_cmd_indexiii{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 424 | my $str1 = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 425 | my $str2 = next_argument(); |
| 426 | my $str3 = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 427 | add_index_entry("$str1!$str2 $str3", @_[0]); |
| 428 | add_index_entry("$str2!$str3, $str1", @_[0]); |
| 429 | add_index_entry("$str3!$str1 $str2", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 430 | } |
| 431 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 432 | define_indexing_macro('indexiv'); |
| 433 | sub idx_cmd_indexiv{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 434 | my $str1 = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 435 | my $str2 = next_argument(); |
| 436 | my $str3 = next_argument(); |
| 437 | my $str4 = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 438 | add_index_entry("$str1!$str2 $str3 $str4", @_[0]); |
| 439 | add_index_entry("$str2!$str3 $str4, $str1", @_[0]); |
| 440 | add_index_entry("$str3!$str4, $str1 $str2", @_[0]); |
| 441 | add_index_entry("$str4!$$str1 $str2 $str3", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 442 | } |
| 443 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 444 | define_indexing_macro('ttindex'); |
| 445 | sub idx_cmd_ttindex{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 446 | my $str = next_argument(); |
| 447 | my $entry = $str . get_indexsubitem(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 448 | add_index_entry($entry, @_[0]); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 449 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 450 | |
| 451 | sub my_typed_index_helper{ |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 452 | my($word,$ahref) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 453 | my $str = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 454 | add_index_entry("$str $word", $ahref); |
| 455 | add_index_entry("$word!$str", $ahref); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 456 | } |
| 457 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 458 | define_indexing_macro('stindex', 'opindex', 'exindex', 'obindex'); |
| 459 | sub idx_cmd_stindex{ my_typed_index_helper('statement', @_[0]); } |
| 460 | sub idx_cmd_opindex{ my_typed_index_helper('operator', @_[0]); } |
| 461 | sub idx_cmd_exindex{ my_typed_index_helper('exception', @_[0]); } |
| 462 | sub idx_cmd_obindex{ my_typed_index_helper('object', @_[0]); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 463 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 464 | define_indexing_macro('bifuncindex'); |
| 465 | sub idx_cmd_bifuncindex{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 466 | my $str = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 467 | add_index_entry("<tt>$str()</tt> (built-in function)", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 468 | } |
| 469 | |
| 470 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 471 | sub make_mod_index_entry{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 472 | my($str,$define) = @_; |
| 473 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 474 | # equivalent of add_index_entry() using $define instead of '' |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 475 | $ahref =~ s/\#[-_a-zA-Z0-9]*\"/\"/ |
| 476 | if ($define eq 'DEF'); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 477 | $str = gen_index_id($str, $define); |
| 478 | $index{$str} .= $ahref; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 479 | write_idxfile($ahref, $str); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 480 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 481 | if ($define eq 'DEF') { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 482 | # add to the module index |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 483 | my($nstr,$garbage) = split / /, $str, 2; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 484 | $Modules{$nstr} .= $ahref; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 485 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 486 | return "$aname$anchor_invisible_mark</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 487 | } |
| 488 | |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 489 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 490 | $THIS_MODULE = ''; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 491 | $THIS_CLASS = ''; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 492 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 493 | sub define_module{ |
| 494 | my($word,$name) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 495 | my $section_tag = join('', @curr_sec_id); |
Fred Drake | 3e4c614 | 1999-05-17 15:00:32 +0000 | [diff] [blame] | 496 | if ($word ne "built-in" && $word ne "extension" |
| 497 | && $word ne "standard" && $word ne "") { |
| 498 | write_warnings("Bad module type '$word'" |
| 499 | . " for \\declaremodule (module $name)"); |
| 500 | $word = ""; |
| 501 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 502 | $word = "$word " if $word; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 503 | $THIS_MODULE = "$name"; |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 504 | $INDEX_SUBITEM = "(in $name)"; |
| 505 | print "[$name]"; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 506 | return make_mod_index_entry("<tt>$name</tt> (${word}module)", 'DEF'); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | sub my_module_index_helper{ |
| 510 | local($word, $_) = @_; |
| 511 | my $name = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 512 | return define_module($word, $name) . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 513 | } |
| 514 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 515 | sub do_cmd_modindex{ return my_module_index_helper('', @_); } |
| 516 | sub do_cmd_bimodindex{ return my_module_index_helper('built-in', @_); } |
| 517 | sub do_cmd_exmodindex{ return my_module_index_helper('extension', @_); } |
| 518 | sub do_cmd_stmodindex{ return my_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 519 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 520 | sub ref_module_index_helper{ |
| 521 | local($word, $ahref) = @_; |
| 522 | my $str = next_argument(); |
| 523 | $word = "$word " if $word; |
| 524 | $str = "<tt>$str</tt> (${word}module)"; |
| 525 | # can't use add_index_entry() since the 2nd arg to gen_index_id() is used; |
| 526 | # just inline it all here |
| 527 | $str = gen_index_id($str, 'REF'); |
| 528 | $index{$str} .= $ahref; |
| 529 | write_idxfile($ahref, $str); |
| 530 | } |
| 531 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 532 | # these should be adjusted a bit.... |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 533 | define_indexing_macro('refmodindex', 'refbimodindex', |
| 534 | 'refexmodindex', 'refstmodindex'); |
| 535 | sub idx_cmd_refmodindex{ return ref_module_index_helper('', @_); } |
| 536 | sub idx_cmd_refbimodindex{ return ref_module_index_helper('built-in', @_); } |
| 537 | sub idx_cmd_refexmodindex{ return ref_module_index_helper('extension', @_); } |
| 538 | sub idx_cmd_refstmodindex{ return ref_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 539 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 540 | sub do_cmd_nodename{ return do_cmd_label(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 541 | |
| 542 | sub init_myformat{ |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 543 | # $anchor_invisible_mark = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 544 | $anchor_mark = ''; |
| 545 | $icons{'anchor_mark'} = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 546 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 547 | init_myformat(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 548 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 549 | # Create an index entry, but include the string in the target anchor |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 550 | # instead of the dummy filler. |
| 551 | # |
| 552 | sub make_str_index_entry{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 553 | my($str) = @_; |
| 554 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 555 | add_index_entry($str, $ahref); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 556 | return "$aname$str</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 557 | } |
| 558 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 559 | sub do_env_cfuncdesc{ |
| 560 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 561 | my $return_type = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 562 | my $function_name = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 563 | my $arg_list = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 564 | my $idx = make_str_index_entry("<tt class=cfunction>$function_name()</tt>" |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 565 | . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 566 | $idx =~ s/ \(.*\)//; |
| 567 | $idx =~ s/\(\)//; # ???? |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 568 | return "<dl><dt>$return_type <b>$idx</b> (<var>$arg_list</var>)\n<dd>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 569 | . $_ |
| 570 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | sub do_env_ctypedesc{ |
| 574 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 575 | my $type_name = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 576 | my $idx = make_str_index_entry("<tt class=ctype>$type_name</tt>" |
| 577 | . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 578 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 579 | return "<dl><dt><b>$idx</b>\n<dd>" |
| 580 | . $_ |
| 581 | . '</dl>' |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | sub do_env_cvardesc{ |
| 585 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 586 | my $var_type = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 587 | my $var_name = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 588 | my $idx = make_str_index_entry("<tt class=cdata>$var_name</tt>" |
| 589 | . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 590 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 591 | return "<dl><dt>$var_type <b>$idx</b>\n" |
| 592 | . '<dd>' |
| 593 | . $_ |
| 594 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 595 | } |
| 596 | |
| 597 | sub do_env_funcdesc{ |
| 598 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 599 | my $function_name = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 600 | my $arg_list = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 601 | my $idx = make_str_index_entry("<tt class=function>$function_name()</tt>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 602 | . get_indexsubitem()); |
| 603 | $idx =~ s/ \(.*\)//; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 604 | $idx =~ s/\(\)<\/tt>/<\/tt>/; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 605 | return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | sub do_env_funcdescni{ |
| 609 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 610 | my $function_name = next_argument(); |
| 611 | my $arg_list = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 612 | return "<dl><dt><b><tt class=function>$function_name</tt></b>" |
| 613 | . " (<var>$arg_list</var>)\n" |
| 614 | . '<dd>' |
| 615 | . $_ |
| 616 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | sub do_cmd_funcline{ |
| 620 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 621 | my $function_name = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 622 | my $arg_list = next_argument(); |
Fred Drake | ca675e4 | 1999-04-21 15:58:58 +0000 | [diff] [blame] | 623 | my $prefix = "<tt class=function>$function_name()</tt>"; |
| 624 | my $idx = make_str_index_entry($prefix . get_indexsubitem()); |
| 625 | $prefix =~ s/\(\)//; |
| 626 | |
| 627 | return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 628 | } |
| 629 | |
Fred Drake | 6b3fb78 | 1999-07-12 16:50:09 +0000 | [diff] [blame^] | 630 | sub do_cmd_funclineni{ |
| 631 | local($_) = @_; |
| 632 | my $function_name = next_argument(); |
| 633 | my $arg_list = next_argument(); |
| 634 | my $prefix = "<tt class=function>$function_name</tt>"; |
| 635 | |
| 636 | return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; |
| 637 | } |
| 638 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 639 | # Change this flag to index the opcode entries. I don't think it's very |
| 640 | # useful to index them, since they're only presented to describe the dis |
| 641 | # module. |
| 642 | # |
| 643 | $INDEX_OPCODES = 0; |
| 644 | |
| 645 | sub do_env_opcodedesc{ |
| 646 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 647 | my $opcode_name = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 648 | my $arg_list = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 649 | my $idx; |
| 650 | if ($INDEX_OPCODES) { |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 651 | $idx = make_str_index_entry( |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 652 | "<tt class=opcode>$opcode_name</tt> (byte code instruction)"); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 653 | $idx =~ s/ \(byte code instruction\)//; |
| 654 | } |
| 655 | else { |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 656 | $idx = "<tt class=opcode>$opcode_name</tt>"; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 657 | } |
| 658 | my $stuff = "<dl><dt><b>$idx</b>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 659 | if ($arg_list) { |
| 660 | $stuff .= " <var>$arg_list</var>"; |
| 661 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 662 | return $stuff . "\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | sub do_env_datadesc{ |
| 666 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 667 | my $dataname = next_argument(); |
| 668 | my $idx = make_str_index_entry("<tt>$dataname</tt>" . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 669 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 670 | return "<dl><dt><b>$idx</b>\n<dd>" |
| 671 | . $_ |
| 672 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | sub do_env_datadescni{ |
| 676 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 677 | my $idx = next_argument(); |
| 678 | if (! $STRING_INDEX_TT) { |
| 679 | $idx = "<tt>$idx</tt>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 680 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 681 | return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | sub do_cmd_dataline{ |
| 685 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 686 | my $data_name = next_argument(); |
| 687 | my $idx = make_str_index_entry("<tt>$data_name</tt>" . get_indexsubitem()); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 688 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 689 | return "<dt><b>$idx</b><dd>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 690 | } |
| 691 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 692 | sub do_env_excdesc{ |
| 693 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 694 | my $excname = next_argument(); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 695 | my $idx = make_str_index_entry("<tt class=exception>$excname</tt>"); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 696 | return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>' |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 697 | } |
| 698 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 699 | sub do_env_fulllineitems{ return do_env_itemize(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 700 | |
| 701 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 702 | sub do_env_classdesc{ |
| 703 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 704 | $THIS_CLASS = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 705 | my $arg_list = next_argument(); |
| 706 | $idx = make_str_index_entry( |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 707 | "<tt class=class>$THIS_CLASS</tt> (class in $THIS_MODULE)" ); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 708 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 709 | return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 710 | } |
| 711 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 712 | |
| 713 | sub do_env_methoddesc{ |
| 714 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 715 | my $class_name = next_optional_argument(); |
| 716 | $class_name = $THIS_CLASS |
| 717 | unless $class_name; |
Fred Drake | 5a0ca4e | 1999-01-12 04:16:51 +0000 | [diff] [blame] | 718 | my $method = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 719 | my $arg_list = next_argument(); |
| 720 | my $extra = ''; |
| 721 | if ($class_name) { |
| 722 | $extra = " ($class_name method)"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 723 | } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 724 | my $idx = make_str_index_entry("<tt class=method>$method()</tt>$extra"); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 725 | $idx =~ s/ \(.*\)//; |
| 726 | $idx =~ s/\(\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 727 | return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 731 | sub do_cmd_methodline{ |
| 732 | local($_) = @_; |
| 733 | my $class_name = next_optional_argument(); |
| 734 | $class_name = $THIS_CLASS |
| 735 | unless $class_name; |
| 736 | my $method = next_argument(); |
| 737 | my $arg_list = next_argument(); |
| 738 | my $extra = ''; |
| 739 | if ($class_name) { |
| 740 | $extra = " ($class_name method)"; |
| 741 | } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 742 | my $idx = make_str_index_entry("<tt class=method>$method()</tt>$extra"); |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 743 | $idx =~ s/ \(.*\)//; |
| 744 | $idx =~ s/\(\)//; |
| 745 | return "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" |
| 746 | . $_; |
| 747 | } |
| 748 | |
| 749 | |
Fred Drake | d64a40d | 1998-09-10 18:59:13 +0000 | [diff] [blame] | 750 | sub do_cmd_methodlineni{ |
| 751 | local($_) = @_; |
| 752 | next_optional_argument(); |
| 753 | my $method = next_argument(); |
| 754 | my $arg_list = next_argument(); |
| 755 | return "<dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" |
| 756 | . $_; |
| 757 | } |
| 758 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 759 | sub do_env_methoddescni{ |
| 760 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 761 | next_optional_argument(); |
| 762 | my $method = next_argument(); |
| 763 | my $arg_list = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 764 | return "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" |
| 765 | . $_ |
| 766 | . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 767 | } |
| 768 | |
| 769 | |
| 770 | sub do_env_memberdesc{ |
| 771 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 772 | my $class = next_optional_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 773 | my $member = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 774 | $class = $THIS_CLASS |
| 775 | unless $class; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 776 | my $extra = ''; |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 777 | $extra = " ($class attribute)" |
| 778 | if ($class ne ''); |
| 779 | my $idx = make_str_index_entry("<tt class=member>$member</tt>$extra"); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 780 | $idx =~ s/ \(.*\)//; |
| 781 | $idx =~ s/\(\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 782 | return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 786 | sub do_cmd_memberline{ |
| 787 | local($_) = @_; |
| 788 | my $class = next_optional_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 789 | my $member = next_argument(); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 790 | $class = $THIS_CLASS |
| 791 | unless $class; |
| 792 | my $extra = ''; |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 793 | $extra = " ($class attribute)" |
| 794 | if ($class ne ''); |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 795 | my $idx = make_str_index_entry("<tt class=member>$member</tt>$extra"); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 796 | $idx =~ s/ \(.*\)//; |
| 797 | $idx =~ s/\(\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 798 | return "<dt><b>$idx</b><dd>" . $_; |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 799 | } |
| 800 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 801 | sub do_env_memberdescni{ |
| 802 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 803 | next_optional_argument(); |
| 804 | my $member = next_argument(); |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 805 | return "<dl><dt><b><tt class=member>$member</tt></b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 809 | sub do_cmd_memberlineni{ |
| 810 | local($_) = @_; |
| 811 | next_optional_argument(); |
| 812 | my $member = next_argument(); |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 813 | return "<dt><b><tt class=member>$member</tt></b><dd>" . $_; |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 814 | } |
| 815 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 816 | @col_aligns = ("<td>", "<td>", "<td>", "<td>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 817 | |
Fred Drake | 15799ed | 1999-02-12 19:23:17 +0000 | [diff] [blame] | 818 | $TABLE_HEADER_BGCOLOR = $NAV_BGCOLOR; |
| 819 | |
Fred Drake | 79189b5 | 1999-04-28 13:54:30 +0000 | [diff] [blame] | 820 | sub get_th{ |
| 821 | my $a = @_[0]; |
| 822 | my $r = '<th>'; |
| 823 | if ($a eq 'l') |
| 824 | { $r = '<th align=left>'; } |
| 825 | elsif (substr($a, 0, 1) eq 'p') |
| 826 | { $r = '<th align=left>'; } |
| 827 | elsif ($a eq 'r') |
| 828 | { $r = '<th align=right>'; } |
| 829 | return $r; |
| 830 | } |
| 831 | |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 832 | sub fix_font{ |
| 833 | # do a little magic on a font name to get the right behavior in the first |
| 834 | # column of the output table |
| 835 | my $font = @_[0]; |
| 836 | if ($font eq 'textrm') { |
| 837 | $font = ''; |
| 838 | } |
| 839 | elsif ($font eq 'file' || $font eq 'filenq') { |
| 840 | $font = 'tt class=file'; |
| 841 | } |
| 842 | return $font; |
| 843 | } |
| 844 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 845 | sub setup_column_alignments{ |
| 846 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 847 | my($a1,$a2,$a3,$a4) = split(/[|]/,$_); |
| 848 | my($th1,$th2,$th3,$th4) = ('<th>', '<th>', '<th>', '<th>'); |
Fred Drake | ea07f27 | 1999-04-28 17:11:21 +0000 | [diff] [blame] | 849 | $col_aligns[0] = (($a1 eq 'c') ? '<td align=center valign=baseline>' |
| 850 | : '<td valign=baseline>'); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 851 | $col_aligns[1] = (($a2 eq 'c') ? '<td align=center>' : '<td>'); |
| 852 | $col_aligns[2] = (($a3 eq 'c') ? '<td align=center>' : '<td>'); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 853 | $col_aligns[3] = (($a4 eq 'c') ? '<td align=center>' : '<td>'); |
Fred Drake | 79189b5 | 1999-04-28 13:54:30 +0000 | [diff] [blame] | 854 | # return the aligned header start tags |
| 855 | return (get_th($a1), get_th($a2), get_th($a3), get_th($a4)); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 856 | } |
| 857 | |
| 858 | sub do_env_tableii{ |
| 859 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 860 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 861 | my $font = fix_font(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 862 | my $h1 = next_argument(); |
| 863 | my $h2 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 864 | s/[\s\n]+//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 865 | $globals{'lineifont'} = $font; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 866 | return '<table border align=center style="border-collapse: collapse">' |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 867 | . "\n <thead>" |
| 868 | . "\n <tr$TABLE_HEADER_BGCOLOR>" |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 869 | . "\n $th1<b>$h1</b>\ \ </th>" |
| 870 | . "\n $th2<b>$h2</b>\ \ </th>" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 871 | . "\n </thead>" |
| 872 | . "\n <tbody valign=baseline>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 873 | . $_ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 874 | . "\n </tbody>" |
| 875 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 876 | } |
| 877 | |
| 878 | sub do_cmd_lineii{ |
| 879 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 880 | my $c1 = next_argument(); |
| 881 | my $c2 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 882 | s/[\s\n]+//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 883 | my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 884 | if ($font) { |
Fred Drake | 5cca42e | 1998-04-09 17:59:11 +0000 | [diff] [blame] | 885 | $sfont = "<$font>"; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 886 | $efont = "</$font>"; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 887 | $efont =~ s/ .*>/>/; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 888 | } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 889 | my($c1align,$c2align) = @col_aligns[0,1]; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 890 | return "\n <tr>$c1align$sfont$c1$efont</td>\n" |
| 891 | . " $c2align$c2\ </td>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 892 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 893 | } |
| 894 | |
| 895 | sub do_env_tableiii{ |
| 896 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 897 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 898 | my $font = fix_font(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 899 | my $h1 = next_argument(); |
| 900 | my $h2 = next_argument(); |
| 901 | my $h3 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 902 | s/[\s\n]+//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 903 | $globals{'lineifont'} = $font; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 904 | return '<table border align=center style="border-collapse: collapse">' |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 905 | . "\n <thead>" |
| 906 | . "\n <tr$TABLE_HEADER_BGCOLOR>" |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 907 | . "\n $th1<b>$h1</b>\ \ </th>" |
| 908 | . "\n $th2<b>$h2</b>\ \ </th>" |
| 909 | . "\n $th3<b>$h3</b>\ \ </th>" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 910 | . "\n </thead>" |
| 911 | . "\n <tbody valign=baseline>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 912 | . $_ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 913 | . "\n </tbody>" |
| 914 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 915 | } |
| 916 | |
| 917 | sub do_cmd_lineiii{ |
| 918 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 919 | my $c1 = next_argument(); |
| 920 | my $c2 = next_argument(); |
| 921 | my $c3 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 922 | s/[\s\n]+//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 923 | my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 924 | if ($font) { |
Fred Drake | 5cca42e | 1998-04-09 17:59:11 +0000 | [diff] [blame] | 925 | $sfont = "<$font>"; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 926 | $efont = "</$font>"; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 927 | $efont =~ s/ .*>/>/; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 928 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 929 | my($c1align,$c2align,$c3align) = @col_aligns[0,1,2]; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 930 | return "\n <tr>$c1align$sfont$c1$efont</td>\n" |
| 931 | . " $c2align$c2</td>\n" |
| 932 | . " $c3align$c3\ </td>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 933 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 934 | } |
| 935 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 936 | sub do_env_tableiv{ |
| 937 | local($_) = @_; |
| 938 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 939 | my $font = fix_font(next_argument()); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 940 | my $h1 = next_argument(); |
| 941 | my $h2 = next_argument(); |
| 942 | my $h3 = next_argument(); |
| 943 | my $h4 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 944 | s/[\s\n]+//; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 945 | $globals{'lineifont'} = $font; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 946 | return '<table border align=center style="border-collapse: collapse">' |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 947 | . "\n <thead>" |
| 948 | . "\n <tr$TABLE_HEADER_BGCOLOR>" |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 949 | . "\n $th1<b>$h1</b>\ \ </th>" |
| 950 | . "\n $th2<b>$h2</b>\ \ </th>" |
| 951 | . "\n $th3<b>$h3</b>\ \ </th>" |
| 952 | . "\n $th4<b>$h4</b>\ \ </th>" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 953 | . "\n </thead>" |
| 954 | . "\n <tbody valign=baseline>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 955 | . $_ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 956 | . "\n </tbody>" |
| 957 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 958 | } |
| 959 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 960 | sub do_cmd_lineiv{ |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 961 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 962 | my $c1 = next_argument(); |
| 963 | my $c2 = next_argument(); |
| 964 | my $c3 = next_argument(); |
| 965 | my $c4 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 966 | s/[\s\n]+//; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 967 | my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); |
| 968 | if ($font) { |
| 969 | $sfont = "<$font>"; |
| 970 | $efont = "</$font>"; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 971 | $efont =~ s/ .*>/>/; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 972 | } |
| 973 | my($c1align,$c2align,$c3align,$c4align) = @col_aligns; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 974 | return "\n <tr>$c1align$sfont$c1$efont</td>\n" |
| 975 | . " $c2align$c2</td>\n" |
| 976 | . " $c3align$c3</td>\n" |
| 977 | . " $c4align$c4\ </td>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 978 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 979 | } |
| 980 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 981 | sub do_cmd_maketitle { |
| 982 | local($_) = @_; |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 983 | my $the_title = "\n<div class=titlepage><center>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 984 | if ($t_title) { |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 985 | $the_title .= "\n<h1>$t_title</h1>"; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 986 | } else { write_warnings("\nThis document has no title."); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 987 | if ($t_author) { |
| 988 | if ($t_authorURL) { |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 989 | my $href = translate_commands($t_authorURL); |
Fred Drake | 2d1f81e | 1999-02-09 16:03:31 +0000 | [diff] [blame] | 990 | $href = make_named_href('author', $href, |
| 991 | "<b><font size='+2'>$t_author</font></b>"); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 992 | $the_title .= "\n<p>$href</p>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 993 | } else { |
Fred Drake | 2d1f81e | 1999-02-09 16:03:31 +0000 | [diff] [blame] | 994 | $the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 995 | } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 996 | } else { write_warnings("\nThere is no author for this document."); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 997 | if ($t_institute) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 998 | $the_title .= "\n<p>$t_institute</p>";} |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 999 | if ($DEVELOPER_ADDRESS) { |
| 1000 | $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1001 | if ($t_affil) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1002 | $the_title .= "\n<p><i>$t_affil</i></p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1003 | if ($t_date) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1004 | $the_title .= "\n<p><strong>$t_date</strong>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1005 | if ($PYTHON_VERSION) { |
| 1006 | $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";} |
| 1007 | $the_title .= "</p>" |
| 1008 | } |
| 1009 | if ($t_address) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1010 | $the_title .= "\n<p>$t_address</p>"; |
| 1011 | } else { $the_title .= "\n<p>"} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1012 | if ($t_email) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1013 | $the_title .= "\n<p>$t_email</p>"; |
| 1014 | }# else { $the_title .= "</p>" } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1015 | $the_title .= "\n</center></div>"; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1016 | return $the_title . $_ ; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1017 | } |
| 1018 | |
| 1019 | |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1020 | # |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1021 | # Module synopsis support |
| 1022 | # |
| 1023 | |
| 1024 | require SynopsisTable; |
| 1025 | |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1026 | sub get_chapter_id(){ |
| 1027 | my $id = do_cmd_thechapter(''); |
Fred Drake | 45f2601 | 1998-08-04 22:07:18 +0000 | [diff] [blame] | 1028 | $id =~ s/<SPAN CLASS="arabic">(\d+)<\/SPAN>/\1/; |
| 1029 | $id =~ s/\.//; |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1030 | return $id; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1031 | } |
| 1032 | |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1033 | %ModuleSynopses = ('chapter' => 'SynopsisTable instance'); |
| 1034 | |
| 1035 | sub get_synopsis_table($){ |
| 1036 | my($chap) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1037 | my $st = $ModuleSynopses{$chap}; |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1038 | my $key; |
| 1039 | foreach $key (keys %ModuleSynopses) { |
| 1040 | if ($key eq $chap) { |
| 1041 | return $ModuleSynopses{$chap}; |
| 1042 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1043 | } |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1044 | $st = SynopsisTable->new(); |
| 1045 | $ModuleSynopses{$chap} = $st; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1046 | return $st; |
| 1047 | } |
| 1048 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1049 | sub do_cmd_moduleauthor{ |
| 1050 | local($_) = @_; |
| 1051 | next_argument(); |
| 1052 | next_argument(); |
| 1053 | return $_; |
| 1054 | } |
| 1055 | |
| 1056 | sub do_cmd_sectionauthor{ |
| 1057 | local($_) = @_; |
| 1058 | next_argument(); |
| 1059 | next_argument(); |
| 1060 | return $_; |
| 1061 | } |
| 1062 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1063 | sub do_cmd_declaremodule{ |
| 1064 | local($_) = @_; |
| 1065 | my $key = next_optional_argument(); |
| 1066 | my $type = next_argument(); |
| 1067 | my $name = next_argument(); |
| 1068 | my $st = get_synopsis_table(get_chapter_id()); |
| 1069 | # |
| 1070 | $key = $name unless $key; |
| 1071 | $type = 'built-in' if $type eq 'builtin'; |
| 1072 | $st->declare($name, $key, $type); |
| 1073 | define_module($type, $name); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1074 | return anchor_label("module-$key",$CURRENT_FILE,$_) |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1075 | } |
| 1076 | |
| 1077 | sub do_cmd_modulesynopsis{ |
| 1078 | local($_) = @_; |
| 1079 | my $st = get_synopsis_table(get_chapter_id()); |
Fred Drake | 1cc5899 | 1999-04-13 22:08:59 +0000 | [diff] [blame] | 1080 | $st->set_synopsis($THIS_MODULE, translate_commands(next_argument())); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1081 | return $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1082 | } |
| 1083 | |
| 1084 | sub do_cmd_localmoduletable{ |
| 1085 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1086 | my $chap = get_chapter_id(); |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1087 | return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1088 | } |
| 1089 | |
| 1090 | sub process_all_localmoduletables{ |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1091 | while (/<tex2html-localmoduletable><(\d+)>/) { |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1092 | my $match = $&; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1093 | my $chap = $1; |
| 1094 | my $st = get_synopsis_table($chap); |
| 1095 | my $data = $st->tohtml(); |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1096 | s/$match/$data/; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1097 | } |
| 1098 | } |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1099 | sub process_python_state{ |
| 1100 | process_all_localmoduletables(); |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1101 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1102 | |
| 1103 | |
| 1104 | # |
| 1105 | # "See also:" -- references placed at the end of a \section |
| 1106 | # |
| 1107 | |
| 1108 | sub do_env_seealso{ |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1109 | return "<div class=seealso>\n " |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 1110 | . "<p class=heading><b>See Also:</b></p>\n" |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1111 | . @_[0] |
| 1112 | . '</div>'; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1113 | } |
| 1114 | |
| 1115 | sub do_cmd_seemodule{ |
| 1116 | # Insert the right magic to jump to the module definition. This should |
| 1117 | # work most of the time, at least for repeat builds.... |
| 1118 | local($_) = @_; |
| 1119 | my $key = next_optional_argument(); |
| 1120 | my $module = next_argument(); |
| 1121 | my $text = next_argument(); |
Fred Drake | 84bd6f3 | 1999-05-11 15:42:51 +0000 | [diff] [blame] | 1122 | my $period = '.'; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1123 | $key = $module |
| 1124 | unless $key; |
Fred Drake | 84bd6f3 | 1999-05-11 15:42:51 +0000 | [diff] [blame] | 1125 | if ($text =~ /\.$/) { |
| 1126 | $period = ''; |
| 1127 | } |
| 1128 | return '<dl compact class=seemodule>' |
| 1129 | . "\n <dt>Module <b><tt class=module><a href=\"module-$key.html\">" |
| 1130 | . "$module</a></tt>:</b>" |
| 1131 | . "\n <dd>$text$period\n </dl>" |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1132 | . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | sub do_cmd_seetext{ |
Fred Drake | 79189b5 | 1999-04-28 13:54:30 +0000 | [diff] [blame] | 1136 | local($_) = @_; |
| 1137 | my $content = next_argument(); |
| 1138 | return '<div class=seetext><p>' . $content . '</div>' . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1139 | } |
| 1140 | |
| 1141 | |
| 1142 | # |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1143 | # Definition list support. |
| 1144 | # |
| 1145 | |
| 1146 | sub do_env_definitions{ |
| 1147 | local($_) = @_; |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1148 | return "<dl class=definitions>$_</dl>\n"; |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1149 | } |
| 1150 | |
| 1151 | sub do_cmd_term{ |
| 1152 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 1153 | my $term = next_argument(); |
| 1154 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1155 | # could easily add an index entry here... |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1156 | return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_; |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1157 | } |
| 1158 | |
| 1159 | |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 1160 | process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_); |
| 1161 | code # {} |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 1162 | declaremodule # [] # {} # {} |
| 1163 | memberline # [] # {} |
| 1164 | methodline # [] # {} # {} |
| 1165 | modulesynopsis # {} |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1166 | platform # {} |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 1167 | samp # {} |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 1168 | setindexsubitem # {} |
Fred Drake | f32834c | 1999-02-12 22:06:32 +0000 | [diff] [blame] | 1169 | withsubitem # {} # {} |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 1170 | _RAW_ARG_DEFERRED_CMDS_ |
| 1171 | |
| 1172 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1173 | 1; # This must be the last line |