Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 1 | # python.perl by Fred L. Drake, Jr. <fdrake@acm.org> -*- perl -*- |
| 2 | # |
| 3 | # Heavily based on Guido van Rossum's myformat.perl (now obsolete). |
| 4 | # |
| 5 | # Extension to LaTeX2HTML for documents using myformat.sty. |
| 6 | # Subroutines of the form do_cmd_<name> here define translations |
| 7 | # for LaTeX commands \<name> defined in the corresponding .sty file. |
| 8 | |
| 9 | package main; |
| 10 | |
| 11 | |
| 12 | # words typeset in a special way (not in HTML though) |
| 13 | |
| 14 | sub do_cmd_ABC{ 'ABC' . @_[0]; } |
| 15 | sub do_cmd_UNIX{ 'Unix'. @_[0]; } |
| 16 | sub do_cmd_ASCII{ 'ASCII' . @_[0]; } |
| 17 | sub do_cmd_POSIX{ 'POSIX' . @_[0]; } |
| 18 | sub do_cmd_C{ 'C' . @_[0]; } |
| 19 | sub do_cmd_Cpp{ 'C++' . @_[0]; } |
| 20 | sub do_cmd_EOF{ 'EOF' . @_[0]; } |
| 21 | sub do_cmd_NULL{ '<tt>NULL</tt>' . @_[0]; } |
| 22 | |
| 23 | sub do_cmd_e{ '\' . @_[0]; } |
| 24 | |
| 25 | $AUTHOR_ADDRESS = ''; |
| 26 | $PYTHON_VERSION = ''; |
| 27 | |
| 28 | sub do_cmd_version{ $PYTHON_VERSION . @_[0]; } |
| 29 | sub do_cmd_release{ |
| 30 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 31 | s/$next_pair_pr_rx//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 32 | $PYTHON_VERSION = "$2"; |
| 33 | $_; |
| 34 | } |
| 35 | |
| 36 | sub do_cmd_authoraddress{ |
| 37 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 38 | s/$next_pair_pr_rx//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 39 | $AUTHOR_ADDRESS = "$2"; |
| 40 | $_; |
| 41 | } |
| 42 | |
| 43 | sub do_cmd_hackscore{ |
| 44 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 45 | s/$next_pair_pr_rx/_/; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 46 | $_; |
| 47 | } |
| 48 | |
| 49 | sub do_cmd_optional{ |
| 50 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 51 | s|$next_pair_pr_rx|</var><big>\[</big><var>\2</var><big>\]</big><var>|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 52 | $_; |
| 53 | } |
| 54 | |
| 55 | sub do_cmd_varvars{ |
| 56 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 57 | s|$next_pair_pr_rx|<var>\2</var>|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 58 | $_; |
| 59 | } |
| 60 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 61 | # Logical formatting (some based on texinfo), needs to be converted to |
| 62 | # minimalist HTML. The "minimalist" is primarily to reduce the size of |
| 63 | # output files for users that read them over the network rather than |
| 64 | # from local repositories. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 65 | |
| 66 | sub do_cmd_code{ |
| 67 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 68 | s|$next_pair_pr_rx|<tt>\2</tt>|; |
| 69 | $_; |
| 70 | } |
| 71 | |
| 72 | sub use_sans_serif{ |
| 73 | local($_) = @_; |
| 74 | s|$next_pair_pr_rx|<font face=sans-serif>\2</font>|; |
| 75 | $_; |
| 76 | } |
| 77 | |
| 78 | sub use_italics{ |
| 79 | local($_) = @_; |
| 80 | s|$next_pair_pr_rx|<i>\2</i>|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 81 | $_; |
| 82 | } |
| 83 | |
| 84 | sub do_cmd_sectcode{ &do_cmd_code(@_); } |
| 85 | sub do_cmd_module{ &do_cmd_code(@_); } |
| 86 | sub do_cmd_keyword{ &do_cmd_code(@_); } |
| 87 | sub do_cmd_exception{ &do_cmd_code(@_); } |
| 88 | sub do_cmd_class{ &do_cmd_code(@_); } |
| 89 | sub do_cmd_function{ &do_cmd_code(@_); } |
| 90 | sub do_cmd_constant{ &do_cmd_code(@_); } |
| 91 | sub do_cmd_member{ &do_cmd_code(@_); } |
| 92 | sub do_cmd_method{ &do_cmd_code(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 93 | sub do_cmd_cfunction{ &do_cmd_code(@_); } |
| 94 | sub do_cmd_cdata{ &do_cmd_code(@_); } |
| 95 | sub do_cmd_ctype{ &do_cmd_code(@_); } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 96 | sub do_cmd_regexp{ &do_cmd_code(@_); } |
| 97 | sub do_cmd_key{ &do_cmd_code(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 98 | |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 99 | sub do_cmd_character{ &do_cmd_samp(@_); } |
| 100 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 101 | sub do_cmd_program{ &do_cmd_strong(@_); } |
| 102 | |
| 103 | sub do_cmd_email{ &use_sans_serif(@_); } |
| 104 | sub do_cmd_mimetype{ &use_sans_serif(@_); } |
| 105 | |
| 106 | sub do_cmd_var{ &use_italics(@_); } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 107 | sub do_cmd_dfn{ &use_italics(@_); } # make an index entry? |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 108 | sub do_cmd_emph{ &use_italics(@_); } |
| 109 | |
Fred Drake | 1a7af39 | 1998-04-01 22:44:56 +0000 | [diff] [blame] | 110 | sub do_cmd_newsgroup{ |
| 111 | local($_) = @_; |
| 112 | s/$next_pair_pr_rx//o; |
| 113 | my $newsgroup = $2; |
| 114 | my $stuff = "<a href=\"news:$newsgroup\"><font face=sans-serif>" |
| 115 | . "$newsgroup</font></a>"; |
| 116 | $stuff . $_; |
| 117 | } |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 118 | |
| 119 | sub do_cmd_envvar{ |
| 120 | local($_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 121 | s/$next_pair_pr_rx//; |
| 122 | my($br_id,$envvar) = ($1, $2); |
| 123 | my($name,$aname,$ahref) = link_info($br_id); |
| 124 | add_index_entry("environment variables!$envvar@\$$envvar", $ahref); |
| 125 | add_index_entry("$envvar@\$$envvar", $ahref); |
| 126 | "$aname\$$envvar</a>" . $_; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 127 | } |
| 128 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 129 | sub do_cmd_url{ |
| 130 | # use the URL as both text and hyperlink |
| 131 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 132 | s/$next_pair_pr_rx//; |
| 133 | my $url = $2; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 134 | $url =~ s/~/~/g; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 135 | "<a href=\"$url\"><font face=sans-serif>$url</font></a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | sub do_cmd_manpage{ |
| 139 | # two parameters: \manpage{name}{section} |
| 140 | local($_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 141 | my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3"; |
| 142 | s|$rx|<i>\2</i>(\4)|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 143 | $_; |
| 144 | } |
| 145 | |
| 146 | sub do_cmd_rfc{ |
| 147 | local($_) = @_; |
| 148 | s/$next_pair_pr_rx//; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 149 | my($br_id,$rfcnumber) = ($1, $2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 150 | |
| 151 | # Save the reference |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 152 | my $nstr = &gen_index_id("RFC!RFC $rfcnumber", ''); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 153 | $index{$nstr} .= &make_half_href("$CURRENT_FILE#$br_id"); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 154 | "<a name=$br_id>RFC $rfcnumber</a>" .$_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | sub do_cmd_kbd{ |
| 158 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 159 | s|$next_pair_pr_rx|<kbd>\2</kbd>|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 160 | $_; |
| 161 | } |
| 162 | |
| 163 | sub do_cmd_strong{ |
| 164 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 165 | s|$next_pair_pr_rx|<b>\2</b>|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 166 | $_; |
| 167 | } |
| 168 | |
| 169 | sub do_cmd_deprecated{ |
| 170 | # two parameters: \deprecated{version}{whattodo} |
| 171 | local($_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 172 | my $rx = "$next_pair_pr_rx$any_next_pair_pr_rx3"; |
| 173 | s|$rx|<b>Deprecated since release \2.</b>\n\4<p>|; |
| 174 | $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | # file and samp are at the end of this file since they screw up fontlock. |
| 178 | |
| 179 | # index commands |
| 180 | |
| 181 | $INDEX_SUBITEM = ""; |
| 182 | |
| 183 | sub get_indexsubitem{ |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 184 | #$INDEX_SUBITEM ? " $INDEX_SUBITEM" : ''; |
| 185 | ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | sub do_cmd_setindexsubitem{ |
| 189 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 190 | s/$next_pair_pr_rx//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 191 | $INDEX_SUBITEM = $2; |
| 192 | $_; |
| 193 | } |
| 194 | |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 195 | sub do_cmd_withsubitem{ |
| 196 | # We can't really do the right right thing, because LaTeX2HTML doesn't |
| 197 | # do things in the right order, but we need to at least strip this stuff |
| 198 | # out, and leave anything that the second argument expanded out to. |
| 199 | # |
| 200 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 201 | my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP"; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 202 | s/$next_pair_pr_rx$any_next_pair_pr_rx3/\4/; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 203 | $INDEX_SUBITEM = $2; |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 204 | $_; |
| 205 | } |
| 206 | |
| 207 | sub do_cmd_makemodindex{ @_[0]; } |
| 208 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 209 | # We're in the document subdirectory when this happens! |
| 210 | open(IDXFILE, ">index.dat") || die "\n$!\n"; |
| 211 | open(INTLABELS, ">intlabels.pl") || die "\n$!\n"; |
| 212 | print INTLABELS |
| 213 | "%internal_labels = ();\n1; # hack in case there are no entries\n\n"; |
| 214 | |
| 215 | sub gen_target_name{ |
| 216 | "l2h-" . @_[0]; |
| 217 | } |
| 218 | |
| 219 | sub gen_target{ |
| 220 | "<a name=\"" . @_[0] . "\">"; |
| 221 | } |
| 222 | |
| 223 | sub gen_link{ |
| 224 | my($node,$target) = @_; |
| 225 | print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; |
| 226 | "<a href=\"$node#$target\">"; |
| 227 | } |
| 228 | |
| 229 | sub make_index_entry{ |
| 230 | my($br_id,$str) = @_; |
| 231 | my($name,$aname,$ahref) = link_info($br_id); |
| 232 | add_index_entry($str, $ahref); |
| 233 | "$aname$anchor_invisible_mark</a>"; |
| 234 | } |
| 235 | |
| 236 | sub add_index_entry{ |
| 237 | # add an entry to the index structures; ignore the return value |
| 238 | my($str,$ahref) = @_; |
| 239 | $str = gen_index_id($str, ''); |
| 240 | $index{$str} .= $ahref; |
| 241 | print IDXFILE $ahref, "\0", $str, "\n"; |
| 242 | } |
| 243 | |
| 244 | sub link_info{ |
| 245 | my $name = gen_target_name(@_[0]); |
| 246 | my $aname = gen_target($name); |
| 247 | my $ahref = gen_link($CURRENT_FILE, $name); |
| 248 | return ($name, $aname, $ahref); |
| 249 | } |
| 250 | |
| 251 | sub do_cmd_index{ |
| 252 | local($_) = @_; |
| 253 | s/$next_pair_pr_rx[\n]?//o; |
| 254 | my($br_id,$str) = ($1, $2); |
| 255 | # |
| 256 | my($name,$aname,$ahref) = link_info($br_id); |
| 257 | add_index_entry("$str", $ahref); |
| 258 | "$aname$anchor_invisible_mark</a>" . $_; |
| 259 | } |
| 260 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 261 | sub do_cmd_indexii{ |
| 262 | local($_) = @_; |
| 263 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 264 | my($br_id1,$str1) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 265 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 266 | my($br_id2,$str2) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 267 | # |
| 268 | my($name,$aname,$ahref) = link_info($br_id1); |
| 269 | add_index_entry("$str1!$str2", $ahref); |
| 270 | add_index_entry("$str2!$str1", $ahref); |
| 271 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | sub do_cmd_indexiii{ |
| 275 | local($_) = @_; |
| 276 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 277 | my($br_id1,$str1) = ($1, $2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 278 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 279 | my($br_id2,$str2) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 280 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 281 | my($br_id3,$str3) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 282 | # |
| 283 | my($name,$aname,$ahref) = link_info($br_id1); |
| 284 | add_index_entry("$str1!$str2 $str3", $ahref); |
| 285 | add_index_entry("$str2!$str3, $str1", $ahref); |
| 286 | add_index_entry("$str3!$str1 $str2", $ahref); |
| 287 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | sub do_cmd_indexiv{ |
| 291 | local($_) = @_; |
| 292 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 293 | my($br_id1,$str1) = ($1, $2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 294 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 295 | my($br_id2,$str2) = ($1, $2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 296 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 297 | my($br_id3,$str3) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 298 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 299 | my($br_id4,$str4) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 300 | # |
| 301 | my($name,$aname,$ahref) = link_info($br_id1); |
| 302 | add_index_entry("$str1!$str2 $str3 $str4", $ahref); |
| 303 | add_index_entry("$str2!$str3 $str4, $str1", $ahref); |
| 304 | add_index_entry("$str3!$str4, $str1 $str2", $ahref); |
| 305 | add_index_entry("$str4!$$str1 $str2 $str3", $ahref); |
| 306 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 307 | } |
| 308 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 309 | sub do_cmd_ttindex{ |
| 310 | local($_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 311 | s/$next_pair_pr_rx[\n]?//; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 312 | my($br_id,$str) = ($1, $2); |
| 313 | &make_index_entry($br_id, $str . &get_indexsubitem) . $_; |
| 314 | } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 315 | |
| 316 | sub my_typed_index_helper{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 317 | local($word,$_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 318 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 319 | my($br_id,$str) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 320 | # |
| 321 | my($name,$aname,$ahref) = link_info($br_id1); |
| 322 | add_index_entry("$str $word", $ahref); |
| 323 | add_index_entry("$word!$str", $ahref); |
| 324 | "$aname$anchor_invisible_mark</a>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | sub do_cmd_stindex{ &my_typed_index_helper('statement', @_); } |
| 328 | sub do_cmd_opindex{ &my_typed_index_helper('operator', @_); } |
| 329 | sub do_cmd_exindex{ &my_typed_index_helper('exception', @_); } |
| 330 | sub do_cmd_obindex{ &my_typed_index_helper('object', @_); } |
| 331 | |
| 332 | sub my_parword_index_helper{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 333 | local($word,$_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 334 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 335 | my($br_id,$str) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 336 | make_index_entry($br_id, "$str ($word)") . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | |
| 340 | # Set this to true to strip out the <tt>...</tt> from index entries; |
| 341 | # this is analogous to using the second definition of \idxcode{} from |
| 342 | # myformat.sty. |
| 343 | # |
| 344 | # It is used from &make_mod_index_entry() and &make_str_index_entry(). |
| 345 | # |
| 346 | $STRIP_INDEX_TT = 0; |
| 347 | |
| 348 | sub make_mod_index_entry{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 349 | my($br_id,$str,$define) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 350 | my($name,$aname,$ahref) = link_info($br_id); |
| 351 | $str =~ s|<tt>(.*)</tt>|\1| |
| 352 | if $STRIP_INDEX_TT; |
| 353 | # equivalent of add_index_entry() using $define instead of '' |
| 354 | $str = gen_index_id($str, $define); |
| 355 | $index{$str} .= $ahref; |
| 356 | print IDXFILE $ahref, "\0", $str, "\n"; |
| 357 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 358 | if ($define eq 'DEF') { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 359 | # add to the module index |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 360 | my($nstr,$garbage) = split / /, $str, 2; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 361 | $Modules{$nstr} .= $ahref; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 362 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 363 | "$aname$anchor_invisible_mark</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 364 | } |
| 365 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 366 | $THIS_MODULE = ''; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 367 | $THIS_CLASS = ''; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 368 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 369 | sub my_module_index_helper{ |
| 370 | local($word, $_) = @_; |
| 371 | s/$next_pair_pr_rx[\n]*//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 372 | my($br_id, $str) = ($1, $2); |
| 373 | my $section_tag = join('', @curr_sec_id); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 374 | $word = "$word " if $word; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 375 | $THIS_MODULE = "$str"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 376 | make_mod_index_entry("SECTION$section_tag", |
| 377 | "<tt>$str</tt> (${word}module)", 'DEF') . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | sub ref_module_index_helper{ |
| 381 | local($word, $_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 382 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 383 | my($br_id, $str) = ($1, $2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 384 | $word = "$word " if $word; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 385 | make_mod_index_entry($br_id, "<tt>$str</tt> (${word}module)", 'REF') . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 386 | } |
| 387 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 388 | sub do_cmd_bifuncindex{ |
| 389 | local($_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 390 | s/$next_pair_pr_rx[\n]?//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 391 | my($br_id,$str,$fname) = ($1, $2, "<tt>$2()</tt>"); |
| 392 | $fname = "$str()" |
| 393 | if $STRIP_INDEX_TT; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 394 | make_index_entry($br_id, "$fname (built-in function)") . $_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 395 | } |
| 396 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 397 | sub do_cmd_modindex{ my_module_index_helper('', @_); } |
| 398 | sub do_cmd_bimodindex{ my_module_index_helper('built-in', @_); } |
| 399 | sub do_cmd_exmodindex{ my_module_index_helper('extension', @_); } |
| 400 | sub do_cmd_stmodindex{ my_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 401 | |
| 402 | # these should be adjusted a bit.... |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 403 | sub do_cmd_refmodindex{ ref_module_index_helper('', @_); } |
| 404 | sub do_cmd_refbimodindex{ ref_module_index_helper('built-in', @_); } |
| 405 | sub do_cmd_refexmodindex{ ref_module_index_helper('extension', @_); } |
| 406 | sub do_cmd_refstmodindex{ ref_module_index_helper('standard', @_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 407 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 408 | sub do_cmd_nodename{ do_cmd_label(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 409 | |
| 410 | sub init_myformat{ |
| 411 | # XXX need some way for this to be called after &initialise; ??? |
| 412 | $anchor_mark = ''; |
| 413 | $icons{'anchor_mark'} = ''; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 414 | my $cmark = "(?:$comment_mark)?"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 415 | # <<2>>...<<2>> |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 416 | $next_pair_rx = "^[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\1$C"; |
| 417 | $any_next_pair_rx3 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\3$C"; |
| 418 | $any_next_pair_rx5 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\5$C"; |
| 419 | $any_next_pair_rx7 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\7$C"; |
| 420 | $any_next_pair_rx9 = "[\\s\n%]*$O(\\d+)$C([\\s\\S]*)$O\\9$C"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 421 | # <#2#>...<#2#> |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 422 | $next_pair_pr_rx = "^[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\1$CP$cmark"; |
| 423 | $any_next_pair_pr_rx3 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP$cmark"; |
| 424 | $any_next_pair_pr_rx5 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP$cmark"; |
| 425 | $any_next_pair_pr_rx7 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\7$CP$cmark"; |
| 426 | $any_next_pair_pr_rx9 = "[\\s\n%]*$OP(\\d+)$CP([\\s\\S]*)$OP\\9$CP$cmark"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 427 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 428 | init_myformat(); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 429 | |
| 430 | # similar to make_index_entry(), but includes the string in the result |
| 431 | # instead of the dummy filler. |
| 432 | # |
| 433 | sub make_str_index_entry{ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 434 | my($br_id,$str) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 435 | my($name,$aname,$ahref) = link_info($br_id); |
| 436 | $str =~ s|<tt>(.*)</tt>|\1| |
| 437 | if $STRIP_INDEX_TT; |
| 438 | add_index_entry($str, $ahref); |
| 439 | "$aname$str</a>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | # Changed from the stock version to indent {verbatim} sections, |
| 443 | # and make them smaller, to better match the LaTeX version: |
| 444 | |
| 445 | # (Used with LaTeX2HTML 96.1*) |
| 446 | sub replace_verbatim { |
| 447 | # Modifies $_ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 448 | my($prefix,$suffix) = ("\n<p><dl><dd><pre>\n", "</pre></dl>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 449 | s/$verbatim_mark(verbatim)(\d+)/$prefix$verbatim{$2}$suffix/go; |
| 450 | s/$verbatim_mark(rawhtml)(\d+)/$verbatim{$2}/ego; # Raw HTML |
| 451 | } |
| 452 | |
| 453 | # (Used with LaTeX2HTML 98.1) |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 454 | # The HTML this produces is bad; the <PRE> is on the outside of the <dl>, |
| 455 | # but I haven't found a workaround yet. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 456 | sub replace_verbatim_hook{ |
| 457 | # Modifies $_ |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 458 | my($prefix,$suffix) = ("\n<p><dl><dd>", "</dl>"); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 459 | s/$math_verbatim_rx/&put_comment("MATH: ".$verbatim{$1})/eg; |
| 460 | s/$verbatim_mark(\w*[vV]erbatim\*?)(\d+)\#/$prefix$verbatim{$2}$suffix/go; |
| 461 | # Raw HTML, but replacements may have protected characters |
| 462 | s/$verbatim_mark(rawhtml)(\d+)#/&unprotect_raw_html($verbatim{$2})/eg; |
| 463 | s/$verbatim_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX |
| 464 | s/$unfinished_mark$keepcomments(\d+)#/$verbatim{$2}/ego; # Raw TeX |
| 465 | } |
| 466 | |
| 467 | sub do_env_cfuncdesc{ |
| 468 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 469 | my($return_type,$function_name,$arg_list,$idx) = ('', '', '', ''); |
| 470 | my $any_next_pair_rx3 = "$O(\\d+)$C([\\s\\S]*)$O\\3$C"; |
| 471 | my $any_next_pair_rx5 = "$O(\\d+)$C([\\s\\S]*)$O\\5$C"; |
| 472 | my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 473 | if (/$cfuncdesc_rx/o) { |
| 474 | $return_type = "$2"; |
| 475 | $function_name = "$4"; |
| 476 | $arg_list = "$6"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 477 | $idx = make_str_index_entry($3, |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 478 | "<tt>$function_name()</tt>" . &get_indexsubitem); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 479 | $idx =~ s/ \(.*\)//; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 480 | $idx =~ s/\(\)//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 481 | } |
| 482 | "<dl><dt>$return_type <b>$idx</b>" |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 483 | . "(<var>$arg_list</var>)\n<dd>$'</dl>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | sub do_env_ctypedesc{ |
| 487 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 488 | my $type_name = (''); |
| 489 | my $cfuncdesc_rx = "$next_pair_rx"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 490 | if (/$cfuncdesc_rx/o) { |
| 491 | $type_name = "$2"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 492 | $idx = make_str_index_entry($1, |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 493 | "<tt>$type_name</tt>" . &get_indexsubitem); |
| 494 | $idx =~ s/ \(.*\)//; |
| 495 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 496 | "<dl><dt><b>$idx</b>\n<dd>$'</dl>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | sub do_env_cvardesc{ |
| 500 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 501 | my($var_type,$var_name,$idx) = ('', '', ''); |
| 502 | my $cfuncdesc_rx = "$next_pair_rx$any_next_pair_rx3"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 503 | if (/$cfuncdesc_rx/o) { |
| 504 | $var_type = "$2"; |
| 505 | $var_name = "$4"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 506 | $idx = make_str_index_entry($3, |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 507 | "<tt>$var_name</tt>" . &get_indexsubitem); |
| 508 | $idx =~ s/ \(.*\)//; |
| 509 | } |
| 510 | "<dl><dt>$var_type <b>$idx</b>\n" |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 511 | . "<dd>$'</dl>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | sub do_env_funcdesc{ |
| 515 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 516 | my($function_name,$arg_list,$idx) = ('', '', ''); |
| 517 | my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 518 | if (/$funcdesc_rx/o) { |
| 519 | $function_name = "$2"; |
| 520 | $arg_list = "$4"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 521 | $idx = make_str_index_entry($3, "<tt>$function_name()</tt>" |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 522 | . &get_indexsubitem); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 523 | $idx =~ s/ \(.*\)//; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 524 | $idx =~ s/\(\)//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 525 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 526 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 527 | } |
| 528 | |
| 529 | sub do_env_funcdescni{ |
| 530 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 531 | my($function_name,$arg_list,$idx) = ('', '', ''); |
| 532 | my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 533 | if (/$funcdesc_rx/o) { |
| 534 | $function_name = "$2"; |
| 535 | $arg_list = "$4"; |
| 536 | if ($STRIP_INDEX_TT) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 537 | $idx = "$function_name"; } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 538 | else { |
| 539 | $idx = "<tt>$function_name</tt>"; } |
| 540 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 541 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | sub do_cmd_funcline{ |
| 545 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 546 | my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 547 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 548 | s/$next_pair_pr_rx//o; |
| 549 | my $function_name = $2; |
| 550 | s/$next_pair_pr_rx//o; |
| 551 | my($br_id,$arg_list) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 552 | my $idx = make_str_index_entry($br_id, "<tt>$function_name()</tt>" |
| 553 | . &get_indexsubitem); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 554 | $idx =~ s/\(\)//; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 555 | |
| 556 | "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_; |
| 557 | } |
| 558 | |
| 559 | # Change this flag to index the opcode entries. I don't think it's very |
| 560 | # useful to index them, since they're only presented to describe the dis |
| 561 | # module. |
| 562 | # |
| 563 | $INDEX_OPCODES = 0; |
| 564 | |
| 565 | sub do_env_opcodedesc{ |
| 566 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 567 | my($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', ''); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 568 | my $opcodedesc_rx = "$next_pair_rx$any_next_pair_rx3"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 569 | if (/$opcodedesc_rx/o) { |
| 570 | $opcode_name = "$2"; |
| 571 | $arg_list = "$4"; |
| 572 | if ($INDEX_OPCODES) { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 573 | $idx = make_str_index_entry($3, |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 574 | "<tt>$opcode_name</tt> (byte code instruction)"); |
| 575 | $idx =~ s/ \(byte code instruction\)//; |
| 576 | } |
| 577 | else { |
| 578 | $idx = "<tt>$opcode_name</tt>"; |
| 579 | } |
| 580 | } |
| 581 | $stuff = "<dl><dt><b>$idx</b>"; |
| 582 | if ($arg_list) { |
| 583 | $stuff .= " <var>$arg_list</var>"; |
| 584 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 585 | $stuff . "\n<dd>$'</dl>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | sub do_env_datadesc{ |
| 589 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 590 | my $idx = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 591 | if (/$next_pair_rx/o) { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 592 | $idx = make_str_index_entry($1, "<tt>$2</tt>" . &get_indexsubitem); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 593 | $idx =~ s/ \(.*\)//; |
| 594 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 595 | "<dl><dt><b>$idx</b>\n<dd>$'</dl>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | sub do_env_datadescni{ |
| 599 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 600 | my $idx = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 601 | if (/$next_pair_rx/o) { |
| 602 | if ($STRING_INDEX_TT) { |
| 603 | $idx = "$2"; } |
| 604 | else { |
| 605 | $idx = "<tt>$2</tt>"; } |
| 606 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 607 | "<dl><dt><b>$idx</b>\n<dd>$'</dl>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | sub do_cmd_dataline{ |
| 611 | local($_) = @_; |
| 612 | |
| 613 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 614 | my($br_id, $data_name) = ($1, $2); |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 615 | my $idx = make_str_index_entry($br_id, "<tt>$data_name</tt>" |
| 616 | . &get_indexsubitem); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 617 | $idx =~ s/ \(.*\)//; |
| 618 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 619 | "<dt><b>$idx</b><dd>" . $_; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 620 | } |
| 621 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 622 | sub do_env_excdesc{ |
| 623 | local($_) = @_; |
| 624 | /$next_pair_rx/o; |
| 625 | my($br_id,$excname,$rest) = ($1, $2, $'); |
| 626 | my $idx = make_str_index_entry($br_id, |
| 627 | "<tt>$excname</tt> (exception in $THIS_MODULE)"); |
| 628 | $idx =~ s/ \(.*\)//; |
| 629 | "<dl><dt><b>$idx</b>\n<dd>$rest</dl>" |
| 630 | } |
| 631 | |
| 632 | sub do_env_fulllineitems{ do_env_itemize(@_); } |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 633 | |
| 634 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 635 | sub do_env_classdesc{ |
| 636 | local($_) = @_; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 637 | my($class_name,$arg_list,$idx) = ('', '', ''); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 638 | my $funcdesc_rx = "$next_pair_rx$any_next_pair_rx3"; |
| 639 | if (/$funcdesc_rx/o) { |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 640 | $class_name = "$2"; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 641 | $arg_list = "$4"; |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 642 | $THIS_CLASS = $class_name; |
| 643 | $idx = make_str_index_entry($3, |
| 644 | "<tt>$class_name</tt> (class in $THIS_MODULE)" ); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 645 | $idx =~ s/ \(.*\)//; |
| 646 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 647 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>"; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 650 | |
| 651 | sub do_env_methoddesc{ |
| 652 | local($_) = @_; |
| 653 | my($class_name,$arg_list,$idx,$extra); |
| 654 | # Predefined $opt_arg_rx & $optional_arg_rx don't work because they |
| 655 | # require the argument to be there. |
| 656 | my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?"; |
| 657 | my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5"; |
| 658 | if (/$funcdesc_rx/o) { |
| 659 | $class_name = $2; |
| 660 | $class_name = $THIS_CLASS |
| 661 | unless $class_name; |
| 662 | $method_name = $4; |
| 663 | $arg_list = $6; |
| 664 | if ($class_name) { |
| 665 | $extra = " ($class_name method)"; |
| 666 | } |
| 667 | $idx = make_str_index_entry($3, "<tt>$method_name()</tt>$extra"); |
| 668 | $idx =~ s/ \(.*\)//; |
| 669 | $idx =~ s/\(\)//; |
| 670 | } |
| 671 | "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>$'</dl>"; |
| 672 | } |
| 673 | |
| 674 | |
| 675 | sub do_env_methoddescni{ |
| 676 | local($_) = @_; |
| 677 | # Predefined $opt_arg_rx & $optional_arg_rx don't work because they |
| 678 | # require the argument to be there. |
| 679 | my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?"; |
| 680 | my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5"; |
| 681 | /$funcdesc_rx/o; |
| 682 | my $method = $4; |
| 683 | my $arg_list = $6; |
| 684 | "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>$'</dl>"; |
| 685 | } |
| 686 | |
| 687 | |
| 688 | sub do_env_memberdesc{ |
| 689 | local($_) = @_; |
| 690 | # Predefined $opt_arg_rx & $optional_arg_rx don't work because they |
| 691 | # require the argument to be there. |
| 692 | my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?"; |
| 693 | my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3$any_next_pair_rx5"; |
| 694 | /$funcdesc_rx/o; |
| 695 | my($class,$member,$arg_list) = ($2, $4, $6); |
| 696 | $class = $THIS_CLASS |
| 697 | unless $class; |
| 698 | $extra = " ($class_name attribute)" |
| 699 | if $class; |
| 700 | my $idx = make_str_index_entry($3, "<tt>$member()</tt>$extra"); |
| 701 | $idx =~ s/ \(.*\)//; |
| 702 | $idx =~ s/\(\)//; |
| 703 | "<dl><dt><b>$idx</b>\n<dd>$'</dl>"; |
| 704 | } |
| 705 | |
| 706 | |
| 707 | sub do_env_memberdescni{ |
| 708 | local($_) = @_; |
| 709 | # Predefined $opt_arg_rx & $optional_arg_rx don't work because they |
| 710 | # require the argument to be there. |
| 711 | my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?"; |
| 712 | my $funcdesc_rx = "$opt_arg_rx$any_next_pair_rx3"; |
| 713 | /$funcdesc_rx/o; |
| 714 | my $member = $4; |
| 715 | "<dl><dt><b>$member</b>\n<dd>$'</dl>"; |
| 716 | } |
| 717 | |
| 718 | |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 719 | @col_aligns = ("<td>", "<td>", "<td>"); |
| 720 | |
| 721 | sub setup_column_alignments{ |
| 722 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 723 | my($j1,$a1,$a2,$a3,$j4) = split(/[|]/,$_); |
| 724 | my($th1,$th2,$th3) = ('<th>', '<th>', '<th>'); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 725 | $col_aligns[0] = (($a1 eq "c") ? "<td align=center>" : "<td>"); |
| 726 | $col_aligns[1] = (($a2 eq "c") ? "<td align=center>" : "<td>"); |
| 727 | $col_aligns[2] = (($a3 eq "c") ? "<td align=center>" : "<td>"); |
| 728 | # return the aligned header start tags; only used for \begin{tableiii?} |
| 729 | $th1 = (($a1 eq "l") ? "<th align=left>" |
| 730 | : ($a1 eq "r" ? "<th align=right>" : "<th>")); |
| 731 | $th2 = (($a2 eq "l") ? "<th align=left>" |
| 732 | : ($a2 eq "r" ? "<th align=right>" : "<th>")); |
| 733 | $th3 = (($a3 eq "l") ? "<th align=left>" |
| 734 | : ($a3 eq "r" ? "<th align=right>" : "<th>")); |
| 735 | ($th1, $th2, $th3); |
| 736 | } |
| 737 | |
| 738 | sub do_env_tableii{ |
| 739 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 740 | my($font,$h1,$h2) = ('', '', ''); |
| 741 | my $tableiii_rx = |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 742 | "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7"; |
| 743 | if (/$tableiii_rx/o) { |
| 744 | $font = $4; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame^] | 745 | $font = '' |
| 746 | if ($font eq 'textrm'); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 747 | $h1 = $6; |
| 748 | $h2 = $8; |
| 749 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 750 | my($th1,$th2,$th3) = setup_column_alignments($2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 751 | $globals{"lineifont"} = $font; |
| 752 | "<table border align=center>" |
| 753 | . "\n <tr>$th1<b>$h1</b></th>" |
| 754 | . "\n $th2<b>$h2</b></th>$'" |
| 755 | . "\n</table>"; |
| 756 | } |
| 757 | |
| 758 | sub do_cmd_lineii{ |
| 759 | local($_) = @_; |
| 760 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 761 | my $c1 = $2; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 762 | s/$next_pair_pr_rx//o; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame^] | 763 | my($c2,$font,$efont) = ($2, $globals{"lineifont"}, ''); |
| 764 | if ($font) { |
| 765 | $font = "<$font>"; |
| 766 | $efont = "</$font>"; |
| 767 | } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 768 | my($c1align,$c2align) = @col_aligns[0,1]; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame^] | 769 | "<tr>$c1align$font$c1$efont</td>\n" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 770 | . " $c2align$c2</td>$'"; |
| 771 | } |
| 772 | |
| 773 | sub do_env_tableiii{ |
| 774 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 775 | my($font,$h1,$h2,$h3) = ('', '', '', ''); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 776 | |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 777 | my $tableiii_rx = |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 778 | "$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5$any_next_pair_rx7" |
| 779 | . "$any_next_pair_rx9"; |
| 780 | if (/$tableiii_rx/o) { |
| 781 | $font = $4; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame^] | 782 | $font = '' |
| 783 | if ($font eq 'textrm'); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 784 | $h1 = $6; |
| 785 | $h2 = $8; |
| 786 | $h3 = $10; |
| 787 | } |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 788 | my($th1,$th2,$th3) = setup_column_alignments($2); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 789 | $globals{"lineifont"} = $font; |
| 790 | "<table border align=center>" |
| 791 | . "\n <tr>$th1<b>$h1</b></th>" |
| 792 | . "\n $th2<b>$h2</b></th>" |
| 793 | . "\n $th3<b>$h3</b></th>$'" |
| 794 | . "\n</table>"; |
| 795 | } |
| 796 | |
| 797 | sub do_cmd_lineiii{ |
| 798 | local($_) = @_; |
| 799 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 800 | my $c1 = $2; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 801 | s/$next_pair_pr_rx//o; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 802 | my $c2 = $2; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 803 | s/$next_pair_pr_rx//o; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame^] | 804 | my($c3,$font,$efont) = ($2, $globals{"lineifont"}, ''); |
| 805 | if ($font) { |
| 806 | $font = "<$font>"; |
| 807 | $efont = "</$font>"; |
| 808 | } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 809 | my($c1align, $c2align, $c3align) = @col_aligns; |
Fred Drake | 58b2bfd | 1998-04-02 20:14:04 +0000 | [diff] [blame^] | 810 | "<tr>$c1align$font$c1$efont</td>\n" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 811 | . " $c2align$c2</td>\n" |
| 812 | . " $c3align$c3</td>$'"; |
| 813 | } |
| 814 | |
| 815 | sub do_env_seealso{ |
| 816 | "<p><b>See Also:</b></p>\n" . @_[0]; |
| 817 | } |
| 818 | |
| 819 | sub do_cmd_seemodule{ |
| 820 | # Insert the right magic to jump to the module definition. This should |
| 821 | # work most of the time, at least for repeat builds.... |
| 822 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 823 | my $any_next_pair_pr_rx3 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP"; |
| 824 | my $any_next_pair_pr_rx5 = "$OP(\\d+)$CP([\\s\\S]*)$OP\\5$CP"; |
| 825 | # Predefined $opt_arg_rx & $optional_arg_rx don't work because they |
| 826 | # require the argument to be there. |
| 827 | my $opt_arg_rx = "^\\s*(\\[([^]]*)\\])?"; |
| 828 | s/$opt_arg_rx$any_next_pair_pr_rx3$any_next_pair_pr_rx5//; |
| 829 | my($key,$module,$text) = ($2, $4, $6); |
| 830 | $key = $module unless $key; |
Fred Drake | b3c9bca | 1998-03-06 21:20:08 +0000 | [diff] [blame] | 831 | "<p>Module <tt><b><a href=\"module-$key.html\">$module</a></b></tt>" |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 832 | . " ($text)</p>" |
| 833 | . $_; |
| 834 | } |
| 835 | |
| 836 | sub do_cmd_seetext{ |
| 837 | "<p>" . @_[0]; |
| 838 | } |
| 839 | |
| 840 | |
| 841 | sub do_cmd_maketitle { |
| 842 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 843 | my $the_title = ''; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 844 | if ($t_title) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 845 | $the_title .= "<h1 align=center>$t_title</h1>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 846 | } else { &write_warnings("\nThis document has no title."); } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 847 | $the_title .= "\n<center>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 848 | if ($t_author) { |
| 849 | if ($t_authorURL) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 850 | my $href = &translate_commands($t_authorURL); |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 851 | $href = &make_named_href('author', $href, "<strong>${t_author}</strong>"); |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 852 | $the_title .= "\n<p>$href</p>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 853 | } else { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 854 | $the_title .= "\n<p><strong>$t_author</strong></p>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 855 | } |
| 856 | } else { &write_warnings("\nThere is no author for this document."); } |
| 857 | if ($t_institute) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 858 | $the_title .= "\n<p>$t_institute</p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 859 | if ($AUTHOR_ADDRESS) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 860 | $the_title .= "\n<p>$AUTHOR_ADDRESS</p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 861 | if ($t_affil) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 862 | $the_title .= "\n<p><i>$t_affil</i></p>";} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 863 | if ($t_date) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 864 | $the_title .= "\n<p><strong>$t_date</strong>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 865 | if ($PYTHON_VERSION) { |
| 866 | $the_title .= "<br><strong>Release $PYTHON_VERSION</strong>";} |
| 867 | $the_title .= "</p>" |
| 868 | } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 869 | $the_title .= "\n</center>"; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 870 | if ($t_address) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 871 | $the_title .= "\n<p>$t_address</p>"; |
| 872 | } else { $the_title .= "\n<p>"} |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 873 | if ($t_email) { |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 874 | $the_title .= "\n<p>$t_email</p>"; |
| 875 | }# else { $the_title .= "</p>" } |
| 876 | $the_title . "<hr>\n" . $_ ; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 877 | } |
| 878 | |
| 879 | |
Fred Drake | 42b31a5 | 1998-03-27 05:16:10 +0000 | [diff] [blame] | 880 | # sub do_cmd_indexlabel{ |
| 881 | # "genindex" . @_[0]; |
| 882 | # } |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 883 | |
Fred Drake | fc16e78 | 1998-03-12 21:03:26 +0000 | [diff] [blame] | 884 | |
| 885 | # These are located down here since they screw up fontlock. -- used to. |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 886 | |
| 887 | sub do_cmd_file{ |
| 888 | # This uses a weird HTML construct to adjust the font to be |
| 889 | # reasonable match that used in the printed form as much as |
| 890 | # possible. The expected behavior is that a browser that doesn't |
| 891 | # understand "<font face=...>" markup will use courier (or whatever |
| 892 | # the font is for <tt>). |
| 893 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 894 | s|$next_pair_pr_rx|\"<tt>\2</tt>\"|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 895 | $_; |
| 896 | } |
| 897 | |
| 898 | sub do_cmd_samp{ |
| 899 | local($_) = @_; |
Fred Drake | c9a4438 | 1998-03-17 06:29:13 +0000 | [diff] [blame] | 900 | s|$next_pair_pr_rx|\"<tt>\2</tt>\"|; |
Fred Drake | 6659c30 | 1998-03-03 22:02:19 +0000 | [diff] [blame] | 901 | $_; |
| 902 | } |
| 903 | |
| 904 | 1; # This must be the last line |