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 | |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 11 | use File::Basename; |
| 12 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 13 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 14 | sub next_argument{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 15 | my $param; |
| 16 | $param = missing_braces() |
| 17 | unless ((s/$next_pair_pr_rx/$param=$2;''/eo) |
| 18 | ||(s/$next_pair_rx/$param=$2;''/eo)); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 19 | return $param; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | sub next_optional_argument{ |
| 23 | my($param,$rx) = ('', "^\\s*(\\[([^]]*)\\])?"); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 24 | s/$rx/$param=$2;''/eo; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 25 | return $param; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 28 | sub make_icon_filename($){ |
| 29 | my($myname, $mydir, $myext) = fileparse(@_[0], '\..*'); |
| 30 | chop $mydir; |
| 31 | if ($mydir eq '.') { |
| 32 | $mydir = $ICONSERVER; |
| 33 | } |
| 34 | $myext = ".$IMAGE_TYPE" |
| 35 | unless $myext; |
| 36 | return "$mydir$dd$myname$myext"; |
| 37 | } |
| 38 | |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 39 | sub get_link_icon($){ |
| 40 | my $url = @_[0]; |
| 41 | if ($OFF_SITE_LINK_ICON && ($url =~ /^[-a-zA-Z0-9.]+:/)) { |
| 42 | # absolute URL; assume it points off-site |
| 43 | my $icon = make_icon_filename($OFF_SITE_LINK_ICON); |
| 44 | return (" <img src='$icon'\n" |
Fred Drake | 5f84c9b | 2000-10-03 06:05:25 +0000 | [diff] [blame] | 45 | . " border='0' class='offsitelink'" |
| 46 | . ($OFF_SITE_LINK_ICON_HEIGHT |
| 47 | ? " height='$OFF_SITE_LINK_ICON_HEIGHT'" |
| 48 | : '') |
| 49 | . ($OFF_SITE_LINK_ICON_WIDTH |
| 50 | ? " width='$OFF_SITE_LINK_ICON_WIDTH'" |
| 51 | : '') |
| 52 | . " alt='[off-site link]'\n" |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 53 | . " >"); |
| 54 | } |
| 55 | return ''; |
| 56 | } |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 57 | |
| 58 | # This is a fairly simple hack; it supports \let when it is used to create |
| 59 | # (or redefine) a macro to exactly be some other macro: \let\newname=\oldname. |
Fred Drake | 5b73cdf | 1998-05-15 16:59:38 +0000 | [diff] [blame] | 60 | # 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] | 61 | # |
| 62 | sub do_cmd_let{ |
| 63 | local($_) = @_; |
| 64 | my $matched = 0; |
Fred Drake | 7a4ad0f | 1998-05-15 13:45:54 +0000 | [diff] [blame] | 65 | s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e; |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 66 | if ($matched) { |
| 67 | my($new, $old) = ($1, $3); |
| 68 | eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }'; |
| 69 | print "\ndefining handler for \\$new using \\$old\n"; |
| 70 | } |
Fred Drake | 7a4ad0f | 1998-05-15 13:45:54 +0000 | [diff] [blame] | 71 | else { |
| 72 | s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es; |
| 73 | if ($matched) { |
| 74 | my($new, $char) = ($1, $3); |
| 75 | eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }"; |
| 76 | print "\ndefining handler for \\$new to insert '$char'\n"; |
| 77 | } |
| 78 | else { |
| 79 | write_warnings("Could not interpret \\let construct..."); |
| 80 | } |
| 81 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 82 | return $_; |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | |
Fred Drake | c3fd45f | 2000-06-15 22:41:48 +0000 | [diff] [blame] | 86 | # the older version of LaTeX2HTML we use doesn't support this, but we use it: |
| 87 | |
| 88 | sub do_cmd_textasciitilde{ '~' . @_[0]; } |
Fred Drake | 056a71d | 2001-04-21 05:48:07 +0000 | [diff] [blame] | 89 | sub do_cmd_textasciicircum{ '^' . @_[0]; } |
Fred Drake | c3fd45f | 2000-06-15 22:41:48 +0000 | [diff] [blame] | 90 | |
| 91 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 92 | # words typeset in a special way (not in HTML though) |
| 93 | |
| 94 | sub do_cmd_ABC{ 'ABC' . @_[0]; } |
| 95 | sub do_cmd_UNIX{ 'Unix'. @_[0]; } |
| 96 | sub do_cmd_ASCII{ 'ASCII' . @_[0]; } |
| 97 | sub do_cmd_POSIX{ 'POSIX' . @_[0]; } |
| 98 | sub do_cmd_C{ 'C' . @_[0]; } |
| 99 | sub do_cmd_Cpp{ 'C++' . @_[0]; } |
| 100 | sub do_cmd_EOF{ 'EOF' . @_[0]; } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 101 | sub do_cmd_NULL{ '<tt class="constant">NULL</tt>' . @_[0]; } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 102 | |
| 103 | sub do_cmd_e{ '\' . @_[0]; } |
| 104 | |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 105 | $DEVELOPER_ADDRESS = ''; |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 106 | $SHORT_VERSION = ''; |
Fred Drake | d04592a | 2000-10-25 16:15:13 +0000 | [diff] [blame] | 107 | $PACKAGE_VERSION = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 108 | |
Fred Drake | d04592a | 2000-10-25 16:15:13 +0000 | [diff] [blame] | 109 | sub do_cmd_version{ $PACKAGE_VERSION . @_[0]; } |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 110 | sub do_cmd_shortversion{ $SHORT_VERSION . @_[0]; } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 111 | sub do_cmd_release{ |
| 112 | local($_) = @_; |
Fred Drake | d04592a | 2000-10-25 16:15:13 +0000 | [diff] [blame] | 113 | $PACKAGE_VERSION = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 114 | return $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 115 | } |
| 116 | |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 117 | sub do_cmd_setshortversion{ |
| 118 | local($_) = @_; |
| 119 | $SHORT_VERSION = next_argument(); |
| 120 | return $_; |
| 121 | } |
| 122 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 123 | sub do_cmd_authoraddress{ |
| 124 | local($_) = @_; |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 125 | $DEVELOPER_ADDRESS = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 126 | return $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 127 | } |
| 128 | |
Fred Drake | e16f679 | 1998-05-15 04:28:37 +0000 | [diff] [blame] | 129 | #sub do_cmd_developer{ do_cmd_author(@_[0]); } |
| 130 | #sub do_cmd_developers{ do_cmd_author(@_[0]); } |
| 131 | #sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); } |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 132 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 133 | sub do_cmd_hackscore{ |
| 134 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 135 | next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 136 | return '_' . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 137 | } |
| 138 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 139 | sub use_wrappers{ |
| 140 | local($_,$before,$after) = @_; |
| 141 | my $stuff = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 142 | return $before . $stuff . $after . $_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 143 | } |
| 144 | |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 145 | $IN_DESC_HANDLER = 0; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 146 | sub do_cmd_optional{ |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 147 | if ($IN_DESC_HANDLER) { |
| 148 | return use_wrappers(@_[0], "</var><big>\[</big><var>", |
| 149 | "</var><big>\]</big><var>"); |
| 150 | } |
| 151 | else { |
| 152 | return use_wrappers(@_[0], "<big>\[</big>", "<big>\]</big>"); |
| 153 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 154 | } |
| 155 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 156 | # Logical formatting (some based on texinfo), needs to be converted to |
| 157 | # minimalist HTML. The "minimalist" is primarily to reduce the size of |
| 158 | # output files for users that read them over the network rather than |
| 159 | # from local repositories. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 160 | |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 161 | # \file and \samp are at the end of this file since they screw up fontlock. |
| 162 | |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 163 | sub do_cmd_pytype{ return @_[0]; } |
Fred Drake | 3d5a04a | 2000-08-03 17:25:44 +0000 | [diff] [blame] | 164 | sub do_cmd_makevar{ |
| 165 | return use_wrappers(@_[0], '<span class="makevar">', '</span>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 166 | sub do_cmd_code{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 167 | return use_wrappers(@_[0], '<code>', '</code>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 168 | sub do_cmd_module{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 169 | return use_wrappers(@_[0], '<tt class="module">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 170 | sub do_cmd_keyword{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 171 | return use_wrappers(@_[0], '<tt class="keyword">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 172 | sub do_cmd_exception{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 173 | return use_wrappers(@_[0], '<tt class="exception">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 174 | sub do_cmd_class{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 175 | return use_wrappers(@_[0], '<tt class="class">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 176 | sub do_cmd_function{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 177 | return use_wrappers(@_[0], '<tt class="function">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 178 | sub do_cmd_constant{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 179 | return use_wrappers(@_[0], '<tt class="constant">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 180 | sub do_cmd_member{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 181 | return use_wrappers(@_[0], '<tt class="member">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 182 | sub do_cmd_method{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 183 | return use_wrappers(@_[0], '<tt class="method">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 184 | sub do_cmd_cfunction{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 185 | return use_wrappers(@_[0], '<tt class="cfunction">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 186 | sub do_cmd_cdata{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 187 | return use_wrappers(@_[0], '<tt class="cdata">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 188 | sub do_cmd_ctype{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 189 | return use_wrappers(@_[0], '<tt class="ctype">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 190 | sub do_cmd_regexp{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 191 | return use_wrappers(@_[0], '<tt class="regexp">', '</tt>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 192 | sub do_cmd_character{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 193 | return use_wrappers(@_[0], '"<tt class="character">', '</tt>"'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 194 | sub do_cmd_program{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 195 | return use_wrappers(@_[0], '<b class="program">', '</b>'); } |
Fred Drake | c9f5fe0 | 1999-11-09 16:59:42 +0000 | [diff] [blame] | 196 | sub do_cmd_programopt{ |
| 197 | return use_wrappers(@_[0], '<b class="programopt">', '</b>'); } |
Fred Drake | 0cd6021 | 2000-04-11 18:46:59 +0000 | [diff] [blame] | 198 | sub do_cmd_longprogramopt{ |
| 199 | # note that the --- will be later converted to -- by LaTeX2HTML |
| 200 | return use_wrappers(@_[0], '<b class="programopt">---', '</b>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 201 | sub do_cmd_email{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 202 | return use_wrappers(@_[0], '<span class="email">', '</span>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 203 | sub do_cmd_mimetype{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 204 | return use_wrappers(@_[0], '<span class="mimetype">', '</span>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 205 | sub do_cmd_var{ |
| 206 | return use_wrappers(@_[0], "<var>", "</var>"); } |
| 207 | sub do_cmd_dfn{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 208 | return use_wrappers(@_[0], '<i class="dfn">', '</i>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 209 | sub do_cmd_emph{ |
Fred Drake | 38178fd | 2000-09-22 17:05:04 +0000 | [diff] [blame] | 210 | return use_wrappers(@_[0], '<i>', '</i>'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 211 | sub do_cmd_file{ |
Fred Drake | 3d5a04a | 2000-08-03 17:25:44 +0000 | [diff] [blame] | 212 | return use_wrappers(@_[0], '<span class="file">', '</span>'); } |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 213 | sub do_cmd_filenq{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 214 | return do_cmd_file(@_[0]); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 215 | sub do_cmd_samp{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 216 | return use_wrappers(@_[0], '"<tt class="samp">', '</tt>"'); } |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 217 | sub do_cmd_kbd{ |
| 218 | return use_wrappers(@_[0], '<kbd>', '</kbd>'); } |
| 219 | sub do_cmd_strong{ |
| 220 | return use_wrappers(@_[0], '<b>', '</b>'); } |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 221 | sub do_cmd_textbf{ |
| 222 | return use_wrappers(@_[0], '<b>', '</b>'); } |
| 223 | sub do_cmd_textit{ |
| 224 | return use_wrappers(@_[0], '<i>', '</i>'); } |
| 225 | |
Fred Drake | 3d5a04a | 2000-08-03 17:25:44 +0000 | [diff] [blame] | 226 | sub do_cmd_moreargs{ |
| 227 | return '...' . @_[0]; } |
| 228 | sub do_cmd_unspecified{ |
| 229 | return '...' . @_[0]; } |
| 230 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 231 | |
Fred Drake | 2581704 | 1999-01-13 17:06:34 +0000 | [diff] [blame] | 232 | sub do_cmd_refmodule{ |
| 233 | # Insert the right magic to jump to the module definition. |
| 234 | local($_) = @_; |
| 235 | my $key = next_optional_argument(); |
| 236 | my $module = next_argument(); |
| 237 | $key = $module |
| 238 | unless $key; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 239 | return "<tt class='module'><a href='module-$key.html'>$module</a></tt>" |
| 240 | . $_; |
Fred Drake | 2581704 | 1999-01-13 17:06:34 +0000 | [diff] [blame] | 241 | } |
| 242 | |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 243 | sub do_cmd_newsgroup{ |
| 244 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 245 | my $newsgroup = next_argument(); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 246 | my $icon = get_link_icon("news:$newsgroup"); |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 247 | my $stuff = "<a class='newsgroup' href='news:$newsgroup'>" |
| 248 | . "$newsgroup$icon</a>"; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 249 | return $stuff . $_; |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 250 | } |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 251 | |
| 252 | sub do_cmd_envvar{ |
| 253 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 254 | my $envvar = next_argument(); |
| 255 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 256 | # The <tt> here is really to keep buildindex.py from making |
| 257 | # the variable name case-insensitive. |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 258 | add_index_entry("environment variables!$envvar@<tt>$envvar</tt>", |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 259 | $ahref); |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 260 | add_index_entry("$envvar (environment variable)", $ahref); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 261 | $aname =~ s/<a/<a class="envvar"/; |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 262 | return "$aname$envvar</a>" . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 263 | } |
| 264 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 265 | sub do_cmd_url{ |
| 266 | # use the URL as both text and hyperlink |
| 267 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 268 | my $url = next_argument(); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 269 | my $icon = get_link_icon($url); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 270 | $url =~ s/~/~/g; |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 271 | return "<a class=\"url\" href=\"$url\">$url$icon</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | sub do_cmd_manpage{ |
| 275 | # two parameters: \manpage{name}{section} |
| 276 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 277 | my $page = next_argument(); |
| 278 | my $section = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 279 | return "<span class='manpage'><i>$page</i>($section)</span>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 280 | } |
| 281 | |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 282 | $PEP_FORMAT = "http://python.sourceforge.net/peps/pep-XXXX.html"; |
| 283 | $RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt"; |
| 284 | |
| 285 | sub get_rfc_url($$){ |
| 286 | my($rfcnum, $format) = @_; |
| 287 | $rfcnum = sprintf("%04d", $rfcnum); |
| 288 | $format = "$format"; |
| 289 | $format =~ s/XXXX/$rfcnum/; |
| 290 | return $format; |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | sub do_cmd_pep{ |
| 294 | local($_) = @_; |
| 295 | my $rfcnumber = next_argument(); |
| 296 | my $id = "rfcref-" . ++$global{'max_id'}; |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 297 | my $href = get_rfc_url($rfcnumber, $PEP_FORMAT); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 298 | my $icon = get_link_icon($href); |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 299 | # Save the reference |
| 300 | my $nstr = gen_index_id("Python Enhancement Proposals!PEP $rfcnumber", ''); |
| 301 | $index{$nstr} .= make_half_href("$CURRENT_FILE#$id"); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 302 | return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">PEP $rfcnumber" |
| 303 | . "$icon</a>" . $_); |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 304 | } |
| 305 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 306 | sub do_cmd_rfc{ |
| 307 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 308 | my $rfcnumber = next_argument(); |
| 309 | my $id = "rfcref-" . ++$global{'max_id'}; |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 310 | my $href = get_rfc_url($rfcnumber, $RFC_FORMAT); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 311 | my $icon = get_link_icon($href); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 312 | # Save the reference |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 313 | my $nstr = gen_index_id("RFC!RFC $rfcnumber", ''); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 314 | $index{$nstr} .= make_half_href("$CURRENT_FILE#$id"); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 315 | return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">RFC $rfcnumber" |
| 316 | . "$icon</a>" . $_); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 317 | } |
| 318 | |
Fred Drake | c9f5fe0 | 1999-11-09 16:59:42 +0000 | [diff] [blame] | 319 | sub do_cmd_citetitle{ |
| 320 | local($_) = @_; |
| 321 | my $url = next_optional_argument(); |
| 322 | my $title = next_argument(); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 323 | my $icon = get_link_icon($url); |
Fred Drake | c9f5fe0 | 1999-11-09 16:59:42 +0000 | [diff] [blame] | 324 | my $repl = ''; |
| 325 | if ($url) { |
| 326 | $repl = ("<em class='citetitle'><a\n" |
| 327 | . " href='$url'\n" |
| 328 | . " title='$title'\n" |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 329 | . " >$title$icon</a></em>"); |
Fred Drake | c9f5fe0 | 1999-11-09 16:59:42 +0000 | [diff] [blame] | 330 | } |
| 331 | else { |
| 332 | $repl = "<em class='citetitle'\n >$title</em>"; |
| 333 | } |
| 334 | return $repl . $_; |
| 335 | } |
| 336 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 337 | sub do_cmd_deprecated{ |
| 338 | # two parameters: \deprecated{version}{whattodo} |
| 339 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 340 | my $release = next_argument(); |
| 341 | my $reason = next_argument(); |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 342 | return ('<div class="versionnote">' |
| 343 | . "<b>Deprecated since release $release.</b>" |
| 344 | . "\n$reason</div><p>" |
| 345 | . $_); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 346 | } |
| 347 | |
Fred Drake | c2b29d0 | 2001-04-18 03:11:04 +0000 | [diff] [blame] | 348 | sub versionnote{ |
| 349 | # one or two parameters: \versionnote[explanation]{version} |
| 350 | my $type = @_[0]; |
| 351 | local $_ = @_[1]; |
| 352 | my $explanation = next_optional_argument(); |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 353 | my $release = next_argument(); |
Fred Drake | c2b29d0 | 2001-04-18 03:11:04 +0000 | [diff] [blame] | 354 | my $text = "$type in version $release."; |
| 355 | if ($explanation) { |
| 356 | $text = "$type in version $release:\n$explanation."; |
| 357 | } |
| 358 | return "\n<span class='versionnote'>$text</span>\n" . $_; |
| 359 | } |
| 360 | |
| 361 | sub do_cmd_versionadded{ |
| 362 | return versionnote('New', @_); |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | sub do_cmd_versionchanged{ |
Fred Drake | c2b29d0 | 2001-04-18 03:11:04 +0000 | [diff] [blame] | 366 | return versionnote('Changed', @_); |
Fred Drake | 897d12b | 1998-07-27 20:33:17 +0000 | [diff] [blame] | 367 | } |
| 368 | |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 369 | # |
Fred Drake | 2cafcbb | 1999-03-25 16:57:04 +0000 | [diff] [blame] | 370 | # These function handle platform dependency tracking. |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 371 | # |
| 372 | sub do_cmd_platform{ |
| 373 | local($_) = @_; |
| 374 | my $platform = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 375 | $ModulePlatforms{"<tt class='module'>$THIS_MODULE</tt>"} = $platform; |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 376 | $platform = "Macintosh" |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 377 | if $platform eq 'Mac'; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 378 | return "\n<p class='availability'>Availability: <span" |
| 379 | . "\n class='platform'>$platform</span>.</p>\n" . $_; |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 380 | } |
| 381 | |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 382 | $IGNORE_PLATFORM_ANNOTATION = ''; |
| 383 | sub do_cmd_ignorePlatformAnnotation{ |
| 384 | local($_) = @_; |
| 385 | $IGNORE_PLATFORM_ANNOTATION = next_argument(); |
| 386 | return $_; |
| 387 | } |
| 388 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 389 | |
| 390 | # index commands |
| 391 | |
| 392 | $INDEX_SUBITEM = ""; |
| 393 | |
| 394 | sub get_indexsubitem{ |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 395 | return $INDEX_SUBITEM ? " $INDEX_SUBITEM" : ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | sub do_cmd_setindexsubitem{ |
| 399 | local($_) = @_; |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 400 | $INDEX_SUBITEM = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 401 | return $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 402 | } |
| 403 | |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 404 | sub do_cmd_withsubitem{ |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 405 | # We can't really do the right thing, because LaTeX2HTML doesn't |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 406 | # do things in the right order, but we need to at least strip this stuff |
| 407 | # out, and leave anything that the second argument expanded out to. |
| 408 | # |
| 409 | local($_) = @_; |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 410 | my $oldsubitem = $INDEX_SUBITEM; |
| 411 | $INDEX_SUBITEM = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 412 | my $stuff = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 413 | my $br_id = ++$globals{'max_id'}; |
| 414 | my $marker = "$O$br_id$C"; |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 415 | return |
| 416 | $stuff |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 417 | . "\\setindexsubitem$marker$oldsubitem$marker" |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 418 | . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 419 | } |
| 420 | |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 421 | # This is the prologue macro which is required to start writing the |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 422 | # mod\jobname.idx file; we can just ignore it. (Defining this suppresses |
| 423 | # a warning that \makemodindex is unknown.) |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 424 | # |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 425 | sub do_cmd_makemodindex{ return @_[0]; } |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 426 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 427 | # We're in the document subdirectory when this happens! |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 428 | # |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 429 | open(IDXFILE, '>index.dat') || die "\n$!\n"; |
| 430 | open(INTLABELS, '>intlabels.pl') || die "\n$!\n"; |
Fred Drake | 166abba | 1998-04-08 23:10:54 +0000 | [diff] [blame] | 431 | print INTLABELS "%internal_labels = ();\n"; |
| 432 | print INTLABELS "1; # hack in case there are no entries\n\n"; |
| 433 | |
| 434 | # Using \0 for this is bad because we can't use common tools to work with the |
| 435 | # resulting files. Things like grep can be useful with this stuff! |
| 436 | # |
| 437 | $IDXFILE_FIELD_SEP = "\1"; |
| 438 | |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 439 | sub write_idxfile{ |
| 440 | my ($ahref, $str) = @_; |
| 441 | print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 442 | } |
| 443 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 444 | |
| 445 | sub gen_link{ |
| 446 | my($node,$target) = @_; |
| 447 | print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 448 | return "<a href='$node#$target'>"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 449 | } |
| 450 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 451 | sub add_index_entry{ |
| 452 | # add an entry to the index structures; ignore the return value |
| 453 | my($str,$ahref) = @_; |
| 454 | $str = gen_index_id($str, ''); |
| 455 | $index{$str} .= $ahref; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 456 | write_idxfile($ahref, $str); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 457 | } |
| 458 | |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 459 | sub new_link_info{ |
| 460 | my $name = "l2h-" . ++$globals{'max_id'}; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 461 | my $aname = "<a name='$name'>"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 462 | my $ahref = gen_link($CURRENT_FILE, $name); |
| 463 | return ($name, $aname, $ahref); |
| 464 | } |
| 465 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 466 | $IndexMacroPattern = ''; |
| 467 | sub define_indexing_macro{ |
| 468 | my $count = @_; |
| 469 | my $i = 0; |
| 470 | for (; $i < $count; ++$i) { |
| 471 | my $name = @_[$i]; |
| 472 | my $cmd = "idx_cmd_$name"; |
| 473 | die "\nNo function $cmd() defined!\n" |
| 474 | if (!defined &$cmd); |
| 475 | eval ("sub do_cmd_$name { return process_index_macros(" |
| 476 | . "\@_[0], '$name'); }"); |
| 477 | if (length($IndexMacroPattern) == 0) { |
| 478 | $IndexMacroPattern = "$name"; |
| 479 | } |
| 480 | else { |
| 481 | $IndexMacroPattern .= "|$name"; |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | $DEBUG_INDEXING = 0; |
| 487 | sub process_index_macros{ |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 488 | local($_) = @_; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 489 | my $cmdname = @_[1]; # This is what triggered us in the first place; |
| 490 | # we know it's real, so just process it. |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 491 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 492 | my $cmd = "idx_cmd_$cmdname"; |
| 493 | print "\nIndexing: \\$cmdname" |
| 494 | if $DEBUG_INDEXING; |
| 495 | &$cmd($ahref); # modifies $_ and adds index entries |
| 496 | while (/^[\s\n]*\\($IndexMacroPattern)</) { |
| 497 | $cmdname = "$1"; |
| 498 | print " \\$cmdname" |
| 499 | if $DEBUG_INDEXING; |
| 500 | $cmd = "idx_cmd_$cmdname"; |
| 501 | if (!defined &$cmd) { |
| 502 | last; |
| 503 | } |
| 504 | else { |
| 505 | s/^[\s\n]*\\$cmdname//; |
| 506 | &$cmd($ahref); |
| 507 | } |
| 508 | } |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 509 | if (/^[ \t\r\n]/) { |
| 510 | $_ = substr($_, 1); |
| 511 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 512 | return "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 513 | } |
| 514 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 515 | define_indexing_macro('index'); |
| 516 | sub idx_cmd_index{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 517 | my $str = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 518 | add_index_entry("$str", @_[0]); |
Fred Drake | 2e7edb8 | 1998-05-11 18:31:17 +0000 | [diff] [blame] | 519 | } |
| 520 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 521 | define_indexing_macro('kwindex'); |
| 522 | sub idx_cmd_kwindex{ |
| 523 | my $str = next_argument(); |
| 524 | add_index_entry("<tt>$str</tt>!keyword", @_[0]); |
| 525 | add_index_entry("keyword!<tt>$str</tt>", @_[0]); |
| 526 | } |
| 527 | |
| 528 | define_indexing_macro('indexii'); |
| 529 | sub idx_cmd_indexii{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 530 | my $str1 = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 531 | my $str2 = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 532 | add_index_entry("$str1!$str2", @_[0]); |
| 533 | add_index_entry("$str2!$str1", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 534 | } |
| 535 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 536 | define_indexing_macro('indexiii'); |
| 537 | sub idx_cmd_indexiii{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 538 | my $str1 = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 539 | my $str2 = next_argument(); |
| 540 | my $str3 = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 541 | add_index_entry("$str1!$str2 $str3", @_[0]); |
| 542 | add_index_entry("$str2!$str3, $str1", @_[0]); |
| 543 | add_index_entry("$str3!$str1 $str2", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 544 | } |
| 545 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 546 | define_indexing_macro('indexiv'); |
| 547 | sub idx_cmd_indexiv{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 548 | my $str1 = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 549 | my $str2 = next_argument(); |
| 550 | my $str3 = next_argument(); |
| 551 | my $str4 = next_argument(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 552 | add_index_entry("$str1!$str2 $str3 $str4", @_[0]); |
| 553 | add_index_entry("$str2!$str3 $str4, $str1", @_[0]); |
| 554 | add_index_entry("$str3!$str4, $str1 $str2", @_[0]); |
| 555 | add_index_entry("$str4!$$str1 $str2 $str3", @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 556 | } |
| 557 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 558 | define_indexing_macro('ttindex'); |
| 559 | sub idx_cmd_ttindex{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 560 | my $str = next_argument(); |
| 561 | my $entry = $str . get_indexsubitem(); |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 562 | add_index_entry($entry, @_[0]); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 563 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 564 | |
| 565 | sub my_typed_index_helper{ |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 566 | my($word,$ahref) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 567 | my $str = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 568 | add_index_entry("$str $word", $ahref); |
| 569 | add_index_entry("$word!$str", $ahref); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 570 | } |
| 571 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 572 | define_indexing_macro('stindex', 'opindex', 'exindex', 'obindex'); |
| 573 | sub idx_cmd_stindex{ my_typed_index_helper('statement', @_[0]); } |
| 574 | sub idx_cmd_opindex{ my_typed_index_helper('operator', @_[0]); } |
| 575 | sub idx_cmd_exindex{ my_typed_index_helper('exception', @_[0]); } |
| 576 | sub idx_cmd_obindex{ my_typed_index_helper('object', @_[0]); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 577 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 578 | define_indexing_macro('bifuncindex'); |
| 579 | sub idx_cmd_bifuncindex{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 580 | my $str = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 581 | add_index_entry("<tt class='function'>$str()</tt> (built-in function)", |
| 582 | @_[0]); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 586 | sub make_mod_index_entry{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 587 | my($str,$define) = @_; |
| 588 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 589 | # equivalent of add_index_entry() using $define instead of '' |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 590 | $ahref =~ s/\#[-_a-zA-Z0-9]*\"/\"/ |
| 591 | if ($define eq 'DEF'); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 592 | $str = gen_index_id($str, $define); |
| 593 | $index{$str} .= $ahref; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 594 | write_idxfile($ahref, $str); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 595 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 596 | if ($define eq 'DEF') { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 597 | # add to the module index |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 598 | $str =~ /(<tt.*<\/tt>)/; |
| 599 | my $nstr = $1; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 600 | $Modules{$nstr} .= $ahref; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 601 | } |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 602 | return "$aname$anchor_invisible_mark2</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 603 | } |
| 604 | |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 605 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 606 | $THIS_MODULE = ''; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 607 | $THIS_CLASS = ''; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 608 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 609 | sub define_module{ |
| 610 | my($word,$name) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 611 | my $section_tag = join('', @curr_sec_id); |
Fred Drake | 3e4c614 | 1999-05-17 15:00:32 +0000 | [diff] [blame] | 612 | if ($word ne "built-in" && $word ne "extension" |
| 613 | && $word ne "standard" && $word ne "") { |
| 614 | write_warnings("Bad module type '$word'" |
| 615 | . " for \\declaremodule (module $name)"); |
| 616 | $word = ""; |
| 617 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 618 | $word = "$word " if $word; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 619 | $THIS_MODULE = "$name"; |
Fred Drake | 5942b43 | 2000-10-30 06:24:56 +0000 | [diff] [blame] | 620 | $INDEX_SUBITEM = "(in module $name)"; |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 621 | print "[$name]"; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 622 | return make_mod_index_entry( |
| 623 | "<tt class='module'>$name</tt> (${word}module)", 'DEF'); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 624 | } |
| 625 | |
| 626 | sub my_module_index_helper{ |
| 627 | local($word, $_) = @_; |
| 628 | my $name = next_argument(); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 629 | return define_module($word, $name) . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 630 | } |
| 631 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 632 | sub do_cmd_modindex{ return my_module_index_helper('', @_); } |
| 633 | sub do_cmd_bimodindex{ return my_module_index_helper('built-in', @_); } |
| 634 | sub do_cmd_exmodindex{ return my_module_index_helper('extension', @_); } |
| 635 | sub do_cmd_stmodindex{ return my_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 636 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 637 | sub ref_module_index_helper{ |
Fred Drake | 37cc0c0 | 2000-04-26 18:05:24 +0000 | [diff] [blame] | 638 | my($word, $ahref) = @_; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 639 | my $str = next_argument(); |
| 640 | $word = "$word " if $word; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 641 | $str = "<tt class='module'>$str</tt> (${word}module)"; |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 642 | # can't use add_index_entry() since the 2nd arg to gen_index_id() is used; |
| 643 | # just inline it all here |
| 644 | $str = gen_index_id($str, 'REF'); |
| 645 | $index{$str} .= $ahref; |
| 646 | write_idxfile($ahref, $str); |
| 647 | } |
| 648 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 649 | # these should be adjusted a bit.... |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 650 | define_indexing_macro('refmodindex', 'refbimodindex', |
| 651 | 'refexmodindex', 'refstmodindex'); |
| 652 | sub idx_cmd_refmodindex{ return ref_module_index_helper('', @_); } |
| 653 | sub idx_cmd_refbimodindex{ return ref_module_index_helper('built-in', @_); } |
| 654 | sub idx_cmd_refexmodindex{ return ref_module_index_helper('extension', @_); } |
| 655 | sub idx_cmd_refstmodindex{ return ref_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 656 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 657 | sub do_cmd_nodename{ return do_cmd_label(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 658 | |
| 659 | sub init_myformat{ |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 660 | $anchor_invisible_mark = ' '; |
| 661 | $anchor_invisible_mark2 = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 662 | $anchor_mark = ''; |
| 663 | $icons{'anchor_mark'} = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 664 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 665 | init_myformat(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 666 | |
Fred Drake | ab03215 | 1999-05-13 18:36:54 +0000 | [diff] [blame] | 667 | # Create an index entry, but include the string in the target anchor |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 668 | # instead of the dummy filler. |
| 669 | # |
| 670 | sub make_str_index_entry{ |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 671 | my($str) = @_; |
| 672 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 673 | add_index_entry($str, $ahref); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 674 | return "$aname$str</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 675 | } |
| 676 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 677 | $REFCOUNTS_LOADED = 0; |
| 678 | |
| 679 | sub load_refcounts{ |
| 680 | $REFCOUNTS_LOADED = 1; |
| 681 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 682 | my $myname, $mydir, $myext; |
| 683 | ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*'); |
| 684 | chop $mydir; # remove trailing '/' |
| 685 | ($myname, $mydir, $myext) = fileparse($mydir, '\..*'); |
| 686 | chop $mydir; # remove trailing '/' |
| 687 | $mydir = getcwd() . "$dd$mydir" |
| 688 | unless $mydir =~ s|^/|/|; |
| 689 | local $_; |
| 690 | my $filename = "$mydir${dd}api${dd}refcounts.dat"; |
| 691 | open(REFCOUNT_FILE, "<$filename") || die "\n$!\n"; |
| 692 | print "[loading API refcount data]"; |
| 693 | while (<REFCOUNT_FILE>) { |
Fred Drake | c2578c5 | 2000-04-10 18:26:45 +0000 | [diff] [blame] | 694 | if (/([a-zA-Z0-9_]+):PyObject\*:([a-zA-Z0-9_]*):(0|[-+]1|null):(.*)$/) { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 695 | my($func, $param, $count, $comment) = ($1, $2, $3, $4); |
| 696 | #print "\n$func($param) --> $count"; |
| 697 | $REFCOUNTS{"$func:$param"} = $count; |
| 698 | } |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | sub get_refcount{ |
| 703 | my ($func, $param) = @_; |
| 704 | load_refcounts() |
| 705 | unless $REFCOUNTS_LOADED; |
| 706 | return $REFCOUNTS{"$func:$param"}; |
| 707 | } |
| 708 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 709 | sub do_env_cfuncdesc{ |
| 710 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 711 | my $return_type = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 712 | my $function_name = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 713 | my $arg_list = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 714 | my $idx = make_str_index_entry( |
| 715 | "<tt class='cfunction'>$function_name()</tt>" . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 716 | $idx =~ s/ \(.*\)//; |
Fred Drake | 241551c | 2000-08-11 20:04:19 +0000 | [diff] [blame] | 717 | $idx =~ s/\(\)//; # ???? - why both of these? |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 718 | my $result_rc = get_refcount($function_name, ''); |
| 719 | my $rcinfo = ''; |
| 720 | if ($result_rc eq '+1') { |
Fred Drake | 241551c | 2000-08-11 20:04:19 +0000 | [diff] [blame] | 721 | $rcinfo = 'New reference'; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 722 | } |
| 723 | elsif ($result_rc eq '0') { |
Fred Drake | 241551c | 2000-08-11 20:04:19 +0000 | [diff] [blame] | 724 | $rcinfo = 'Borrowed reference'; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 725 | } |
Fred Drake | c2578c5 | 2000-04-10 18:26:45 +0000 | [diff] [blame] | 726 | elsif ($result_rc eq 'null') { |
Fred Drake | 241551c | 2000-08-11 20:04:19 +0000 | [diff] [blame] | 727 | $rcinfo = 'Always <tt class="constant">NULL</tt>'; |
Fred Drake | c2578c5 | 2000-04-10 18:26:45 +0000 | [diff] [blame] | 728 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 729 | if ($rcinfo ne '') { |
Fred Drake | 241551c | 2000-08-11 20:04:19 +0000 | [diff] [blame] | 730 | $rcinfo = ( "\n<div class=\"refcount-info\">" |
| 731 | . "\n <span class=\"label\">Return value:</span>" |
| 732 | . "\n <span class=\"value\">$rcinfo.</span>" |
| 733 | . "\n</div>"); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 734 | } |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 735 | return "<dl><dt>$return_type <b>$idx</b>(<var>$arg_list</var>)\n<dd>" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 736 | . $rcinfo |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 737 | . $_ |
| 738 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 739 | } |
| 740 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 741 | sub do_env_csimplemacrodesc{ |
| 742 | local($_) = @_; |
| 743 | my $name = next_argument(); |
| 744 | my $idx = make_str_index_entry("<tt class='macro'>$name</tt>"); |
| 745 | return "<dl><dt><b>$idx</b>\n<dd>" |
| 746 | . $_ |
| 747 | . '</dl>' |
| 748 | } |
| 749 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 750 | sub do_env_ctypedesc{ |
| 751 | local($_) = @_; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 752 | my $index_name = next_optional_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 753 | my $type_name = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 754 | $index_name = $type_name |
| 755 | unless $index_name; |
| 756 | my($name,$aname,$ahref) = new_link_info(); |
| 757 | add_index_entry("<tt class='ctype'>$index_name</tt> (C type)", $ahref); |
| 758 | return "<dl><dt><b><tt class='ctype'>$aname$type_name</a></tt></b>\n<dd>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 759 | . $_ |
| 760 | . '</dl>' |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | sub do_env_cvardesc{ |
| 764 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 765 | my $var_type = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 766 | my $var_name = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 767 | my $idx = make_str_index_entry("<tt class='cdata'>$var_name</tt>" |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 768 | . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 769 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 770 | return "<dl><dt>$var_type <b>$idx</b>\n" |
| 771 | . '<dd>' |
| 772 | . $_ |
| 773 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 774 | } |
| 775 | |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 776 | sub convert_args($){ |
| 777 | local($IN_DESC_HANDLER) = 1; |
| 778 | local($_) = @_; |
| 779 | return translate_commands($_); |
| 780 | } |
| 781 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 782 | sub do_env_funcdesc{ |
| 783 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 784 | my $function_name = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 785 | my $arg_list = convert_args(next_argument()); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 786 | my $idx = make_str_index_entry("<tt class='function'>$function_name()</tt>" |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 787 | . get_indexsubitem()); |
| 788 | $idx =~ s/ \(.*\)//; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 789 | $idx =~ s/\(\)<\/tt>/<\/tt>/; |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 790 | 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] | 791 | } |
| 792 | |
| 793 | sub do_env_funcdescni{ |
| 794 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 795 | my $function_name = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 796 | my $arg_list = convert_args(next_argument()); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 797 | return "<dl><dt><b><tt class='function'>$function_name</tt></b>" |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 798 | . "(<var>$arg_list</var>)\n" |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 799 | . '<dd>' |
| 800 | . $_ |
| 801 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | sub do_cmd_funcline{ |
| 805 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 806 | my $function_name = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 807 | my $arg_list = convert_args(next_argument()); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 808 | my $prefix = "<tt class='function'>$function_name()</tt>"; |
Fred Drake | ca675e4 | 1999-04-21 15:58:58 +0000 | [diff] [blame] | 809 | my $idx = make_str_index_entry($prefix . get_indexsubitem()); |
| 810 | $prefix =~ s/\(\)//; |
| 811 | |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 812 | return "<dt><b>$prefix</b>(<var>$arg_list</var>)\n<dd>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 813 | } |
| 814 | |
Fred Drake | 6b3fb78 | 1999-07-12 16:50:09 +0000 | [diff] [blame] | 815 | sub do_cmd_funclineni{ |
| 816 | local($_) = @_; |
| 817 | my $function_name = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 818 | my $arg_list = convert_args(next_argument()); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 819 | my $prefix = "<tt class='function'>$function_name</tt>"; |
Fred Drake | 6b3fb78 | 1999-07-12 16:50:09 +0000 | [diff] [blame] | 820 | |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 821 | return "<dt><b>$prefix</b>(<var>$arg_list</var>)\n<dd>" . $_; |
Fred Drake | 6b3fb78 | 1999-07-12 16:50:09 +0000 | [diff] [blame] | 822 | } |
| 823 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 824 | # Change this flag to index the opcode entries. I don't think it's very |
| 825 | # useful to index them, since they're only presented to describe the dis |
| 826 | # module. |
| 827 | # |
| 828 | $INDEX_OPCODES = 0; |
| 829 | |
| 830 | sub do_env_opcodedesc{ |
| 831 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 832 | my $opcode_name = next_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 833 | my $arg_list = next_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 834 | my $idx; |
| 835 | if ($INDEX_OPCODES) { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 836 | $idx = make_str_index_entry("<tt class='opcode'>$opcode_name</tt>" |
| 837 | . " (byte code instruction)"); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 838 | $idx =~ s/ \(byte code instruction\)//; |
| 839 | } |
| 840 | else { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 841 | $idx = "<tt class='opcode'>$opcode_name</tt>"; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 842 | } |
| 843 | my $stuff = "<dl><dt><b>$idx</b>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 844 | if ($arg_list) { |
| 845 | $stuff .= " <var>$arg_list</var>"; |
| 846 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 847 | return $stuff . "\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 848 | } |
| 849 | |
| 850 | sub do_env_datadesc{ |
| 851 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 852 | my $dataname = next_argument(); |
| 853 | my $idx = make_str_index_entry("<tt>$dataname</tt>" . get_indexsubitem()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 854 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 855 | return "<dl><dt><b>$idx</b>\n<dd>" |
| 856 | . $_ |
| 857 | . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | sub do_env_datadescni{ |
| 861 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 862 | my $idx = next_argument(); |
| 863 | if (! $STRING_INDEX_TT) { |
| 864 | $idx = "<tt>$idx</tt>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 865 | } |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 866 | return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 867 | } |
| 868 | |
| 869 | sub do_cmd_dataline{ |
| 870 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 871 | my $data_name = next_argument(); |
| 872 | my $idx = make_str_index_entry("<tt>$data_name</tt>" . get_indexsubitem()); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 873 | $idx =~ s/ \(.*\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 874 | return "<dt><b>$idx</b><dd>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 875 | } |
| 876 | |
Fred Drake | adb272c | 2000-04-10 17:47:14 +0000 | [diff] [blame] | 877 | sub do_cmd_datalineni{ |
| 878 | local($_) = @_; |
| 879 | my $data_name = next_argument(); |
| 880 | return "<dt><b><tt>$data_name</tt></b><dd>" . $_; |
| 881 | } |
| 882 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 883 | sub do_env_excdesc{ |
| 884 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 885 | my $excname = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 886 | my $idx = make_str_index_entry("<tt class='exception'>$excname</tt>"); |
Fred Drake | ab357ec | 2001-03-02 18:57:05 +0000 | [diff] [blame] | 887 | return "<dl><dt><b>exception $idx</b>\n<dd>" . $_ . '</dl>' |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 888 | } |
| 889 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 890 | sub do_env_fulllineitems{ return do_env_itemize(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 891 | |
| 892 | |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 893 | sub handle_classlike_descriptor{ |
| 894 | local($_, $what) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 895 | $THIS_CLASS = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 896 | my $arg_list = convert_args(next_argument()); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 897 | $idx = make_str_index_entry( |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 898 | "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" ); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 899 | $idx =~ s/ \(.*\)//; |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 900 | return ("<dl><dt><b>$what $idx</b>(<var>$arg_list</var>)\n<dd>" |
Fred Drake | ab357ec | 2001-03-02 18:57:05 +0000 | [diff] [blame] | 901 | . $_ |
| 902 | . '</dl>'); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 903 | } |
| 904 | |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 905 | sub do_env_classdesc{ |
| 906 | return handle_classlike_descriptor(@_[0], "class"); |
| 907 | } |
| 908 | |
Fred Drake | 06a01e8 | 2001-05-11 01:00:30 +0000 | [diff] [blame] | 909 | sub do_env_classdescstar{ |
| 910 | local($_) = @_; |
| 911 | $THIS_CLASS = next_argument(); |
| 912 | $idx = make_str_index_entry( |
| 913 | "<tt class='class'>$THIS_CLASS</tt> (class in $THIS_MODULE)" ); |
| 914 | $idx =~ s/ \(.*\)//; |
| 915 | return ("<dl><dt><b>class $idx</b>\n<dd>" |
| 916 | . $_ |
| 917 | . '</dl>'); |
| 918 | } |
| 919 | |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 920 | sub do_env_excclassdesc{ |
| 921 | return handle_classlike_descriptor(@_[0], "exception"); |
| 922 | } |
| 923 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 924 | |
| 925 | sub do_env_methoddesc{ |
| 926 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 927 | my $class_name = next_optional_argument(); |
| 928 | $class_name = $THIS_CLASS |
| 929 | unless $class_name; |
Fred Drake | 5a0ca4e | 1999-01-12 04:16:51 +0000 | [diff] [blame] | 930 | my $method = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 931 | my $arg_list = convert_args(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 932 | my $extra = ''; |
| 933 | if ($class_name) { |
| 934 | $extra = " ($class_name method)"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 935 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 936 | my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra"); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 937 | $idx =~ s/ \(.*\)//; |
| 938 | $idx =~ s/\(\)//; |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 939 | 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] | 940 | } |
| 941 | |
| 942 | |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 943 | sub do_cmd_methodline{ |
| 944 | local($_) = @_; |
| 945 | my $class_name = next_optional_argument(); |
| 946 | $class_name = $THIS_CLASS |
| 947 | unless $class_name; |
| 948 | my $method = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 949 | my $arg_list = convert_args(next_argument()); |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 950 | my $extra = ''; |
| 951 | if ($class_name) { |
| 952 | $extra = " ($class_name method)"; |
| 953 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 954 | my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra"); |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 955 | $idx =~ s/ \(.*\)//; |
| 956 | $idx =~ s/\(\)//; |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 957 | return "<dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>" |
Fred Drake | 7d45f6d | 1999-01-05 14:39:27 +0000 | [diff] [blame] | 958 | . $_; |
| 959 | } |
| 960 | |
| 961 | |
Fred Drake | d64a40d | 1998-09-10 18:59:13 +0000 | [diff] [blame] | 962 | sub do_cmd_methodlineni{ |
| 963 | local($_) = @_; |
| 964 | next_optional_argument(); |
| 965 | my $method = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 966 | my $arg_list = convert_args(next_argument()); |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 967 | return "<dt><b>$method</b>(<var>$arg_list</var>)\n<dd>" |
Fred Drake | d64a40d | 1998-09-10 18:59:13 +0000 | [diff] [blame] | 968 | . $_; |
| 969 | } |
| 970 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 971 | sub do_env_methoddescni{ |
| 972 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 973 | next_optional_argument(); |
| 974 | my $method = next_argument(); |
Fred Drake | 3cdb89d | 2000-09-14 20:17:23 +0000 | [diff] [blame] | 975 | my $arg_list = convert_args(next_argument()); |
Fred Drake | c612a14 | 2001-03-29 18:24:08 +0000 | [diff] [blame] | 976 | return "<dl><dt><b>$method</b>(<var>$arg_list</var>)\n<dd>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 977 | . $_ |
| 978 | . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 979 | } |
| 980 | |
| 981 | |
| 982 | sub do_env_memberdesc{ |
| 983 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 984 | my $class = next_optional_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 985 | my $member = next_argument(); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 986 | $class = $THIS_CLASS |
| 987 | unless $class; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 988 | my $extra = ''; |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 989 | $extra = " ($class attribute)" |
| 990 | if ($class ne ''); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 991 | my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra"); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 992 | $idx =~ s/ \(.*\)//; |
| 993 | $idx =~ s/\(\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 994 | return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 995 | } |
| 996 | |
| 997 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 998 | sub do_cmd_memberline{ |
| 999 | local($_) = @_; |
| 1000 | my $class = next_optional_argument(); |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 1001 | my $member = next_argument(); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 1002 | $class = $THIS_CLASS |
| 1003 | unless $class; |
| 1004 | my $extra = ''; |
Fred Drake | 085b812 | 1999-04-21 14:00:29 +0000 | [diff] [blame] | 1005 | $extra = " ($class attribute)" |
| 1006 | if ($class ne ''); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1007 | my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra"); |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 1008 | $idx =~ s/ \(.*\)//; |
| 1009 | $idx =~ s/\(\)//; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1010 | return "<dt><b>$idx</b><dd>" . $_; |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 1011 | } |
| 1012 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 1013 | sub do_env_memberdescni{ |
| 1014 | local($_) = @_; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1015 | next_optional_argument(); |
| 1016 | my $member = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1017 | return "<dl><dt><b><tt class='member'>$member</tt></b>\n<dd>" |
| 1018 | . $_ |
| 1019 | . '</dl>'; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 1020 | } |
| 1021 | |
| 1022 | |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 1023 | sub do_cmd_memberlineni{ |
| 1024 | local($_) = @_; |
| 1025 | next_optional_argument(); |
| 1026 | my $member = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1027 | return "<dt><b><tt class='member'>$member</tt></b><dd>" . $_; |
Fred Drake | 5ccf330 | 1998-04-17 20:04:09 +0000 | [diff] [blame] | 1028 | } |
| 1029 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1030 | @col_aligns = ('<td>', '<td>', '<td>', '<td>'); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1031 | |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1032 | sub fix_font{ |
| 1033 | # do a little magic on a font name to get the right behavior in the first |
| 1034 | # column of the output table |
| 1035 | my $font = @_[0]; |
| 1036 | if ($font eq 'textrm') { |
| 1037 | $font = ''; |
| 1038 | } |
| 1039 | elsif ($font eq 'file' || $font eq 'filenq') { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1040 | $font = 'tt class="file"'; |
| 1041 | } |
| 1042 | elsif ($font eq 'member') { |
| 1043 | $font = 'tt class="member"'; |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1044 | } |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1045 | elsif ($font eq 'class') { |
| 1046 | $font = 'tt class="class"'; |
| 1047 | } |
Fred Drake | 7388f73 | 2000-06-28 21:06:08 +0000 | [diff] [blame] | 1048 | elsif ($font eq 'constant') { |
| 1049 | $font = 'tt class="constant"'; |
| 1050 | } |
Fred Drake | cb0fc9c | 2000-08-09 13:45:04 +0000 | [diff] [blame] | 1051 | elsif ($font eq 'kbd') { |
| 1052 | $font = 'kbd'; |
| 1053 | } |
Fred Drake | d04592a | 2000-10-25 16:15:13 +0000 | [diff] [blame] | 1054 | elsif ($font eq 'programopt') { |
| 1055 | $font = 'b'; |
| 1056 | } |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 1057 | elsif ($font eq 'exception') { |
| 1058 | $font = 'tt class="exception"'; |
| 1059 | } |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1060 | return $font; |
| 1061 | } |
| 1062 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1063 | sub figure_column_alignment{ |
| 1064 | my $a = @_[0]; |
| 1065 | my $mark = substr($a, 0, 1); |
| 1066 | my $r = ''; |
| 1067 | if ($mark eq 'c') |
| 1068 | { $r = ' align="center"'; } |
| 1069 | elsif ($mark eq 'r') |
| 1070 | { $r = ' align="right"'; } |
| 1071 | elsif ($mark eq 'l') |
| 1072 | { $r = ' align="left"'; } |
| 1073 | elsif ($mark eq 'p') |
| 1074 | { $r = ' align="left"'; } |
| 1075 | return $r; |
| 1076 | } |
| 1077 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1078 | sub setup_column_alignments{ |
| 1079 | local($_) = @_; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1080 | my($s1,$s2,$s3,$s4) = split(/[|]/,$_); |
| 1081 | my $a1 = figure_column_alignment($s1); |
| 1082 | my $a2 = figure_column_alignment($s2); |
| 1083 | my $a3 = figure_column_alignment($s3); |
| 1084 | my $a4 = figure_column_alignment($s4); |
| 1085 | $col_aligns[0] = "<td$a1 valign=\"baseline\">"; |
| 1086 | $col_aligns[1] = "<td$a2>"; |
| 1087 | $col_aligns[2] = "<td$a3>"; |
| 1088 | $col_aligns[3] = "<td$a4>"; |
Fred Drake | 79189b5 | 1999-04-28 13:54:30 +0000 | [diff] [blame] | 1089 | # return the aligned header start tags |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1090 | return ("<th$a1>", "<th$a2>", "<th$a3>", "<th$a4>"); |
| 1091 | } |
| 1092 | |
| 1093 | sub get_table_col1_fonts{ |
| 1094 | my $font = $globals{'lineifont'}; |
| 1095 | my ($sfont,$efont) = ('', ''); |
| 1096 | if ($font) { |
| 1097 | $sfont = "<$font>"; |
| 1098 | $efont = "</$font>"; |
| 1099 | $efont =~ s/ .*>/>/; |
| 1100 | } |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1101 | return ($sfont, $efont); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1102 | } |
| 1103 | |
| 1104 | sub do_env_tableii{ |
| 1105 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1106 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1107 | my $font = fix_font(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1108 | my $h1 = next_argument(); |
| 1109 | my $h2 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1110 | s/[\s\n]+//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1111 | $globals{'lineifont'} = $font; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1112 | my $a1 = $col_aligns[0]; |
| 1113 | my $a2 = $col_aligns[1]; |
| 1114 | s/\\lineii</\\lineii[$a1|$a2]</g; |
| 1115 | return '<table border align="center" style="border-collapse: collapse">' |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1116 | . "\n <thead>" |
| 1117 | . "\n <tr class=\"tableheader\">" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1118 | . "\n $th1<b>$h1</b>\ </th>" |
| 1119 | . "\n $th2<b>$h2</b>\ </th>" |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1120 | . "\n </tr>" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1121 | . "\n </thead>" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1122 | . "\n <tbody valign='baseline'>" |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1123 | . $_ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1124 | . "\n </tbody>" |
| 1125 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1126 | } |
| 1127 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1128 | sub do_env_longtableii{ |
| 1129 | return do_env_tableii(@_); |
| 1130 | } |
| 1131 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1132 | sub do_cmd_lineii{ |
| 1133 | local($_) = @_; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1134 | my $aligns = next_optional_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1135 | my $c1 = next_argument(); |
| 1136 | my $c2 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1137 | s/[\s\n]+//; |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1138 | my($sfont,$efont) = get_table_col1_fonts(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1139 | $c2 = ' ' if ($c2 eq ''); |
| 1140 | my($c1align,$c2align) = split('\|', $aligns); |
| 1141 | my $padding = ''; |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1142 | if ($c1align =~ /align="right"/ || $c1 eq '') { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1143 | $padding = ' '; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 1144 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1145 | return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n" |
| 1146 | . " $c2align$c2</td>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1147 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1148 | } |
| 1149 | |
| 1150 | sub do_env_tableiii{ |
| 1151 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1152 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1153 | my $font = fix_font(next_argument()); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1154 | my $h1 = next_argument(); |
| 1155 | my $h2 = next_argument(); |
| 1156 | my $h3 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1157 | s/[\s\n]+//; |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1158 | $globals{'lineifont'} = $font; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1159 | my $a1 = $col_aligns[0]; |
| 1160 | my $a2 = $col_aligns[1]; |
| 1161 | my $a3 = $col_aligns[2]; |
| 1162 | s/\\lineiii</\\lineiii[$a1|$a2|$a3]</g; |
| 1163 | return '<table border align="center" style="border-collapse: collapse">' |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1164 | . "\n <thead>" |
| 1165 | . "\n <tr class=\"tableheader\">" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1166 | . "\n $th1<b>$h1</b>\ </th>" |
| 1167 | . "\n $th2<b>$h2</b>\ </th>" |
| 1168 | . "\n $th3<b>$h3</b>\ </th>" |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1169 | . "\n </tr>" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1170 | . "\n </thead>" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1171 | . "\n <tbody valign='baseline'>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1172 | . $_ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1173 | . "\n </tbody>" |
| 1174 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1175 | } |
| 1176 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1177 | sub do_env_longtableiii{ |
| 1178 | return do_env_tableiii(@_); |
| 1179 | } |
| 1180 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1181 | sub do_cmd_lineiii{ |
| 1182 | local($_) = @_; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1183 | my $aligns = next_optional_argument(); |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1184 | my $c1 = next_argument(); |
| 1185 | my $c2 = next_argument(); |
| 1186 | my $c3 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1187 | s/[\s\n]+//; |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1188 | my($sfont,$efont) = get_table_col1_fonts(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1189 | $c3 = ' ' if ($c3 eq ''); |
| 1190 | my($c1align,$c2align,$c3align) = split('\|', $aligns); |
| 1191 | my $padding = ''; |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1192 | if ($c1align =~ /align="right"/ || $c1 eq '') { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1193 | $padding = ' '; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame] | 1194 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1195 | return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1196 | . " $c2align$c2</td>\n" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1197 | . " $c3align$c3</td>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1198 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1199 | } |
| 1200 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1201 | sub do_env_tableiv{ |
| 1202 | local($_) = @_; |
| 1203 | my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument()); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1204 | my $font = fix_font(next_argument()); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1205 | my $h1 = next_argument(); |
| 1206 | my $h2 = next_argument(); |
| 1207 | my $h3 = next_argument(); |
| 1208 | my $h4 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1209 | s/[\s\n]+//; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1210 | $globals{'lineifont'} = $font; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1211 | my $a1 = $col_aligns[0]; |
| 1212 | my $a2 = $col_aligns[1]; |
| 1213 | my $a3 = $col_aligns[2]; |
| 1214 | my $a4 = $col_aligns[3]; |
| 1215 | s/\\lineiv</\\lineiv[$a1|$a2|$a3|$a4]</g; |
| 1216 | return '<table border align="center" style="border-collapse: collapse">' |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1217 | . "\n <thead>" |
| 1218 | . "\n <tr class=\"tableheader\">" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1219 | . "\n $th1<b>$h1</b>\ </th>" |
| 1220 | . "\n $th2<b>$h2</b>\ </th>" |
| 1221 | . "\n $th3<b>$h3</b>\ </th>" |
| 1222 | . "\n $th4<b>$h4</b>\ </th>" |
Fred Drake | 351960d | 2000-10-26 20:14:58 +0000 | [diff] [blame] | 1223 | . "\n </tr>" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1224 | . "\n </thead>" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1225 | . "\n <tbody valign='baseline'>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1226 | . $_ |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1227 | . "\n </tbody>" |
| 1228 | . "\n</table>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1229 | } |
| 1230 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1231 | sub do_env_longtableiv{ |
| 1232 | return do_env_tableiv(@_); |
| 1233 | } |
| 1234 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1235 | sub do_cmd_lineiv{ |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1236 | local($_) = @_; |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1237 | my $aligns = next_optional_argument(); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1238 | my $c1 = next_argument(); |
| 1239 | my $c2 = next_argument(); |
| 1240 | my $c3 = next_argument(); |
| 1241 | my $c4 = next_argument(); |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1242 | s/[\s\n]+//; |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1243 | my($sfont,$efont) = get_table_col1_fonts(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1244 | $c4 = ' ' if ($c4 eq ''); |
| 1245 | my($c1align,$c2align,$c3align,$c4align) = split('\|', $aligns); |
| 1246 | my $padding = ''; |
Fred Drake | e463f8e | 2000-11-30 07:17:27 +0000 | [diff] [blame] | 1247 | if ($c1align =~ /align="right"/ || $c1 eq '') { |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1248 | $padding = ' '; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1249 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1250 | return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n" |
Fred Drake | f74e5b7 | 1999-04-28 14:58:49 +0000 | [diff] [blame] | 1251 | . " $c2align$c2</td>\n" |
| 1252 | . " $c3align$c3</td>\n" |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1253 | . " $c4align$c4</td>" |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1254 | . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1255 | } |
| 1256 | |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1257 | |
| 1258 | # These can be used to control the title page appearance; |
| 1259 | # they need a little bit of documentation. |
| 1260 | # |
| 1261 | # If $TITLE_PAGE_GRAPHIC is set, it should be the name of a file in the |
| 1262 | # $ICONSERVER directory, or include path information (other than "./"). The |
| 1263 | # default image type will be assumed if an extension is not provided. |
| 1264 | # |
| 1265 | # If specified, the "title page" will contain two colums: one containing the |
| 1266 | # title/author/etc., and the other containing the graphic. Use the other |
| 1267 | # four variables listed here to control specific details of the layout; all |
| 1268 | # are optional. |
| 1269 | # |
| 1270 | # $TITLE_PAGE_GRAPHIC = "my-company-logo"; |
| 1271 | # $TITLE_PAGE_GRAPHIC_COLWIDTH = "30%"; |
| 1272 | # $TITLE_PAGE_GRAPHIC_WIDTH = 150; |
| 1273 | # $TITLE_PAGE_GRAPHIC_HEIGHT = 150; |
| 1274 | # $TITLE_PAGE_GRAPHIC_ON_RIGHT = 0; |
| 1275 | |
| 1276 | sub make_my_titlepage() { |
| 1277 | my $the_title = ""; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1278 | if ($t_title) { |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1279 | $the_title .= "\n<h1>$t_title</h1>"; |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1280 | } |
| 1281 | else { |
| 1282 | write_warnings("\nThis document has no title."); |
| 1283 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1284 | if ($t_author) { |
| 1285 | if ($t_authorURL) { |
Fred Drake | 0893205 | 1998-04-17 02:15:42 +0000 | [diff] [blame] | 1286 | my $href = translate_commands($t_authorURL); |
Fred Drake | 2d1f81e | 1999-02-09 16:03:31 +0000 | [diff] [blame] | 1287 | $href = make_named_href('author', $href, |
| 1288 | "<b><font size='+2'>$t_author</font></b>"); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1289 | $the_title .= "\n<p>$href</p>"; |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1290 | } |
| 1291 | else { |
Fred Drake | 2d1f81e | 1999-02-09 16:03:31 +0000 | [diff] [blame] | 1292 | $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] | 1293 | } |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1294 | } |
| 1295 | else { |
| 1296 | write_warnings("\nThere is no author for this document."); |
| 1297 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1298 | if ($t_institute) { |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1299 | $the_title .= "\n<p>$t_institute</p>"; |
| 1300 | } |
Fred Drake | d07868a | 1998-05-14 21:00:28 +0000 | [diff] [blame] | 1301 | if ($DEVELOPER_ADDRESS) { |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1302 | $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>"; |
| 1303 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1304 | if ($t_affil) { |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1305 | $the_title .= "\n<p><i>$t_affil</i></p>"; |
| 1306 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1307 | if ($t_date) { |
Fred Drake | de77bc5 | 2000-12-14 18:36:12 +0000 | [diff] [blame] | 1308 | $the_title .= "\n<p>"; |
Fred Drake | d04592a | 2000-10-25 16:15:13 +0000 | [diff] [blame] | 1309 | if ($PACKAGE_VERSION) { |
Fred Drake | de77bc5 | 2000-12-14 18:36:12 +0000 | [diff] [blame] | 1310 | $the_title .= "<strong>Release $PACKAGE_VERSION</strong><br>\n"; |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1311 | } |
Fred Drake | de77bc5 | 2000-12-14 18:36:12 +0000 | [diff] [blame] | 1312 | $the_title .= "<strong>$t_date</strong></p>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1313 | } |
| 1314 | if ($t_address) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1315 | $the_title .= "\n<p>$t_address</p>"; |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1316 | } |
| 1317 | else { |
| 1318 | $the_title .= "\n<p>"; |
| 1319 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1320 | if ($t_email) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 1321 | $the_title .= "\n<p>$t_email</p>"; |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1322 | } |
| 1323 | return $the_title; |
| 1324 | } |
| 1325 | |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1326 | sub make_my_titlegraphic() { |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 1327 | my $filename = make_icon_filename($TITLE_PAGE_GRAPHIC); |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1328 | my $graphic = "<td class=\"titlegraphic\""; |
| 1329 | $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_COLWIDTH\"" |
| 1330 | if ($TITLE_PAGE_GRAPHIC_COLWIDTH); |
| 1331 | $graphic .= "><img"; |
| 1332 | $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_WIDTH\"" |
| 1333 | if ($TITLE_PAGE_GRAPHIC_WIDTH); |
| 1334 | $graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\"" |
| 1335 | if ($TITLE_PAGE_GRAPHIC_HEIGHT); |
Fred Drake | 5f84c9b | 2000-10-03 06:05:25 +0000 | [diff] [blame] | 1336 | $graphic .= "\n src=\"$filename\"></td>\n"; |
Fred Drake | 3be2074 | 2000-08-31 06:22:54 +0000 | [diff] [blame] | 1337 | return $graphic; |
| 1338 | } |
| 1339 | |
| 1340 | sub do_cmd_maketitle { |
| 1341 | local($_) = @_; |
| 1342 | my $the_title = "\n<div class=\"titlepage\">"; |
| 1343 | if ($TITLE_PAGE_GRAPHIC) { |
| 1344 | if ($TITLE_PAGE_GRAPHIC_ON_RIGHT) { |
| 1345 | $the_title .= ("\n<table border=\"0\" width=\"100%\">" |
| 1346 | . "<tr align=\"right\">\n<td>" |
| 1347 | . make_my_titlepage() |
| 1348 | . "</td>\n" |
| 1349 | . make_my_titlegraphic() |
| 1350 | . "</tr>\n</table>"); |
| 1351 | } |
| 1352 | else { |
| 1353 | $the_title .= ("\n<table border=\"0\" width=\"100%\"><tr>\n" |
| 1354 | . make_my_titlegraphic() |
| 1355 | . "<td>" |
| 1356 | . make_my_titlepage() |
| 1357 | . "</td></tr>\n</table>"); |
| 1358 | } |
| 1359 | } |
| 1360 | else { |
| 1361 | $the_title .= ("\n<center>" |
| 1362 | . make_my_titlepage() |
| 1363 | . "\n</center>"); |
| 1364 | } |
| 1365 | $the_title .= "\n</div>"; |
| 1366 | return $the_title . $_; |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1367 | $the_title .= "\n</center></div>"; |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1368 | return $the_title . $_ ; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1369 | } |
| 1370 | |
| 1371 | |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1372 | # |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1373 | # Module synopsis support |
| 1374 | # |
| 1375 | |
| 1376 | require SynopsisTable; |
| 1377 | |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1378 | sub get_chapter_id(){ |
| 1379 | my $id = do_cmd_thechapter(''); |
Fred Drake | 45f2601 | 1998-08-04 22:07:18 +0000 | [diff] [blame] | 1380 | $id =~ s/<SPAN CLASS="arabic">(\d+)<\/SPAN>/\1/; |
| 1381 | $id =~ s/\.//; |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1382 | return $id; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1383 | } |
| 1384 | |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1385 | # 'chapter' => 'SynopsisTable instance' |
| 1386 | %ModuleSynopses = (); |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1387 | |
| 1388 | sub get_synopsis_table($){ |
| 1389 | my($chap) = @_; |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1390 | my $key; |
| 1391 | foreach $key (keys %ModuleSynopses) { |
| 1392 | if ($key eq $chap) { |
| 1393 | return $ModuleSynopses{$chap}; |
| 1394 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1395 | } |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1396 | my $st = SynopsisTable->new(); |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1397 | $ModuleSynopses{$chap} = $st; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1398 | return $st; |
| 1399 | } |
| 1400 | |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1401 | sub do_cmd_moduleauthor{ |
| 1402 | local($_) = @_; |
| 1403 | next_argument(); |
| 1404 | next_argument(); |
| 1405 | return $_; |
| 1406 | } |
| 1407 | |
| 1408 | sub do_cmd_sectionauthor{ |
| 1409 | local($_) = @_; |
| 1410 | next_argument(); |
| 1411 | next_argument(); |
| 1412 | return $_; |
| 1413 | } |
| 1414 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1415 | sub do_cmd_declaremodule{ |
| 1416 | local($_) = @_; |
| 1417 | my $key = next_optional_argument(); |
| 1418 | my $type = next_argument(); |
| 1419 | my $name = next_argument(); |
| 1420 | my $st = get_synopsis_table(get_chapter_id()); |
| 1421 | # |
| 1422 | $key = $name unless $key; |
| 1423 | $type = 'built-in' if $type eq 'builtin'; |
| 1424 | $st->declare($name, $key, $type); |
| 1425 | define_module($type, $name); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1426 | return anchor_label("module-$key",$CURRENT_FILE,$_) |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1427 | } |
| 1428 | |
| 1429 | sub do_cmd_modulesynopsis{ |
| 1430 | local($_) = @_; |
| 1431 | my $st = get_synopsis_table(get_chapter_id()); |
Fred Drake | 1cc5899 | 1999-04-13 22:08:59 +0000 | [diff] [blame] | 1432 | $st->set_synopsis($THIS_MODULE, translate_commands(next_argument())); |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1433 | return $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1434 | } |
| 1435 | |
| 1436 | sub do_cmd_localmoduletable{ |
| 1437 | local($_) = @_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1438 | my $chap = get_chapter_id(); |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1439 | my $st = get_synopsis_table($chap); |
| 1440 | $st->set_file("$CURRENT_FILE"); |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1441 | return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1442 | } |
| 1443 | |
| 1444 | sub process_all_localmoduletables{ |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1445 | my $key; |
| 1446 | my $st, $file; |
| 1447 | foreach $key (keys %ModuleSynopses) { |
| 1448 | $st = $ModuleSynopses{$key}; |
| 1449 | $file = $st->get_file(); |
| 1450 | if ($file) { |
| 1451 | process_localmoduletables_in_file($file); |
| 1452 | } |
| 1453 | else { |
| 1454 | print "\nsynopsis table $key has no file association"; |
| 1455 | } |
| 1456 | } |
| 1457 | } |
| 1458 | |
| 1459 | sub process_localmoduletables_in_file{ |
| 1460 | my $file = @_[0]; |
| 1461 | open(MYFILE, "<$file"); |
| 1462 | local($_); |
| 1463 | sysread(MYFILE, $_, 1024*1024); |
| 1464 | close(MYFILE); |
| 1465 | # need to get contents of file in $_ |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1466 | while (/<tex2html-localmoduletable><(\d+)>/) { |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1467 | my $match = $&; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1468 | my $chap = $1; |
| 1469 | my $st = get_synopsis_table($chap); |
| 1470 | my $data = $st->tohtml(); |
Fred Drake | f7685d7 | 1998-07-25 03:31:46 +0000 | [diff] [blame] | 1471 | s/$match/$data/; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1472 | } |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1473 | open(MYFILE,">$file"); |
| 1474 | print MYFILE $_; |
| 1475 | close(MYFILE); |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1476 | } |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1477 | sub process_python_state{ |
| 1478 | process_all_localmoduletables(); |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1479 | } |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1480 | |
| 1481 | |
| 1482 | # |
| 1483 | # "See also:" -- references placed at the end of a \section |
| 1484 | # |
| 1485 | |
| 1486 | sub do_env_seealso{ |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1487 | return "<div class='seealso'>\n " |
| 1488 | . "<p class='heading'><b>See Also:</b></p>\n" |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1489 | . @_[0] |
| 1490 | . '</div>'; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1491 | } |
| 1492 | |
| 1493 | sub do_cmd_seemodule{ |
| 1494 | # Insert the right magic to jump to the module definition. This should |
| 1495 | # work most of the time, at least for repeat builds.... |
| 1496 | local($_) = @_; |
| 1497 | my $key = next_optional_argument(); |
| 1498 | my $module = next_argument(); |
| 1499 | my $text = next_argument(); |
Fred Drake | 84bd6f3 | 1999-05-11 15:42:51 +0000 | [diff] [blame] | 1500 | my $period = '.'; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1501 | $key = $module |
| 1502 | unless $key; |
Fred Drake | 84bd6f3 | 1999-05-11 15:42:51 +0000 | [diff] [blame] | 1503 | if ($text =~ /\.$/) { |
| 1504 | $period = ''; |
| 1505 | } |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1506 | return '<dl compact class="seemodule">' |
| 1507 | . "\n <dt>Module <b><tt class='module'><a href='module-$key.html'>" |
Fred Drake | 84bd6f3 | 1999-05-11 15:42:51 +0000 | [diff] [blame] | 1508 | . "$module</a></tt>:</b>" |
| 1509 | . "\n <dd>$text$period\n </dl>" |
Fred Drake | 90fdda5 | 1999-02-16 20:27:42 +0000 | [diff] [blame] | 1510 | . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1511 | } |
| 1512 | |
Fred Drake | e0197bf | 2001-04-12 04:03:22 +0000 | [diff] [blame] | 1513 | sub strip_html_markup($){ |
| 1514 | my $str = @_[0]; |
| 1515 | my $s = "$str"; |
| 1516 | $s =~ s/<[a-zA-Z0-9]+(\s+[a-zA-Z0-9]+(\s*=\s*(\'[^\']*\'|\"[^\"]*\"|[a-zA-Z0-9]+))?)*\s*>//g; |
| 1517 | $s =~ s/<\/[a-zA-Z0-9]+>//g; |
| 1518 | return $s; |
| 1519 | } |
| 1520 | |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1521 | sub handle_rfclike_reference{ |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 1522 | local($_, $what, $format) = @_; |
Fred Drake | 37cc0c0 | 2000-04-26 18:05:24 +0000 | [diff] [blame] | 1523 | my $rfcnum = next_argument(); |
| 1524 | my $title = next_argument(); |
| 1525 | my $text = next_argument(); |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 1526 | my $url = get_rfc_url($rfcnum, $format); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 1527 | my $icon = get_link_icon($url); |
Fred Drake | e0197bf | 2001-04-12 04:03:22 +0000 | [diff] [blame] | 1528 | my $attrtitle = strip_html_markup($title); |
Fred Drake | 37cc0c0 | 2000-04-26 18:05:24 +0000 | [diff] [blame] | 1529 | return '<dl compact class="seerfc">' |
| 1530 | . "\n <dt><a href=\"$url\"" |
Fred Drake | e0197bf | 2001-04-12 04:03:22 +0000 | [diff] [blame] | 1531 | . "\n title=\"$attrtitle\"" |
Fred Drake | 5f84c9b | 2000-10-03 06:05:25 +0000 | [diff] [blame] | 1532 | . "\n >$what $rfcnum, <em>$title</em>$icon</a>" |
Fred Drake | 37cc0c0 | 2000-04-26 18:05:24 +0000 | [diff] [blame] | 1533 | . "\n <dd>$text\n </dl>" |
| 1534 | . $_; |
| 1535 | } |
| 1536 | |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1537 | sub do_cmd_seepep{ |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 1538 | return handle_rfclike_reference(@_[0], "PEP", $PEP_FORMAT); |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1539 | } |
| 1540 | |
| 1541 | sub do_cmd_seerfc{ |
Fred Drake | afc7ce1 | 2001-01-22 17:33:24 +0000 | [diff] [blame] | 1542 | return handle_rfclike_reference(@_[0], "RFC", $RFC_FORMAT); |
Fred Drake | 643d76d | 2000-09-09 06:07:37 +0000 | [diff] [blame] | 1543 | } |
| 1544 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1545 | sub do_cmd_seetitle{ |
| 1546 | local($_) = @_; |
| 1547 | my $url = next_optional_argument(); |
| 1548 | my $title = next_argument(); |
| 1549 | my $text = next_argument(); |
| 1550 | if ($url) { |
Fred Drake | 5f84c9b | 2000-10-03 06:05:25 +0000 | [diff] [blame] | 1551 | my $icon = get_link_icon($url); |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1552 | return '<dl compact class="seetitle">' |
| 1553 | . "\n <dt><em class=\"citetitle\"><a href=\"$url\"" |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 1554 | . "\n >$title$icon</a></em>" |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1555 | . "\n <dd>$text\n </dl>" |
| 1556 | . $_; |
| 1557 | } |
| 1558 | return '<dl compact class="seetitle">' |
| 1559 | . "\n <dt><em class=\"citetitle\"" |
| 1560 | . "\n >$title</em>" |
| 1561 | . "\n <dd>$text\n </dl>" |
| 1562 | . $_; |
| 1563 | } |
| 1564 | |
Fred Drake | ef4d111 | 2000-05-09 16:17:51 +0000 | [diff] [blame] | 1565 | sub do_cmd_seeurl{ |
| 1566 | local($_) = @_; |
| 1567 | my $url = next_argument(); |
| 1568 | my $text = next_argument(); |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 1569 | my $icon = get_link_icon($url); |
Fred Drake | ef4d111 | 2000-05-09 16:17:51 +0000 | [diff] [blame] | 1570 | return '<dl compact class="seeurl">' |
| 1571 | . "\n <dt><a href=\"$url\"" |
Fred Drake | 7a40c07 | 2000-10-02 14:43:38 +0000 | [diff] [blame] | 1572 | . "\n class=\"url\">$url$icon</a>" |
Fred Drake | ef4d111 | 2000-05-09 16:17:51 +0000 | [diff] [blame] | 1573 | . "\n <dd>$text\n </dl>" |
| 1574 | . $_; |
| 1575 | } |
| 1576 | |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1577 | sub do_cmd_seetext{ |
Fred Drake | 79189b5 | 1999-04-28 13:54:30 +0000 | [diff] [blame] | 1578 | local($_) = @_; |
| 1579 | my $content = next_argument(); |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1580 | return '<div class="seetext"><p>' . $content . '</div>' . $_; |
Fred Drake | a0f4c94 | 1998-07-24 22:16:04 +0000 | [diff] [blame] | 1581 | } |
| 1582 | |
| 1583 | |
| 1584 | # |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1585 | # Definition list support. |
| 1586 | # |
| 1587 | |
| 1588 | sub do_env_definitions{ |
Fred Drake | 37cc0c0 | 2000-04-26 18:05:24 +0000 | [diff] [blame] | 1589 | return "<dl class='definitions'>" . @_[0] . "</dl>\n"; |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1590 | } |
| 1591 | |
| 1592 | sub do_cmd_term{ |
| 1593 | local($_) = @_; |
Fred Drake | ccc6272 | 1999-01-05 22:16:29 +0000 | [diff] [blame] | 1594 | my $term = next_argument(); |
| 1595 | my($name,$aname,$ahref) = new_link_info(); |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1596 | # could easily add an index entry here... |
Fred Drake | 62e4369 | 1998-08-10 19:40:44 +0000 | [diff] [blame] | 1597 | return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_; |
Fred Drake | 885215c | 1998-05-20 21:32:09 +0000 | [diff] [blame] | 1598 | } |
| 1599 | |
| 1600 | |
Fred Drake | 38178fd | 2000-09-22 17:05:04 +0000 | [diff] [blame] | 1601 | # I don't recall exactly why this was needed, but it was very much needed. |
| 1602 | # We'll see if anything breaks when I move the "code" line out -- some |
| 1603 | # things broke with it in. |
| 1604 | |
| 1605 | #code # {} |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 1606 | process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_); |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 1607 | declaremodule # [] # {} # {} |
| 1608 | memberline # [] # {} |
| 1609 | methodline # [] # {} # {} |
| 1610 | modulesynopsis # {} |
Fred Drake | 557460c | 1999-03-02 16:05:35 +0000 | [diff] [blame] | 1611 | platform # {} |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 1612 | samp # {} |
Fred Drake | 2e1ee3e | 1999-02-10 21:17:04 +0000 | [diff] [blame] | 1613 | setindexsubitem # {} |
Fred Drake | f32834c | 1999-02-12 22:06:32 +0000 | [diff] [blame] | 1614 | withsubitem # {} # {} |
Fred Drake | 2ff880e | 1999-02-05 18:31:29 +0000 | [diff] [blame] | 1615 | _RAW_ARG_DEFERRED_CMDS_ |
| 1616 | |
| 1617 | |
Fred Drake | 8633360 | 2001-04-10 17:13:39 +0000 | [diff] [blame] | 1618 | $alltt_start = '<dl><dd><pre class="verbatim">'; |
| 1619 | $alltt_end = '</pre></dl>'; |
| 1620 | |
| 1621 | sub do_env_alltt { |
| 1622 | local ($_) = @_; |
| 1623 | local($closures,$reopens,@open_block_tags); |
| 1624 | |
| 1625 | # get the tag-strings for all open tags |
| 1626 | local(@keep_open_tags) = @$open_tags_R; |
| 1627 | ($closures,$reopens) = &preserve_open_tags() if (@$open_tags_R); |
| 1628 | |
| 1629 | # get the tags for text-level tags only |
| 1630 | $open_tags_R = [ @keep_open_tags ]; |
| 1631 | local($local_closures, $local_reopens); |
| 1632 | ($local_closures, $local_reopens,@open_block_tags) |
| 1633 | = &preserve_open_block_tags |
| 1634 | if (@$open_tags_R); |
| 1635 | |
| 1636 | $open_tags_R = [ @open_block_tags ]; |
| 1637 | |
| 1638 | do { |
| 1639 | local($open_tags_R) = [ @open_block_tags ]; |
| 1640 | local(@save_open_tags) = (); |
| 1641 | |
| 1642 | local($cnt) = ++$global{'max_id'}; |
| 1643 | $_ = join('',"$O$cnt$C\\tt$O", ++$global{'max_id'}, $C |
| 1644 | , $_ , $O, $global{'max_id'}, "$C$O$cnt$C"); |
| 1645 | |
| 1646 | $_ = &translate_environments($_); |
| 1647 | $_ = &translate_commands($_) if (/\\/); |
| 1648 | |
| 1649 | # preserve space-runs, using |
| 1650 | while (s/(\S) ( +)/$1$2;SPMnbsp;/g){}; |
| 1651 | s/(<BR>) /$1;SPMnbsp;/g; |
| 1652 | |
| 1653 | $_ = join('', $closures, $alltt_start, $local_reopens |
| 1654 | , $_ |
| 1655 | , &balance_tags() #, $local_closures |
| 1656 | , $alltt_end, $reopens); |
| 1657 | undef $open_tags_R; undef @save_open_tags; |
| 1658 | }; |
| 1659 | $open_tags_R = [ @keep_open_tags ]; |
| 1660 | $_; |
| 1661 | } |
| 1662 | |
| 1663 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1664 | 1; # This must be the last line |