Fred Drake | a5a3cdc | 1997-12-08 20:58:13 +0000 | [diff] [blame] | 1 | #LaTeX2HTML Version 96.1 : dot.latex2html-init -*- perl -*- |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 2 | # |
| 3 | |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 4 | $INFO = 1; # 0 = do not make a "About this document..." section |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 5 | $MAX_LINK_DEPTH = 3; |
| 6 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 7 | $NUMBERED_FOOTNOTES = 1; |
| 8 | |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 9 | # Python documentation uses section numbers to support references to match |
| 10 | # in the printed and online versions. |
| 11 | # |
| 12 | $SHOW_SECTION_NUMBERS = 1; |
| 13 | |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 14 | $ICONSERVER = '../icons'; |
| 15 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 16 | $CHILDLINE = "\n<p><hr>\n"; |
| 17 | $VERBOSITY = 0; |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 18 | |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 19 | |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 20 | sub top_navigation_panel { |
| 21 | |
| 22 | # Now add a few buttons with a space between them |
Fred Drake | 616b23b | 1997-12-18 14:16:46 +0000 | [diff] [blame] | 23 | "<div class=navigation>\n" . |
Fred Drake | 70d289d | 1998-02-16 15:23:11 +0000 | [diff] [blame] | 24 | "$NEXT\n$UP\n$PREVIOUS\n$CONTENTS\n$INDEX $CUSTOM_BUTTONS" . |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 25 | |
Fred Drake | 60a3d27 | 1998-01-09 14:39:41 +0000 | [diff] [blame] | 26 | "<br>\n" . # Line break |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 27 | |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 28 | # If ``next'' section exists, add its title to the navigation panel |
Fred Drake | 616b23b | 1997-12-18 14:16:46 +0000 | [diff] [blame] | 29 | ($NEXT_TITLE ? "<b> Next:</b> $NEXT_TITLE\n" : undef) . |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 30 | |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 31 | # Similarly with the ``up'' title ... |
Fred Drake | 616b23b | 1997-12-18 14:16:46 +0000 | [diff] [blame] | 32 | ($UP_TITLE ? "<b>Up:</b> $UP_TITLE\n" : undef) . |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 33 | |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 34 | # ... and the ``previous'' title |
Fred Drake | 616b23b | 1997-12-18 14:16:46 +0000 | [diff] [blame] | 35 | ($PREVIOUS_TITLE ? "<b> Previous:</b> $PREVIOUS_TITLE\n" : undef) . |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 36 | |
| 37 | # Line Break, horizontal rule (3-d dividing line) and new paragraph |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 38 | "<br><hr><p></div>" |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | sub bot_navigation_panel { |
| 42 | |
| 43 | # Start with a horizontal rule (3-d dividing line) |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 44 | "<div class=navigation><hr>". |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 45 | |
| 46 | # Now add a few buttons with a space between them |
Fred Drake | 70d289d | 1998-02-16 15:23:11 +0000 | [diff] [blame] | 47 | "$NEXT\n$UP\n$PREVIOUS\n$CONTENTS\n$INDEX $CUSTOM_BUTTONS" . |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 48 | |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 49 | "<br>\n" . # Line break |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 50 | |
| 51 | # If ``next'' section exists, add its title to the navigation panel |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 52 | ($NEXT_TITLE ? "<b> Next:</b> $NEXT_TITLE\n" : undef) . |
| 53 | |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 54 | # Similarly with the ``up'' title ... |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 55 | ($UP_TITLE ? "<b>Up:</b> $UP_TITLE\n" : undef) . |
| 56 | |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 57 | # ... and the ``previous'' title |
Fred Drake | d569242 | 1997-12-11 21:46:07 +0000 | [diff] [blame] | 58 | ($PREVIOUS_TITLE ? "<b> Previous:</b> $PREVIOUS_TITLE\n" : undef) . |
| 59 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 60 | "</div>" |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 64 | # sub make_section_heading { |
| 65 | # local($text, $level, $anchors) = @_; |
| 66 | # local($section_tag) = join('', @curr_sec_id); |
| 67 | # local($align,$pre_anchors); |
| 68 | # # separate any invisible anchors or alignment, if this has not already been done |
| 69 | # if (!($anchors)){ ($anchors,$text) = &extract_anchors($text) } |
| 70 | # else { |
| 71 | # $anchors =~ s/(ALIGN=\"\w*\")/$align = " $1";''/e; |
| 72 | # $anchors = &translate_commands($anchors) if ($anchors =~ /\\/); |
| 73 | # } |
| 74 | # if (!($text)) { |
| 75 | # # anchor to a single `.' only |
| 76 | # $text = "<a name=SECTION$section_tag>.</a>$anchors\n"; |
| 77 | # } elsif ($anchors) { |
| 78 | # # keep it short and simple! |
| 79 | # $text = "<a name=SECTION$section_tag>$text</a>"; |
| 80 | # } elsif (!($text =~ /<A[^\w]/io)) { |
| 81 | # # no embedded anchors, so anchor it all |
| 82 | # $text = "<a name=SECTION$section_tag>\n" . $text . "</a>"; |
| 83 | # } else { |
| 84 | # # there are embedded anchors; these cannot be nested |
| 85 | # local ($tmp) = $text; |
| 86 | # $tmp =~ s/<//o ; # find 1st < |
| 87 | # if ($`) { # anchor text before the first < |
| 88 | # # $text = "<A NAME=\"SECTION$section_tag\">\n" . $` . "</A>\n<" . $'; |
| 89 | # $text = "<a name=SECTION$section_tag>\n" . $` . "</a>"; |
| 90 | # $pre_anchors = "<" . $'; |
| 91 | # if ($pre_anchors =~ /^(<A NAME=\"[^\"]+>${anchor_invisible_mark}<\/A>\s*)+$/) { |
| 92 | # $pre_anchors .= "\n" |
| 93 | # } else { $text .= $pre_anchors; $pre_anchors = '' } |
| 94 | # } else { |
| 95 | # # $text starts with a tag |
| 96 | # local($after,$tmp) = ($',''); |
| 97 | # if ( $after =~ /^A[^\w]/i ) { |
| 98 | # # it is an anchor already, so need a separate line |
| 99 | # $text = "<a name=SECTION$section_tag>$anchor_invisible_mark</a><br>\n$text"; |
| 100 | # } else { |
| 101 | # # Is it a tag enclosing the anchor ? |
| 102 | # $after =~ s/^(\w)*[\s|>]/$tmp = $1;''/eo; |
| 103 | # if ($after =~ /<A.*<\/$tmp>/) { |
| 104 | # # it encloses an anchor, so use anchor_mark + break |
| 105 | # $text = "<a name=SECTION$section_tag>$anchor_invisible_mark</a><br>\n$text"; |
| 106 | # } else { |
| 107 | # # take up to the anchor |
| 108 | # $text =~ s/^(.*)<A([^\w])/"<a name=SECTION$section_tag>$1<A$2"/oe; |
| 109 | # } |
| 110 | # } |
| 111 | # } |
| 112 | # } |
| 113 | # "$pre_anchors\n<$level$align>$text\n<\/$level>"; |
| 114 | # } |
| 115 | |
| 116 | |
Fred Drake | 819b789 | 1997-12-17 03:08:27 +0000 | [diff] [blame] | 117 | sub gen_index_id { |
| 118 | # this is used to ensure common index key generation and a stable sort |
| 119 | local($str,$extra) = @_; |
| 120 | sprintf("%s###%s%010d", $str, $extra, ++$global{'max_id'}); |
| 121 | } |
| 122 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 123 | # sub make_index_entry { |
| 124 | # local($br_id,$str) = @_; |
| 125 | # # If TITLE is not yet available (i.e the \index command is in the title of the |
| 126 | # # current section), use $ref_before. |
| 127 | # $TITLE = $ref_before unless $TITLE; |
| 128 | # # Save the reference |
| 129 | # $str = gen_index_id($str, ''); |
| 130 | # $index{$str} .= &make_half_href("$CURRENT_FILE#$br_id"); |
| 131 | # "<a name=\"$br_id\">$anchor_invisible_mark<\/a>"; |
| 132 | # } |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 133 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 134 | # sub add_idx { |
| 135 | # print "\nDoing the index ..."; |
| 136 | # local($key, $str, @keys, $index, $level, $count, @previous, @current); |
| 137 | # @keys = keys %index; |
| 138 | # @keys = sort keysort @keys; |
| 139 | # $level = 0; |
| 140 | # foreach $key (@keys) { |
| 141 | # @current = split(/!/, $key); |
| 142 | # $count = 0; |
| 143 | # while ($current[$count] eq $previous[$count]) { |
| 144 | # $count++; |
| 145 | # } |
| 146 | # while ($count > $level) { |
| 147 | # $index .= "<dl compact>\n"; |
| 148 | # $level++; |
| 149 | # } |
| 150 | # while ($count < $level) { |
| 151 | # $index .= "</dl>\n"; |
| 152 | # $level--; |
| 153 | # } |
| 154 | # foreach $term (@current[$count .. $#current-1]) { |
| 155 | # # need to "step in" a little |
| 156 | # $index .= "<dt>" . $term . "\n<dl compact>\n"; |
| 157 | # $level++; |
| 158 | # } |
| 159 | # $str = $current[$#current]; |
| 160 | # $str =~ s/\#\#\#\d+$//o; # Remove the unique id's |
| 161 | # $str =~ s/\#\#\#[DR]EF\d+$//o; # Remove the unique id's |
| 162 | # if (&index_key_eq(join('',@current), join('',@previous))) { |
| 163 | # $index .= ",\n$index{$key}" . $cross_ref_visible_mark . "</a>"; } |
| 164 | # else { |
| 165 | # $index .= "\n<dt>$index{$key}" . $str . "</a>"; } |
| 166 | # @previous = @current; |
| 167 | # } |
| 168 | # while ($count < $level) { |
| 169 | # $index .= "</dl>\n"; |
| 170 | # $level--; |
| 171 | # } |
| 172 | # s/$idx_mark/<dl compact>$index<\/dl>/o; |
| 173 | # } |
Fred Drake | f2d7e55 | 1997-12-03 19:44:27 +0000 | [diff] [blame] | 174 | |
| 175 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 176 | # sub index_key_eq { |
| 177 | # local($a,$b) = @_; |
| 178 | # $a = &clean_key($a); |
| 179 | # $a =~ s/\#\#\#\d+$//o; # Remove the unique id's |
| 180 | # $a =~ s/\#\#\#[dr]ef\d+$//o; # Remove the unique id's |
| 181 | # $b = &clean_key($b); |
| 182 | # $b =~ s/\#\#\#\d+$//o; # Remove the unique id's |
| 183 | # $b =~ s/\#\#\#[dr]ef\d+$//o; # Remove the unique id's |
| 184 | # $a eq $b; |
| 185 | # } |
Fred Drake | 819b789 | 1997-12-17 03:08:27 +0000 | [diff] [blame] | 186 | |
Fred Drake | a5a3cdc | 1997-12-08 20:58:13 +0000 | [diff] [blame] | 187 | # need to remove leading <...> |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 188 | # sub clean_key { |
| 189 | # local ($_) = @_; |
| 190 | # tr/A-Z/a-z/; |
| 191 | # s/\s//; |
| 192 | # s/^<[a-z][-._a-z0-9]*>//; # Remove leading <gi> |
| 193 | # $_; |
| 194 | # } |
Fred Drake | a5a3cdc | 1997-12-08 20:58:13 +0000 | [diff] [blame] | 195 | |
| 196 | |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 197 | $idx_module_mark = '<tex2html_idx_module_mark>'; |
| 198 | $idx_module_title = 'Module Index'; |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 199 | |
| 200 | sub add_module_idx { |
| 201 | print "\nDoing the module index ..."; |
| 202 | local($key, @keys, $index); |
| 203 | $index = "<p>"; |
| 204 | @keys = keys %Modules; |
| 205 | @keys = sort keysort @keys; |
| 206 | foreach $key (@keys) { |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 207 | $index .= "$Modules{$key}$key</a><br>\n"; |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 208 | } |
| 209 | s/$idx_module_mark/$index<p>/o; |
| 210 | } |
| 211 | |
| 212 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 213 | # sub remove_general_markers { |
| 214 | # s/$lof_mark/<UL>$figure_captions<\/UL>/o; |
| 215 | # s/$lot_mark/<UL>$table_captions<\/UL>/o; |
| 216 | # &replace_citations if /$bbl_mark/; |
| 217 | # &add_toc if (/$toc_mark/); |
| 218 | # &add_idx if (/$idx_mark/); |
| 219 | # &add_module_idx if (/$idx_module_mark/); |
| 220 | # &replace_cross_references if /$cross_ref_mark/; |
| 221 | # &replace_external_references if /$external_ref_mark/; |
| 222 | # &replace_cite_references if /$cite_mark/; |
| 223 | # if (defined &replace_user_references) { |
| 224 | # &replace_user_references if /$user_ref_mark/; |
| 225 | # } |
| 226 | # } |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 227 | |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 228 | # In addition to the standard stuff, add label to allow named node files. |
| 229 | sub do_cmd_tableofcontents { |
| 230 | local($_) = @_; |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 231 | $TITLE = $toc_title; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 232 | $tocfile = $CURRENT_FILE; |
| 233 | local($closures,$reopens) = &preserve_open_tags(); |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 234 | &anchor_label("contents",$CURRENT_FILE,$_); # this is added |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 235 | join('', "<BR>\n", $closures |
| 236 | , &make_section_heading($toc_title, "H2"), $toc_mark |
| 237 | , $reopens, $_); |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 238 | } |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 239 | # In addition to the standard stuff, add label to allow named node files. |
| 240 | sub do_cmd_listoffigures { |
| 241 | local($_) = @_; |
| 242 | $TITLE = $lof_title; |
| 243 | $loffile = $CURRENT_FILE; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 244 | local($closures,$reopens) = &preserve_open_tags(); |
| 245 | &anchor_label("lof",$CURRENT_FILE,$_); # this is added |
| 246 | join('', "<BR>\n", $closures |
| 247 | , &make_section_heading($lof_title, "H2"), $lof_mark |
| 248 | , $reopens, $_); |
| 249 | } |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 250 | # In addition to the standard stuff, add label to allow named node files. |
| 251 | sub do_cmd_listoftables { |
| 252 | local($_) = @_; |
| 253 | $TITLE = $lot_title; |
| 254 | $lotfile = $CURRENT_FILE; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 255 | local($closures,$reopens) = &preserve_open_tags(); |
| 256 | &anchor_label("lot",$CURRENT_FILE,$_); # this is added |
| 257 | join('', "<BR>\n", $closures |
| 258 | , &make_section_heading($lot_title, "H2"), $lot_mark |
| 259 | , $reopens, $_); |
Fred Drake | 6eb1f6b | 1998-02-19 21:00:41 +0000 | [diff] [blame] | 260 | } |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 261 | # In addition to the standard stuff, add label to allow named node files. |
| 262 | sub do_cmd_textohtmlinfopage { |
| 263 | local($_) = @_; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 264 | if ($INFO) { # |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 265 | &anchor_label("about",$CURRENT_FILE,$_); # this is added |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 266 | } # |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 267 | ( ($INFO == 1) |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 268 | ? join('', $close_all |
| 269 | , "<STRONG>$t_title</STRONG><P>\nThis document was generated using the\n" |
| 270 | , "<A HREF=\"$TEX2HTMLADDRESS\"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A>" |
| 271 | , " translator Version $TEX2HTMLVERSION\n" |
| 272 | , "<P>Copyright © 1993, 1994, 1995, 1996, 1997,\n" |
| 273 | , "<A HREF=\"$AUTHORADDRESS\">Nikos Drakos</A>, \n" |
| 274 | , "Computer Based Learning Unit, University of Leeds.\n" |
| 275 | , "<P>The command line arguments were: <BR>\n " |
| 276 | , "<STRONG>latex2html</STRONG> <tt>$argv</tt>.\n" |
| 277 | , "<P>The translation was initiated by $address_data[0] on $address_data[1]" |
| 278 | , $open_all, $_) |
| 279 | : join('', $close_all, $INFO,"\n", $open_all, $_)) |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 280 | } |
| 281 | |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 282 | # $idx_mark will be replaced with the real index at the end |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 283 | sub do_cmd_textohtmlindex { |
| 284 | local($_) = @_; |
| 285 | $TITLE = $idx_title; |
| 286 | $idxfile = $CURRENT_FILE; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 287 | if (%index_labels) { &make_index_labels(); } |
| 288 | if (($SHORT_INDEX) && (%index_segment)) { &make_preindex(); } |
| 289 | else { $preindex = ''; } |
| 290 | local($heading) = join('',&make_section_heading($idx_title, "H2"), |
| 291 | $idx_mark); |
| 292 | local($pre,$post) = &minimize_open_tags($heading); |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 293 | &anchor_label("genindex",$CURRENT_FILE,$_); # this is added |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 294 | join('',"<BR>\n" , $pre, $_); |
Fred Drake | baa04a1 | 1998-02-19 18:51:39 +0000 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | # $idx_module_mark will be replaced with the real index at the end |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 298 | sub do_cmd_textohtmlmoduleindex { |
| 299 | local($_) = @_; |
Fred Drake | 45a4093 | 1998-02-17 23:11:40 +0000 | [diff] [blame] | 300 | local($key) = q/modindex/; |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 301 | $TITLE = $idx_module_title; |
Fred Drake | 45a4093 | 1998-02-17 23:11:40 +0000 | [diff] [blame] | 302 | &anchor_label("modindex",$CURRENT_FILE,$_); |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 303 | join('', '<p>' , &make_section_heading($idx_module_title, "h2"), |
| 304 | $idx_module_mark, $_); |
| 305 | } |
| 306 | |
| 307 | # The bibliography and the index should be treated as separate sections |
| 308 | # in their own HTML files. The \bibliography{} command acts as a sectioning command |
| 309 | # that has the desired effect. But when the bibliography is constructed |
| 310 | # manually using the thebibliography environment, or when using the |
| 311 | # theindex environment it is not possible to use the normal sectioning |
| 312 | # mechanism. This subroutine inserts a \bibliography{} or a dummy |
| 313 | # \textohtmlindex command just before the appropriate environments |
| 314 | # to force sectioning. |
| 315 | |
| 316 | # XXX This *assumes* that if there are two {theindex} environments, the |
| 317 | # first is the module index and the second is the standard index. This |
| 318 | # is sufficient for the current Python documentation, but that's about |
| 319 | # it. |
| 320 | |
| 321 | sub add_bbl_and_idx_dummy_commands { |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 322 | local($id) = $global{'max_id'}; |
| 323 | |
| 324 | $section_commands{'textohtmlmoduleindex'} = 2; |
| 325 | |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 326 | s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 327 | s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo |
| 328 | #if ($bbl_cnt == 1) |
| 329 | ; |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 330 | #} |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 331 | #----------------------------------------------------------------------# |
| 332 | # (FLD) This was added # |
| 333 | local(@parts) = split(/\\begin\s*$O\d+$C\s*theindex/); # |
| 334 | if (scalar(@parts) == 3) { # |
| 335 | print "\n&add_bbl_and_idx_dummy_commands ==> adding module index"; # |
| 336 | s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlmoduleindex $1/o; # |
| 337 | } # |
| 338 | #----------------------------------------------------------------------# |
| 339 | $global{'max_id'} = $id; |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 340 | s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o; |
| 341 | s/[\\]printindex/\\textohtmlindex /o; |
| 342 | &lib_add_bbl_and_idx_dummy_commands() if defined(&lib_add_bbl_and_idx_dummy_commands); |
| 343 | } |
| 344 | |
| 345 | # The bibliographic references, the appendices, the lists of figures and tables |
| 346 | # etc. must appear in the contents table at the same level as the outermost |
| 347 | # sectioning command. This subroutine finds what is the outermost level and |
| 348 | # sets the above to the same level; |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 349 | |
| 350 | %section_commands = ('textohtmlmoduleindex', 2, %section_commands); |
| 351 | |
| 352 | # sub set_depth_levels { |
| 353 | # # Sets $outermost_level |
| 354 | # local($level); |
| 355 | # #RRM: do not alter user-set value for $MAX_SPLIT_DEPTH |
| 356 | # foreach $level ("part", "chapter", "section", "subsection", |
| 357 | # "subsubsection", "paragraph") { |
| 358 | # last if (($outermost_level) = /\\($level)$delimiter_rx/); |
| 359 | # } |
| 360 | # $level = ($outermost_level ? $section_commands{$outermost_level} : |
| 361 | # do {$outermost_level = 'section'; 3;}); |
| 362 | |
| 363 | # #RRM: but calculate value for $MAX_SPLIT_DEPTH when a $REL_DEPTH was given |
| 364 | # if ($REL_DEPTH && $MAX_SPLIT_DEPTH) { |
| 365 | # $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH; |
| 366 | # } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 }; |
| 367 | |
| 368 | # %unnumbered_section_commands = ( |
| 369 | # 'tableofcontents', $level |
| 370 | # , 'listoffigures', $level |
| 371 | # , 'listoftables', $level |
| 372 | # , 'bibliography', $level |
| 373 | # , 'textohtmlindex', $level |
| 374 | # , 'textohtmlmoduleindex', $level |
| 375 | # ); |
| 376 | |
| 377 | # %section_commands = ( |
| 378 | # %unnumbered_section_commands |
| 379 | # , %section_commands |
| 380 | # ); |
| 381 | # } |
| 382 | |
| 383 | |
| 384 | # Fix from Ross Moore for ']' in \item[...]; this can be removed once the next |
| 385 | # patch to LaTeX2HTML is released and tested. |
| 386 | # |
| 387 | sub protect_useritems { |
| 388 | local(*_) = @_; |
| 389 | local($preitems, $thisitem); |
| 390 | while (/\\item\s*\[/) { |
| 391 | $preitems .= $`; $_ = $'; |
| 392 | $thisitem = $&.'<<'.++$global{'max_id'}.'>>'; |
| 393 | s/^(((($O|$OP)\d+($C|$CP)).*\3|<[^<>]*>|[^\]<]+)*)\]/$thisitem.=$1;''/e; |
| 394 | $preitems .= $thisitem.'<<'.$global{'max_id'}.'>>]'; s/^]//; |
| 395 | } |
| 396 | $_ = $preitems . $_; |
Fred Drake | 9b6f1d2 | 1998-01-13 04:03:02 +0000 | [diff] [blame] | 397 | } |
Fred Drake | 34d6f5b | 1998-03-04 05:36:59 +0000 | [diff] [blame^] | 398 | |
Fred Drake | 784c6d3 | 1996-11-11 20:46:44 +0000 | [diff] [blame] | 399 | 1; # This must be the last line |