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_id{ |
| 13 | my ($param,$br_id); |
| 14 | $param = missing_braces() |
| 15 | unless ((s/$next_pair_pr_rx/$br_id=$1;$param=$2;''/eo) |
| 16 | ||(s/$next_pair_rx/$br_id=$1;$param=$2;''/eo)); |
| 17 | ($param, $br_id); |
| 18 | } |
| 19 | |
| 20 | sub next_argument{ |
| 21 | my ($param,$br_id) = next_argument_id(); |
| 22 | $param; |
| 23 | } |
| 24 | |
| 25 | sub next_optional_argument{ |
| 26 | my($param,$rx) = ('', "^\\s*(\\[([^]]*)\\])?"); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 27 | s/$rx/$param=$2;''/eo; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 28 | $param; |
| 29 | } |
| 30 | |
| 31 | sub swallow_newline{ |
| 32 | s/[\n]?//o; |
| 33 | } |
| 34 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 35 | sub ArabictoRoman { |
| 36 | # Written by Robert Donohue <donahue@cfassp48.harvard.edu>, |
| 37 | # fixed by Fred Drake <fdrake@acm.org>, |
| 38 | # kept around in case it becomes useful. |
| 39 | my $a = @_; |
| 40 | my($b,@c,$i); |
| 41 | my(@D0,@D1,@D2); |
| 42 | |
| 43 | @D0 = ("", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"); |
| 44 | @D1 = ("", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"); |
| 45 | @D2 = ("", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"); |
| 46 | |
| 47 | $b = $a; |
| 48 | $i = 0; |
| 49 | while($b > 0) { |
| 50 | $c[$i] = ($b % 10); |
| 51 | $b -= ($b % 10); |
| 52 | $b /= 10; |
| 53 | $i++; |
| 54 | } |
| 55 | $D2[$c[2]] . $D1[$c[1]] . $D0[$c[0]]; |
| 56 | } |
| 57 | |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 58 | |
| 59 | # This is a fairly simple hack; it supports \let when it is used to create |
| 60 | # (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] | 61 | # 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] | 62 | # |
| 63 | sub do_cmd_let{ |
| 64 | local($_) = @_; |
| 65 | my $matched = 0; |
Fred Drake | 7a4ad0f | 1998-05-15 13:45:54 +0000 | [diff] [blame] | 66 | s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e; |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 67 | if ($matched) { |
| 68 | my($new, $old) = ($1, $3); |
| 69 | eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }'; |
| 70 | print "\ndefining handler for \\$new using \\$old\n"; |
| 71 | } |
Fred Drake | 7a4ad0f | 1998-05-15 13:45:54 +0000 | [diff] [blame] | 72 | else { |
| 73 | s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es; |
| 74 | if ($matched) { |
| 75 | my($new, $char) = ($1, $3); |
| 76 | eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }"; |
| 77 | print "\ndefining handler for \\$new to insert '$char'\n"; |
| 78 | } |
| 79 | else { |
| 80 | write_warnings("Could not interpret \\let construct..."); |
| 81 | } |
| 82 | } |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 83 | $_; |
| 84 | } |
| 85 | |
| 86 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 87 | # words typeset in a special way (not in HTML though) |
| 88 | |
| 89 | sub do_cmd_ABC{ 'ABC' . @_[0]; } |
| 90 | sub do_cmd_UNIX{ 'Unix'. @_[0]; } |
| 91 | sub do_cmd_ASCII{ 'ASCII' . @_[0]; } |
| 92 | sub do_cmd_POSIX{ 'POSIX' . @_[0]; } |
| 93 | sub do_cmd_C{ 'C' . @_[0]; } |
| 94 | sub do_cmd_Cpp{ 'C++' . @_[0]; } |
| 95 | sub do_cmd_EOF{ 'EOF' . @_[0]; } |
| 96 | sub do_cmd_NULL{ '<tt>NULL</tt>' . @_[0]; } |
| 97 | |
| 98 | sub do_cmd_e{ '\' . @_[0]; } |
| 99 | |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 100 | $DEVELOPER_ADDRESS = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 101 | $PYTHON_VERSION = ''; |
| 102 | |
| 103 | sub do_cmd_version{ $PYTHON_VERSION . @_[0]; } |
| 104 | sub do_cmd_release{ |
| 105 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 106 | $PYTHON_VERSION = next_argument(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 107 | $_; |
| 108 | } |
| 109 | |
| 110 | sub do_cmd_authoraddress{ |
| 111 | local($_) = @_; |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 112 | $DEVELOPER_ADDRESS = next_argument(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 113 | $_; |
| 114 | } |
| 115 | |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 116 | #sub do_cmd_developer{ do_cmd_author(@_[0]); } |
| 117 | #sub do_cmd_developers{ do_cmd_author(@_[0]); } |
| 118 | #sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); } |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 119 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 120 | sub do_cmd_hackscore{ |
| 121 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 122 | next_argument(); |
| 123 | '_' . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 124 | } |
| 125 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 126 | sub use_wrappers{ |
| 127 | local($_,$before,$after) = @_; |
| 128 | my $stuff = next_argument(); |
| 129 | $before . $stuff . $after . $_; |
| 130 | } |
| 131 | |
| 132 | sub use_current{ use_wrappers(@_[0], '', ''); } |
| 133 | sub use_sans_serif{ use_wrappers(@_[0], '<font face=sans-serif>', '</font>'); } |
| 134 | sub use_italics{ use_wrappers(@_[0], '<i>', '</i>'); } |
| 135 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 136 | sub do_cmd_optional{ |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 137 | use_wrappers(@_[0], "</var><big>\[</big><var>", |
| 138 | "</var><big>\]</big><var>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 139 | } |
| 140 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 141 | # Logical formatting (some based on texinfo), needs to be converted to |
| 142 | # minimalist HTML. The "minimalist" is primarily to reduce the size of |
| 143 | # output files for users that read them over the network rather than |
| 144 | # from local repositories. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 145 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 146 | sub do_cmd_pytype{ use_current(@_); } |
| 147 | sub do_cmd_makevar{ use_current(@_); } |
| 148 | sub do_cmd_code{ use_wrappers(@_[0], '<tt>', '</tt>'); } |
| 149 | sub do_cmd_module{ do_cmd_code(@_); } |
| 150 | sub do_cmd_keyword{ do_cmd_code(@_); } |
| 151 | sub do_cmd_exception{ do_cmd_code(@_); } |
| 152 | sub do_cmd_class{ do_cmd_code(@_); } |
| 153 | sub do_cmd_function{ do_cmd_code(@_); } |
| 154 | sub do_cmd_constant{ do_cmd_code(@_); } |
| 155 | sub do_cmd_member{ do_cmd_code(@_); } |
| 156 | sub do_cmd_method{ do_cmd_code(@_); } |
| 157 | sub do_cmd_cfunction{ do_cmd_code(@_); } |
| 158 | sub do_cmd_cdata{ do_cmd_code(@_); } |
| 159 | sub do_cmd_ctype{ do_cmd_code(@_); } |
| 160 | sub do_cmd_regexp{ do_cmd_code(@_); } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 161 | sub do_cmd_character{ do_cmd_samp(@_); } |
| 162 | sub do_cmd_program{ do_cmd_strong(@_); } |
| 163 | sub do_cmd_email{ use_sans_serif(@_); } |
| 164 | sub do_cmd_mimetype{ use_sans_serif(@_); } |
| 165 | sub do_cmd_var{ use_italics(@_); } |
| 166 | sub do_cmd_dfn{ use_italics(@_); } # make an index entry? |
| 167 | sub do_cmd_emph{ use_italics(@_); } |
| 168 | sub do_cmd_file{ use_wrappers(@_[0], '"<tt>', '</tt>"'); } |
| 169 | sub do_cmd_samp{ use_wrappers(@_[0], '"<tt>', '</tt>"'); } |
| 170 | sub do_cmd_kbd{ use_wrappers(@_[0], '<kbd>', '</kbd>'); } |
| 171 | sub do_cmd_strong{ use_wrappers(@_[0], '<b>', '</b>'); } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 172 | |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 173 | sub do_cmd_newsgroup{ |
| 174 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 175 | my $newsgroup = next_argument(); |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 176 | my $stuff = "<a href=\"news:$newsgroup\"><font face=sans-serif>" |
| 177 | . "$newsgroup</font></a>"; |
| 178 | $stuff . $_; |
| 179 | } |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 180 | |
| 181 | sub do_cmd_envvar{ |
| 182 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 183 | my($envvar,$br_id) = next_argument_id(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 184 | my($name,$aname,$ahref) = link_info($br_id); |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 185 | # The <tt> here is really to keep buildindex.py from making |
| 186 | # the variable name case-insensitive. |
| 187 | add_index_entry("environment variables!$envvar@<tt>\$$envvar</tt>", |
| 188 | $ahref); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 189 | add_index_entry("$envvar@\$$envvar", $ahref); |
| 190 | "$aname\$$envvar</a>" . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 191 | } |
| 192 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 193 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 194 | sub do_cmd_url{ |
| 195 | # use the URL as both text and hyperlink |
| 196 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 197 | my $url = next_argument(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 198 | $url =~ s/~/~/g; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 199 | "<a href=\"$url\"><font face=sans-serif>$url</font></a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | sub do_cmd_manpage{ |
| 203 | # two parameters: \manpage{name}{section} |
| 204 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 205 | my $page = next_argument(); |
| 206 | my $section = next_argument(); |
| 207 | "<i>$page</i>($section)" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | sub do_cmd_rfc{ |
| 211 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 212 | my($rfcnumber,$br_id) = next_argument(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 213 | |
| 214 | # Save the reference |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 215 | my $nstr = gen_index_id("RFC!RFC $rfcnumber", ''); |
| 216 | $index{$nstr} .= make_half_href("$CURRENT_FILE#$br_id"); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 217 | "<a name=$br_id>RFC $rfcnumber</a>" .$_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 218 | } |
| 219 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 220 | sub do_cmd_deprecated{ |
| 221 | # two parameters: \deprecated{version}{whattodo} |
| 222 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 223 | my $release = next_argument(); |
| 224 | my $reason = next_argument(); |
| 225 | "<b>Deprecated since release $release.</b>\n$reason<p>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 226 | } |
| 227 | |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 228 | sub do_cmd_versionadded{ |
| 229 | # one parameter: \versionadded{version} |
| 230 | local($_) = @_; |
| 231 | my $release = next_argument(); |
| 232 | "<b>New in version $release.</b><p>" . $_; |
| 233 | } |
| 234 | |
| 235 | sub do_cmd_versionchanged{ |
| 236 | # one parameter: \versionchanged{version} |
| 237 | local($_) = @_; |
| 238 | my $release = next_argument(); |
| 239 | "<b>Changed in version $release.</b><p>" . $_; |
| 240 | } |
| 241 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 242 | # file and samp are at the end of this file since they screw up fontlock. |
| 243 | |
| 244 | # index commands |
| 245 | |
| 246 | $INDEX_SUBITEM = ""; |
| 247 | |
| 248 | sub get_indexsubitem{ |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 249 | #$INDEX_SUBITEM ? " $INDEX_SUBITEM" : ''; |
| 250 | ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | sub do_cmd_setindexsubitem{ |
| 254 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 255 | $INDEX_SUBITEM = next_argument(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 256 | $_; |
| 257 | } |
| 258 | |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 259 | sub do_cmd_withsubitem{ |
| 260 | # We can't really do the right right thing, because LaTeX2HTML doesn't |
| 261 | # do things in the right order, but we need to at least strip this stuff |
| 262 | # out, and leave anything that the second argument expanded out to. |
| 263 | # |
| 264 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 265 | next_argument(); |
| 266 | my $stuff = next_argument(); |
| 267 | $stuff . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 268 | } |
| 269 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 270 | # This is the prologue macro which is required to start writing the |
| 271 | # mod\jobname.idx file; we can just ignore it. |
| 272 | # |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 273 | sub do_cmd_makemodindex{ @_[0]; } |
| 274 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 275 | # We're in the document subdirectory when this happens! |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 276 | # |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 277 | open(IDXFILE, '>index.dat') || die "\n$!\n"; |
| 278 | open(INTLABELS, '>intlabels.pl') || die "\n$!\n"; |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 279 | print INTLABELS "%internal_labels = ();\n"; |
| 280 | print INTLABELS "1; # hack in case there are no entries\n\n"; |
| 281 | |
| 282 | # Using \0 for this is bad because we can't use common tools to work with the |
| 283 | # resulting files. Things like grep can be useful with this stuff! |
| 284 | # |
| 285 | $IDXFILE_FIELD_SEP = "\1"; |
| 286 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 287 | |
| 288 | sub gen_target_name{ |
| 289 | "l2h-" . @_[0]; |
| 290 | } |
| 291 | |
| 292 | sub gen_target{ |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 293 | '<a name="' . @_[0] . '">'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | sub gen_link{ |
| 297 | my($node,$target) = @_; |
| 298 | print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; |
| 299 | "<a href=\"$node#$target\">"; |
| 300 | } |
| 301 | |
| 302 | sub make_index_entry{ |
| 303 | my($br_id,$str) = @_; |
| 304 | my($name,$aname,$ahref) = link_info($br_id); |
| 305 | add_index_entry($str, $ahref); |
| 306 | "$aname$anchor_invisible_mark</a>"; |
| 307 | } |
| 308 | |
| 309 | sub add_index_entry{ |
| 310 | # add an entry to the index structures; ignore the return value |
| 311 | my($str,$ahref) = @_; |
| 312 | $str = gen_index_id($str, ''); |
| 313 | $index{$str} .= $ahref; |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 314 | print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | sub link_info{ |
| 318 | my $name = gen_target_name(@_[0]); |
| 319 | my $aname = gen_target($name); |
| 320 | my $ahref = gen_link($CURRENT_FILE, $name); |
| 321 | return ($name, $aname, $ahref); |
| 322 | } |
| 323 | |
| 324 | sub do_cmd_index{ |
| 325 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 326 | my($str,$br_id) = next_argument_id(); |
| 327 | swallow_newline(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 328 | # |
| 329 | my($name,$aname,$ahref) = link_info($br_id); |
| 330 | add_index_entry("$str", $ahref); |
| 331 | "$aname$anchor_invisible_mark</a>" . $_; |
| 332 | } |
| 333 | |
Fred Drake | 2e7edb8 | 1998-05-11 18:31:17 +0000 | [diff] [blame] | 334 | sub do_cmd_kwindex{ |
| 335 | local($_) = @_; |
| 336 | my($str,$br_id) = next_argument_id(); |
| 337 | # |
| 338 | my($name,$aname,$ahref) = link_info($br_id); |
| 339 | add_index_entry("<tt>$str</tt>!keyword", $ahref); |
| 340 | add_index_entry("keyword!<tt>$str</tt>", $ahref); |
| 341 | "$aname$anchor_invisible_mark</a>" . $_; |
| 342 | } |
| 343 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 344 | sub do_cmd_indexii{ |
| 345 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 346 | my($str1,$br_id) = next_argument_id(); |
| 347 | my $str2 = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 348 | # |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 349 | my($name,$aname,$ahref) = link_info($br_id); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 350 | add_index_entry("$str1!$str2", $ahref); |
| 351 | add_index_entry("$str2!$str1", $ahref); |
| 352 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | sub do_cmd_indexiii{ |
| 356 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 357 | my($str1,$br_id) = next_argument(); |
| 358 | my $str2 = next_argument(); |
| 359 | my $str3 = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 360 | # |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 361 | my($name,$aname,$ahref) = link_info($br_id); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 362 | add_index_entry("$str1!$str2 $str3", $ahref); |
| 363 | add_index_entry("$str2!$str3, $str1", $ahref); |
| 364 | add_index_entry("$str3!$str1 $str2", $ahref); |
| 365 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | sub do_cmd_indexiv{ |
| 369 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 370 | my($str1,$br_id) = next_argument(); |
| 371 | my $str2 = next_argument(); |
| 372 | my $str3 = next_argument(); |
| 373 | my $str4 = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 374 | # |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 375 | my($name,$aname,$ahref) = link_info($br_id); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 376 | add_index_entry("$str1!$str2 $str3 $str4", $ahref); |
| 377 | add_index_entry("$str2!$str3 $str4, $str1", $ahref); |
| 378 | add_index_entry("$str3!$str4, $str1 $str2", $ahref); |
| 379 | add_index_entry("$str4!$$str1 $str2 $str3", $ahref); |
| 380 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 381 | } |
| 382 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 383 | sub do_cmd_ttindex{ |
| 384 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 385 | my($str,$br_id) = next_argument_id(); |
| 386 | swallow_newline(); |
| 387 | make_index_entry($br_id, $str . get_indexsubitem()) . $_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 388 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 389 | |
| 390 | sub my_typed_index_helper{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 391 | local($word,$_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 392 | my($str,$br_id) = next_argument(); |
| 393 | swallow_newline(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 394 | # |
| 395 | my($name,$aname,$ahref) = link_info($br_id1); |
| 396 | add_index_entry("$str $word", $ahref); |
| 397 | add_index_entry("$word!$str", $ahref); |
| 398 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 399 | } |
| 400 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 401 | sub do_cmd_stindex{ my_typed_index_helper('statement', @_); } |
| 402 | sub do_cmd_opindex{ my_typed_index_helper('operator', @_); } |
| 403 | sub do_cmd_exindex{ my_typed_index_helper('exception', @_); } |
| 404 | sub do_cmd_obindex{ my_typed_index_helper('object', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 405 | |
| 406 | sub my_parword_index_helper{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 407 | local($word,$_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 408 | my($str,$br_id) = next_argument_id(); |
| 409 | swallow_newline(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 410 | make_index_entry($br_id, "$str ($word)") . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 414 | sub make_mod_index_entry{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 415 | my($br_id,$str,$define) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 416 | my($name,$aname,$ahref) = link_info($br_id); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 417 | # equivalent of add_index_entry() using $define instead of '' |
| 418 | $str = gen_index_id($str, $define); |
| 419 | $index{$str} .= $ahref; |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 420 | print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 421 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 422 | if ($define eq 'DEF') { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 423 | # add to the module index |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 424 | my($nstr,$garbage) = split / /, $str, 2; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 425 | $Modules{$nstr} .= $ahref; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 426 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 427 | "$aname$anchor_invisible_mark</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 428 | } |
| 429 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 430 | $THIS_MODULE = ''; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 431 | $THIS_CLASS = ''; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 432 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 433 | sub define_module{ |
| 434 | my($word,$name) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 435 | my $section_tag = join('', @curr_sec_id); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 436 | $word = "$word " if $word; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 437 | $THIS_MODULE = "$name"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 438 | make_mod_index_entry("SECTION$section_tag", |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 439 | "<tt>$name</tt> (${word}module)", 'DEF'); |
| 440 | } |
| 441 | |
| 442 | sub my_module_index_helper{ |
| 443 | local($word, $_) = @_; |
| 444 | my $name = next_argument(); |
| 445 | swallow_newline(); |
| 446 | define_module($word, $name) . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | sub ref_module_index_helper{ |
| 450 | local($word, $_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 451 | my($str,$br_id) = next_argument(); |
| 452 | swallow_newline(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 453 | $word = "$word " if $word; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 454 | make_mod_index_entry($br_id, "<tt>$str</tt> (${word}module)", 'REF') . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 455 | } |
| 456 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 457 | sub do_cmd_bifuncindex{ |
| 458 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 459 | my($str,$br_id) = next_argument(); |
| 460 | swallow_newline(); |
| 461 | my $fname = "<tt>$str()</tt>"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 462 | make_index_entry($br_id, "$fname (built-in function)") . $_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 463 | } |
| 464 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 465 | sub do_cmd_modindex{ my_module_index_helper('', @_); } |
| 466 | sub do_cmd_bimodindex{ my_module_index_helper('built-in', @_); } |
| 467 | sub do_cmd_exmodindex{ my_module_index_helper('extension', @_); } |
| 468 | sub do_cmd_stmodindex{ my_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 469 | |
| 470 | # these should be adjusted a bit.... |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 471 | sub do_cmd_refmodindex{ ref_module_index_helper('', @_); } |
| 472 | sub do_cmd_refbimodindex{ ref_module_index_helper('built-in', @_); } |
| 473 | sub do_cmd_refexmodindex{ ref_module_index_helper('extension', @_); } |
| 474 | sub do_cmd_refstmodindex{ ref_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 475 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 476 | sub do_cmd_nodename{ do_cmd_label(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 477 | |
| 478 | sub init_myformat{ |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 479 | # $anchor_invisible_mark = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 480 | $anchor_mark = ''; |
| 481 | $icons{'anchor_mark'} = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 482 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 483 | init_myformat(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 484 | |
| 485 | # similar to make_index_entry(), but includes the string in the result |
| 486 | # instead of the dummy filler. |
| 487 | # |
| 488 | sub make_str_index_entry{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 489 | my($br_id,$str) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 490 | my($name,$aname,$ahref) = link_info($br_id); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 491 | add_index_entry($str, $ahref); |
| 492 | "$aname$str</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 493 | } |
| 494 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 495 | sub do_env_cfuncdesc{ |
| 496 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 497 | my $return_type = next_argument(); |
| 498 | my($function_name,$br_id) = next_argument_id(); |
| 499 | my $arg_list = next_argument(); |
| 500 | my $idx = make_str_index_entry($br_id, |
| 501 | "<tt>$function_name()</tt>" . get_indexsubitem()); |
| 502 | $idx =~ s/ \(.*\)//; |
| 503 | $idx =~ s/\(\)//; # ???? |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 504 | "<dl><dt>$return_type <b>$idx</b>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 505 | . "(<var>$arg_list</var>)\n<dd>" |
| 506 | . $_ |
| 507 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | sub do_env_ctypedesc{ |
| 511 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 512 | my($type_name,$br_id) = next_argument_id(); |
| 513 | my $idx = make_str_index_entry($br_id, |
| 514 | "<tt>$type_name</tt>" . get_indexsubitem()); |
| 515 | $idx =~ s/ \(.*\)//; |
| 516 | "<dl><dt><b>$idx</b>\n<dd>" |
| 517 | . $_ |
| 518 | . '</dl>' |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | sub do_env_cvardesc{ |
| 522 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 523 | my $var_type = next_argument(); |
| 524 | my($var_name,$br_id) = next_argument_id(); |
| 525 | my $idx = make_str_index_entry($br_id, |
| 526 | "<tt>$var_name</tt>" . get_indexsubitem()); |
| 527 | $idx =~ s/ \(.*\)//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 528 | "<dl><dt>$var_type <b>$idx</b>\n" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 529 | . '<dd>' |
| 530 | . $_ |
| 531 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | sub do_env_funcdesc{ |
| 535 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 536 | my $function_name = next_argument(); |
| 537 | my($arg_list,$br_id) = next_argument_id(); |
| 538 | my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>" |
| 539 | . get_indexsubitem()); |
| 540 | $idx =~ s/ \(.*\)//; |
| 541 | $idx =~ s/\(\)//; |
| 542 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | sub do_env_funcdescni{ |
| 546 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 547 | my $function_name = next_argument(); |
| 548 | my $arg_list = next_argument(); |
| 549 | "<dl><dt><b><tt>$function_name</tt></b> (<var>$arg_list</var>)\n<dd>" |
| 550 | . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | sub do_cmd_funcline{ |
| 554 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 555 | my $function_name = next_argument(); |
| 556 | my($arg_list,$br_id) = next_argument_id(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 557 | my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 558 | . get_indexsubitem()); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 559 | $idx =~ s/\(\)//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 560 | "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_; |
| 561 | } |
| 562 | |
| 563 | # Change this flag to index the opcode entries. I don't think it's very |
| 564 | # useful to index them, since they're only presented to describe the dis |
| 565 | # module. |
| 566 | # |
| 567 | $INDEX_OPCODES = 0; |
| 568 | |
| 569 | sub do_env_opcodedesc{ |
| 570 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 571 | my $opcode_name = next_argument(); |
| 572 | my($arg_list,$br_id) = next_argument_id(); |
| 573 | my $idx; |
| 574 | if ($INDEX_OPCODES) { |
| 575 | $idx = make_str_index_entry($br_id, |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 576 | "<tt>$opcode_name</tt> (byte code instruction)"); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 577 | $idx =~ s/ \(byte code instruction\)//; |
| 578 | } |
| 579 | else { |
| 580 | $idx = "<tt>$opcode_name</tt>"; |
| 581 | } |
| 582 | my $stuff = "<dl><dt><b>$idx</b>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 583 | if ($arg_list) { |
| 584 | $stuff .= " <var>$arg_list</var>"; |
| 585 | } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 586 | $stuff . "\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | sub do_env_datadesc{ |
| 590 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 591 | my($dataname,$br_id) = next_argument_id(); |
| 592 | my $idx = make_str_index_entry($br_id, |
| 593 | "<tt>$dataname</tt>" . get_indexsubitem()); |
| 594 | $idx =~ s/ \(.*\)//; |
| 595 | "<dl><dt><b>$idx</b>\n<dd>" |
| 596 | . $_ |
| 597 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 598 | } |
| 599 | |
| 600 | sub do_env_datadescni{ |
| 601 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 602 | my $idx = next_argument(); |
| 603 | if (! $STRING_INDEX_TT) { |
| 604 | $idx = "<tt>$idx</tt>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 605 | } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 606 | "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | sub do_cmd_dataline{ |
| 610 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 611 | my($data_name,$br_id) = next_argument_id(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 612 | my $idx = make_str_index_entry($br_id, "<tt>$data_name</tt>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 613 | . get_indexsubitem()); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 614 | $idx =~ s/ \(.*\)//; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 615 | "<dt><b>$idx</b><dd>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 616 | } |
| 617 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 618 | sub do_env_excdesc{ |
| 619 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 620 | my($excname,$br_id) = next_argument_id(); |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 621 | my $idx = make_str_index_entry($br_id, "<tt>$excname</tt>"); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 622 | "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>' |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | sub do_env_fulllineitems{ do_env_itemize(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 626 | |
| 627 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 628 | sub do_env_classdesc{ |
| 629 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 630 | $THIS_CLASS = next_argument(); |
| 631 | my($arg_list,$br_id) = next_argument_id(); |
| 632 | $idx = make_str_index_entry($br_id, |
| 633 | "<tt>$THIS_CLASS</tt> (class in $THIS_MODULE)" ); |
| 634 | $idx =~ s/ \(.*\)//; |
| 635 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 636 | } |
| 637 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 638 | |
| 639 | sub do_env_methoddesc{ |
| 640 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 641 | my $class_name = next_optional_argument(); |
| 642 | $class_name = $THIS_CLASS |
| 643 | unless $class_name; |
| 644 | my($method_name,$br_id) = next_argument_id(); |
| 645 | my $arg_list = next_argument(); |
| 646 | my $extra = ''; |
| 647 | if ($class_name) { |
| 648 | $extra = " ($class_name method)"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 649 | } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 650 | my $idx = make_str_index_entry($br_id, "<tt>$method_name()</tt>$extra"); |
| 651 | $idx =~ s/ \(.*\)//; |
| 652 | $idx =~ s/\(\)//; |
| 653 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | |
| 657 | sub do_env_methoddescni{ |
| 658 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 659 | next_optional_argument(); |
| 660 | my $method = next_argument(); |
| 661 | my $arg_list = next_argument(); |
| 662 | "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | |
| 666 | sub do_env_memberdesc{ |
| 667 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 668 | my $class = next_optional_argument(); |
| 669 | my($member,$br_id) = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 670 | $class = $THIS_CLASS |
| 671 | unless $class; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 672 | my $extra = ''; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 673 | $extra = " ($class_name attribute)" |
Fred Drake | a608feb | 1998-04-12 03:58:13 +0000 | [diff] [blame] | 674 | if (!($class eq '')); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 675 | my $idx = make_str_index_entry($br_id, "<tt>$member</tt>$extra"); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 676 | $idx =~ s/ \(.*\)//; |
| 677 | $idx =~ s/\(\)//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 678 | "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 682 | sub do_cmd_memberline{ |
| 683 | local($_) = @_; |
| 684 | my $class = next_optional_argument(); |
| 685 | my($member,$br_id) = next_argument_id(); |
| 686 | $class = $THIS_CLASS |
| 687 | unless $class; |
| 688 | my $extra = ''; |
| 689 | $extra = " ($class_name attribute)" |
| 690 | if (!($class eq '')); |
| 691 | my $idx = make_str_index_entry($br_id, "<tt>$member</tt>$extra"); |
| 692 | $idx =~ s/ \(.*\)//; |
| 693 | $idx =~ s/\(\)//; |
| 694 | "<dt><b>$idx</b><dd>" . $_; |
| 695 | } |
| 696 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 697 | sub do_env_memberdescni{ |
| 698 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 699 | next_optional_argument(); |
| 700 | my $member = next_argument(); |
| 701 | "<dl><dt><b>$member</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 702 | } |
| 703 | |
| 704 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 705 | sub do_cmd_memberlineni{ |
| 706 | local($_) = @_; |
| 707 | next_optional_argument(); |
| 708 | my $member = next_argument(); |
| 709 | "<dt><b>$member</b><dd>" . $_; |
| 710 | } |
| 711 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 712 | @col_aligns = ("<td>", "<td>", "<td>", "<td>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 713 | |
| 714 | sub setup_column_alignments{ |
| 715 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 716 | my($a1,$a2,$a3,$a4) = split(/[|]/,$_); |
| 717 | my($th1,$th2,$th3,$th4) = ('<th>', '<th>', '<th>', '<th>'); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 718 | $col_aligns[0] = (($a1 eq 'c') ? '<td align=center>' : '<td>'); |
| 719 | $col_aligns[1] = (($a2 eq 'c') ? '<td align=center>' : '<td>'); |
| 720 | $col_aligns[2] = (($a3 eq 'c') ? '<td align=center>' : '<td>'); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 721 | $col_aligns[3] = (($a4 eq 'c') ? '<td align=center>' : '<td>'); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 722 | # return the aligned header start tags; only used for \begin{tableiii?} |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 723 | $th1 = (($a1 eq 'l') ? '<th align=left>' |
| 724 | : ($a1 eq 'r' ? '<th align=right>' : '<th>')); |
| 725 | $th2 = (($a2 eq 'l') ? '<th align=left>' |
| 726 | : ($a2 eq 'r' ? '<th align=right>' : '<th>')); |
| 727 | $th3 = (($a3 eq 'l') ? '<th align=left>' |
| 728 | : ($a3 eq 'r' ? '<th align=right>' : '<th>')); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 729 | $th4 = (($a4 eq 'l') ? '<th align=left>' |
| 730 | : ($a4 eq 'r' ? '<th align=right>' : '<th>')); |
| 731 | ($th1, $th2, $th3, $th4); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | sub do_env_tableii{ |
| 735 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 736 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 737 | my $font = next_argument(); |
| 738 | my $h1 = next_argument(); |
| 739 | my $h2 = next_argument(); |
| 740 | $font = '' |
| 741 | if ($font eq 'textrm'); |
| 742 | $globals{'lineifont'} = $font; |
| 743 | '<table border align=center>' |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 744 | . "\n <tr>$th1<b>$h1</b></th>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 745 | . "\n $th2<b>$h2</b></th>" |
| 746 | . $_ |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 747 | . "\n</table>"; |
| 748 | } |
| 749 | |
| 750 | sub do_cmd_lineii{ |
| 751 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 752 | my $c1 = next_argument(); |
| 753 | my $c2 = next_argument(); |
| 754 | my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 755 | if ($font) { |
Fred Drake | 5cca42e | 1998-04-09 17:59:11 +0000 | [diff] [blame] | 756 | $sfont = "<$font>"; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 757 | $efont = "</$font>"; |
| 758 | } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 759 | my($c1align,$c2align) = @col_aligns[0,1]; |
Fred Drake | 5cca42e | 1998-04-09 17:59:11 +0000 | [diff] [blame] | 760 | "<tr>$c1align$sfont$c1$efont</td>\n" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 761 | . " $c2align$c2</td>" |
| 762 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | sub do_env_tableiii{ |
| 766 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 767 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 768 | my $font = next_argument(); |
| 769 | my $h1 = next_argument(); |
| 770 | my $h2 = next_argument(); |
| 771 | my $h3 = next_argument(); |
| 772 | $font = '' |
| 773 | if ($font eq 'textrm'); |
| 774 | $globals{'lineifont'} = $font; |
| 775 | '<table border align=center>' |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 776 | . "\n <tr>$th1<b>$h1</b></th>" |
| 777 | . "\n $th2<b>$h2</b></th>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 778 | . "\n $th3<b>$h3</b></th>" |
| 779 | . $_ |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 780 | . "\n</table>"; |
| 781 | } |
| 782 | |
| 783 | sub do_cmd_lineiii{ |
| 784 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 785 | my $c1 = next_argument(); |
| 786 | my $c2 = next_argument(); |
| 787 | my $c3 = next_argument(); |
| 788 | my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 789 | if ($font) { |
Fred Drake | 5cca42e | 1998-04-09 17:59:11 +0000 | [diff] [blame] | 790 | $sfont = "<$font>"; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 791 | $efont = "</$font>"; |
| 792 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 793 | my($c1align,$c2align,$c3align) = @col_aligns[0,1,2]; |
Fred Drake | 5cca42e | 1998-04-09 17:59:11 +0000 | [diff] [blame] | 794 | "<tr>$c1align$sfont$c1$efont</td>\n" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 795 | . " $c2align$c2</td>\n" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 796 | . " $c3align$c3</td>" |
| 797 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 798 | } |
| 799 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 800 | sub do_env_tableiv{ |
| 801 | local($_) = @_; |
| 802 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
| 803 | my $font = next_argument(); |
| 804 | my $h1 = next_argument(); |
| 805 | my $h2 = next_argument(); |
| 806 | my $h3 = next_argument(); |
| 807 | my $h4 = next_argument(); |
| 808 | $font = '' |
| 809 | if ($font eq 'textrm'); |
| 810 | $globals{'lineifont'} = $font; |
| 811 | '<table border align=center>' |
| 812 | . "\n <tr>$th1<b>$h1</b></th>" |
| 813 | . "\n $th2<b>$h2</b></th>" |
| 814 | . "\n $th3<b>$h3</b></th>" |
| 815 | . "\n $th4<b>$h4</b></th>" |
| 816 | . $_ |
| 817 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 818 | } |
| 819 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 820 | sub do_cmd_lineiv{ |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 821 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 822 | my $c1 = next_argument(); |
| 823 | my $c2 = next_argument(); |
| 824 | my $c3 = next_argument(); |
| 825 | my $c4 = next_argument(); |
| 826 | my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); |
| 827 | if ($font) { |
| 828 | $sfont = "<$font>"; |
| 829 | $efont = "</$font>"; |
| 830 | } |
| 831 | my($c1align,$c2align,$c3align,$c4align) = @col_aligns; |
| 832 | "<tr>$c1align$sfont$c1$efont</td>\n" |
| 833 | . " $c2align$c2</td>\n" |
| 834 | . " $c3align$c3</td>\n" |
| 835 | . " $c4align$c4</td>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 836 | . $_; |
| 837 | } |
| 838 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 839 | sub do_cmd_maketitle { |
| 840 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 841 | my $the_title = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 842 | if ($t_title) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 843 | $the_title .= "<h1 align=center>$t_title</h1>"; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 844 | } else { write_warnings("\nThis document has no title."); } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 845 | $the_title .= "\n<center>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 846 | if ($t_author) { |
| 847 | if ($t_authorURL) { |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 848 | my $href = translate_commands($t_authorURL); |
| 849 | $href = make_named_href('author', $href, "<strong>${t_author}</strong>"); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 850 | $the_title .= "\n<p>$href</p>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 851 | } else { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 852 | $the_title .= "\n<p><strong>$t_author</strong></p>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 853 | } |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 854 | } else { write_warnings("\nThere is no author for this document."); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 855 | if ($t_institute) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 856 | $the_title .= "\n<p>$t_institute</p>";} |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 857 | if ($DEVELOPER_ADDRESS) { |
| 858 | $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 859 | if ($t_affil) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 860 | $the_title .= "\n<p><i>$t_affil</i></p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 861 | if ($t_date) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 862 | $the_title .= "\n<p><strong>$t_date</strong>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 863 | if ($PYTHON_VERSION) { |
| 864 | $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";} |
| 865 | $the_title .= "</p>" |
| 866 | } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 867 | $the_title .= "\n</center>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 868 | if ($t_address) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 869 | $the_title .= "\n<p>$t_address</p>"; |
| 870 | } else { $the_title .= "\n<p>"} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 871 | if ($t_email) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 872 | $the_title .= "\n<p>$t_email</p>"; |
| 873 | }# else { $the_title .= "</p>" } |
Fred Drake | 514cd87 | 1998-07-28 21:52:57 +0000 | [diff] [blame] | 874 | $the_title . $_ ; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 875 | } |
| 876 | |
| 877 | |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 878 | # |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 879 | # Module synopsis support |
| 880 | # |
| 881 | |
| 882 | require SynopsisTable; |
| 883 | |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 884 | sub get_chapter_id(){ |
| 885 | my $id = do_cmd_thechapter(''); |
Fred Drake | 45f2601 | 1998-08-04 22:07:18 +0000 | [diff] [blame^] | 886 | $id =~ s/<SPAN CLASS="arabic">(\d+)<\/SPAN>/\1/; |
| 887 | $id =~ s/\.//; |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 888 | return $id; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 889 | } |
| 890 | |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 891 | %ModuleSynopses = ('chapter' => 'SynopsisTable instance'); |
| 892 | |
| 893 | sub get_synopsis_table($){ |
| 894 | my($chap) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 895 | my $st = $ModuleSynopses{$chap}; |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 896 | my $key; |
| 897 | foreach $key (keys %ModuleSynopses) { |
| 898 | if ($key eq $chap) { |
| 899 | return $ModuleSynopses{$chap}; |
| 900 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 901 | } |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 902 | $st = SynopsisTable->new(); |
| 903 | $ModuleSynopses{$chap} = $st; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 904 | return $st; |
| 905 | } |
| 906 | |
| 907 | sub do_cmd_declaremodule{ |
| 908 | local($_) = @_; |
| 909 | my $key = next_optional_argument(); |
| 910 | my $type = next_argument(); |
| 911 | my $name = next_argument(); |
| 912 | my $st = get_synopsis_table(get_chapter_id()); |
| 913 | # |
| 914 | $key = $name unless $key; |
| 915 | $type = 'built-in' if $type eq 'builtin'; |
| 916 | $st->declare($name, $key, $type); |
| 917 | define_module($type, $name); |
| 918 | anchor_label("module-$key",$CURRENT_FILE,$_) |
| 919 | } |
| 920 | |
| 921 | sub do_cmd_modulesynopsis{ |
| 922 | local($_) = @_; |
| 923 | my $st = get_synopsis_table(get_chapter_id()); |
| 924 | $st->set_synopsis($THIS_MODULE, next_argument()); |
| 925 | swallow_newline(); |
| 926 | $_; |
| 927 | } |
| 928 | |
| 929 | sub do_cmd_localmoduletable{ |
| 930 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 931 | my $chap = get_chapter_id(); |
Fred Drake | 53af049 | 1998-07-27 20:48:26 +0000 | [diff] [blame] | 932 | "<tex2htmllocalmoduletable><$chap>\\tableofchildlinks[off]" . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 933 | } |
| 934 | |
| 935 | sub process_all_localmoduletables{ |
| 936 | while (/<tex2htmllocalmoduletable><(\d+)>/) { |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 937 | my $match = $&; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 938 | my $chap = $1; |
| 939 | my $st = get_synopsis_table($chap); |
| 940 | my $data = $st->tohtml(); |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 941 | s/$match/$data/; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 942 | } |
| 943 | } |
| 944 | |
| 945 | |
| 946 | # |
| 947 | # "See also:" -- references placed at the end of a \section |
| 948 | # |
| 949 | |
| 950 | sub do_env_seealso{ |
| 951 | "<p><b>See Also:</b></p>\n" . @_[0]; |
| 952 | } |
| 953 | |
| 954 | sub do_cmd_seemodule{ |
| 955 | # Insert the right magic to jump to the module definition. This should |
| 956 | # work most of the time, at least for repeat builds.... |
| 957 | local($_) = @_; |
| 958 | my $key = next_optional_argument(); |
| 959 | my $module = next_argument(); |
| 960 | my $text = next_argument(); |
| 961 | $key = $module |
| 962 | unless $key; |
| 963 | "<p>Module <tt><b><a href=\"module-$key.html\">$module</a></b></tt>" |
| 964 | . " ($text)</p>" |
| 965 | . $_; |
| 966 | } |
| 967 | |
| 968 | sub do_cmd_seetext{ |
| 969 | '<p>' . @_[0]; |
| 970 | } |
| 971 | |
| 972 | |
| 973 | # |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 974 | # Definition list support. |
| 975 | # |
| 976 | |
| 977 | sub do_env_definitions{ |
| 978 | local($_) = @_; |
| 979 | swallow_newline(); |
| 980 | "<dl>$_</dl>\n"; |
| 981 | } |
| 982 | |
| 983 | sub do_cmd_term{ |
| 984 | local($_) = @_; |
| 985 | my($term, $id) = next_argument_id(); |
| 986 | my($name,$aname,$ahref) = link_info($id); |
| 987 | swallow_newline(); |
| 988 | # could easily add an index entry here... |
| 989 | "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_; |
| 990 | } |
| 991 | |
| 992 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 993 | 1; # This must be the last line |