blob: 481b956afd3857d853834757598d033ae28b0de0 [file] [log] [blame]
Fred Drake784c6d31996-11-11 20:46:44 +00001#LaTeX2HTML Version 96.1 : dot.latex2html-init
2#
3
Fred Drakedce22ad1996-12-06 14:50:58 +00004$INFO = 1; # 0 = do not make a "About this document..." section
Fred Drake784c6d31996-11-11 20:46:44 +00005$MAX_LINK_DEPTH = 3;
6
7# Python documentation uses section numbers to support references to match
8# in the printed and online versions.
9#
10$SHOW_SECTION_NUMBERS = 1;
11
12$HTML_VERSION = '3.0';
13$ICONSERVER = '../icons';
14
15# This replacement adds the "BORDER=0" attribute to the generated icon
16# markup. This is done for no better reason than that it looks better.
17#
18sub img_tag {
19 local($icon) = @_;
20 ( ($icon =~ /(gif)/) ?
21 do {
22 $icon =~ /(up|next|previous|next_page|previous_page|change_begin|change_end|change_delete|contents|index)/;
23 join('','<IMG ',$iconsizes{$1},' ALIGN=BOTTOM ALT="',$1,
24 '" SRC="',$ICONSERVER,"/$icon",'" BORDER=0>')
25 } :
26 $icon);
27}
28
Fred Drakedce22ad1996-12-06 14:50:58 +000029# This replacement for process_command() is needed to add the case for
Fred Drake784c6d31996-11-11 20:46:44 +000030# "\,"; it is unfortunate we need to do it this way.
31#
32sub process_command {
33 local ($cmd_rx, *ref_contents) = @_;
34 local($ref_before, $cmd, $after);
35 local($cmd_sub, $cmd_msub, $cmd_trans, $mathentity);
36 local (@open_font_tags,@open_size_tags);
37 $ref_contents = &convert_iso_latin_chars($ref_contents);
38 for (;;) { # Do NOT use the o option
39 last unless ($ref_contents =~ /$cmd_rx/ );
40 ($ref_before, $cmd, $after) = ($`, $1, "$2$'");
41 print(".");
42# $after =~ s/^[ ]+/ /o; Collapse all spaces that follow a command
43 if ($cmd =~ /[a-zA-Z]$/) { # Eat redundant spaces that follow a command
44 $after =~ s/^[ \t]+//o; }
45 else {
46 $after =~ s/^[ \t]+/ /o; }
47 if ( $cmd = &normalize($cmd) ) {
48 ($cmd_sub, $cmd_msub, $cmd_trans, $mathentity) =
49 ("do_cmd_$cmd", "do_math_cmd_$cmd",
50 $declarations{$cmd}, $mathentities{$cmd});
51 if (defined &$cmd_sub) {
52 # $ref_before may also be modified ...
53 if ($cmd =~ /$sizechange_rx/o) {
54 $after = &$cmd_sub($after, @open_size_tags);
55 } else {
56 $after = &$cmd_sub($after, @open_font_tags);
57 };
58 }
59 elsif (defined &$cmd_msub) {
60 # $ref_before may also be modified ...
61 $after = &$cmd_msub($after, @open_font_tags);
62 if ( !$math_mode ) {
63 $after = "<MATH>" . $after . "</MATH>";
64 ++$commands_outside_math{$cmd};
65 };
66 }
67 elsif ($cmd_trans) { # One to one transform
68 $cmd_trans =~ m|</.*$|;
69 $after = $` . $after . $&;
70 push(@open_font_tags, $cmd) if ($cmd =~ /$fontchange_rx/o);
71 push(@open_size_tags, $cmd) if ($cmd =~ /$sizechange_rx/o);}
72 elsif ($mathentity) {
73 if ( $math_mode ) {
74 $after = "&$mathentity;" . $after;
75 } else {
76 $after = "<MATH>&$mathentity;</MATH>" . $after;
77 ++$commands_outside_math{$cmd};
78 }; }
79 # Here's the hack:
80 elsif ($cmd == ',' && ! $AUX_FILE) {
81 $ref_before = $ref_before . ",";
82 }
83 elsif ($ignore{$cmd}) { # Ignored command
84 print "."}
85 elsif ($cmd =~ /^the(.+)$/) { # Counter
86 $counter = $1;
87 $after = &do_cmd_thecounter($after);}
88 else {
89 # Do not add if reading an auxiliary file
90 ++$unknown_commands{$cmd} unless $AUX_FILE;
91 }
92 }
93 $ref_contents = join('', $ref_before, $after);
94 }
95 $ref_contents;
96}
97
981; # This must be the last line