Lines 1207-1213
sub process_ext_file {
Link Here
|
1207 |
&slurp_input($file); |
1207 |
&slurp_input($file); |
1208 |
if ($ext =~ /bbl/) { |
1208 |
if ($ext =~ /bbl/) { |
1209 |
# remove the \newcommand{\etalchar}{...} since not needed |
1209 |
# remove the \newcommand{\etalchar}{...} since not needed |
1210 |
s/^\\newcommand{\\etalchar}[^\n\r]*[\n\r]+//s; |
1210 |
s/^\\newcommand\{\\etalchar\}[^\n\r]*[\n\r]+//s; |
1211 |
} |
1211 |
} |
1212 |
&pre_process; |
1212 |
&pre_process; |
1213 |
&substitute_meta_cmds if (%new_command || %new_environment); |
1213 |
&substitute_meta_cmds if (%new_command || %new_environment); |
Lines 1401-1408
sub pre_process {
Link Here
|
1401 |
&replace_html_special_chars; |
1401 |
&replace_html_special_chars; |
1402 |
# Remove fake environment which should be invisible to LaTeX2HTML. |
1402 |
# Remove fake environment which should be invisible to LaTeX2HTML. |
1403 |
s/\001//m; |
1403 |
s/\001//m; |
1404 |
s/[%]end\s*{latexonly}/\001/gom; |
1404 |
s/[%]end\s*\{latexonly\}/\001/gom; |
1405 |
s/[%]begin\s*{latexonly}([^\001]*)\001/%/gos; |
1405 |
s/[%]begin\s*\{latexonly\}([^\001]*)\001/%/gos; |
1406 |
s/\001//m; |
1406 |
s/\001//m; |
1407 |
|
1407 |
|
1408 |
&preprocess_alltt if defined(&preprocess_alltt); |
1408 |
&preprocess_alltt if defined(&preprocess_alltt); |
Lines 1426-1438
sub pre_process {
Link Here
|
1426 |
&write_mydb("verbatim", $global{'verbatim_counter'}, $3); |
1426 |
&write_mydb("verbatim", $global{'verbatim_counter'}, $3); |
1427 |
"$1$comment_mark".$global{'verbatim_counter'}."\n"/mge; |
1427 |
"$1$comment_mark".$global{'verbatim_counter'}."\n"/mge; |
1428 |
# Remove the htmlonly-environment |
1428 |
# Remove the htmlonly-environment |
1429 |
s/\\begin\s*{htmlonly}\s*\n?//gom; |
1429 |
s/\\begin\s*\{htmlonly\}\s*\n?//gom; |
1430 |
s/\\end\s*{htmlonly}\s*\n?//gom; |
1430 |
s/\\end\s*\{htmlonly\}\s*\n?//gom; |
1431 |
# Remove enviroments which should be invisible to LaTeX2HTML. |
1431 |
# Remove enviroments which should be invisible to LaTeX2HTML. |
1432 |
s/\n[^%\n]*\\end\s*{latexonly}\s*\n?/\001/gom; |
1432 |
s/\n[^%\n]*\\end\s*\{latexonly\}\s*\n?/\001/gom; |
1433 |
s/((^|\n)[^%\n]*)\\begin\s*{latexonly}([^\001]*)\001/$1/gom; |
1433 |
s/((^|\n)[^%\n]*)\\begin\s*\{latexonly\}([^\001]*)\001/$1/gom; |
1434 |
s/\\end\s*{comment}\s*\n?/\001/gom; |
1434 |
s/\\end\s*\{comment\}\s*\n?/\001/gom; |
1435 |
s/\\begin\s*{comment}([^\001]*)\001//gom; |
1435 |
s/\\begin\s*\{comment\}([^\001]*)\001//gom; |
1436 |
|
1436 |
|
1437 |
# this used to be earlier, but that can create problems with comments |
1437 |
# this used to be earlier, but that can create problems with comments |
1438 |
&wrap_other_environments if (%other_environments); |
1438 |
&wrap_other_environments if (%other_environments); |
Lines 1465-1471
sub pre_process {
Link Here
|
1465 |
push(@processedV,$before); |
1465 |
push(@processedV,$before); |
1466 |
print "'";$before = ''; |
1466 |
print "'";$before = ''; |
1467 |
} |
1467 |
} |
1468 |
if ($after =~ /\s*\\end{$env[*]?}/) { # Must NOT use the s///o option!!! |
1468 |
if ($after =~ /\s*\\end\{$env[*]?\}/) { # Must NOT use the s///o option!!! |
1469 |
($contents, $after) = ($`, $'); |
1469 |
($contents, $after) = ($`, $'); |
1470 |
$contents =~ s/^\n+/\n/s; |
1470 |
$contents =~ s/^\n+/\n/s; |
1471 |
# $contents =~ s/\n+$//s; |
1471 |
# $contents =~ s/\n+$//s; |
Lines 1898-1913
sub mark_string {
Link Here
|
1898 |
# local (*_) = @_; # Modifies $_ in the caller; |
1898 |
# local (*_) = @_; # Modifies $_ in the caller; |
1899 |
# -> MRO: changed to $_[0] (same effect) |
1899 |
# -> MRO: changed to $_[0] (same effect) |
1900 |
# MRO: removed deprecated $*, replaced by option /m |
1900 |
# MRO: removed deprecated $*, replaced by option /m |
1901 |
$_[0] =~ s/(^|[^\\])\\{/$1tex2html_escaped_opening_bracket/gom; |
1901 |
$_[0] =~ s/(^|[^\\])\\\{/$1tex2html_escaped_opening_bracket/gom; |
1902 |
$_[0] =~ s/(^|[^\\])\\{/$1tex2html_escaped_opening_bracket/gom; # repeat this |
1902 |
$_[0] =~ s/(^|[^\\])\\\{/$1tex2html_escaped_opening_bracket/gom; # repeat this |
1903 |
$_[0] =~ s/(^|[^\\])\\}/$1tex2html_escaped_closing_bracket/gom; |
1903 |
$_[0] =~ s/(^|[^\\])\\\}/$1tex2html_escaped_closing_bracket/gom; |
1904 |
$_[0] =~ s/(^|[^\\])\\}/$1tex2html_escaped_closing_bracket/gom; # repeat this |
1904 |
$_[0] =~ s/(^|[^\\])\\\}/$1tex2html_escaped_closing_bracket/gom; # repeat this |
1905 |
my $id = $global{'max_id'}; |
1905 |
my $id = $global{'max_id'}; |
1906 |
my $prev_id = $id; |
1906 |
my $prev_id = $id; |
1907 |
# mark all balanced braces |
1907 |
# mark all balanced braces |
1908 |
# MRO: This should in fact mark all of them as the hierarchy is |
1908 |
# MRO: This should in fact mark all of them as the hierarchy is |
1909 |
# processed inside-out. |
1909 |
# processed inside-out. |
1910 |
1 while($_[0] =~ s/{([^{}]*)}/join("",$O,++$id,$C,$1,$O,$id,$C)/geo); |
1910 |
1 while($_[0] =~ s/\{([^{}]*)\}/join("",$O,++$id,$C,$1,$O,$id,$C)/geo); |
1911 |
# What follows seems esoteric... |
1911 |
# What follows seems esoteric... |
1912 |
my @processedB = (); |
1912 |
my @processedB = (); |
1913 |
# Take one opening brace at a time |
1913 |
# Take one opening brace at a time |
Lines 1922-1928
sub mark_string {
Link Here
|
1922 |
} |
1922 |
} |
1923 |
$_[0] = join('',$before,"\{",$after) if($change); |
1923 |
$_[0] = join('',$before,"\{",$after) if($change); |
1924 |
# MRO: mark one opening brace |
1924 |
# MRO: mark one opening brace |
1925 |
if($_[0] =~ s/^([^{]*){/push(@processedB,$1);join('',$O,++$id,$C)/eos) { |
1925 |
if($_[0] =~ s/^([^{]*)\{/push(@processedB,$1);join('',$O,++$id,$C)/eos) { |
1926 |
$before=''; $after=$'; |
1926 |
$before=''; $after=$'; |
1927 |
} |
1927 |
} |
1928 |
if ($after =~ /\}/) { |
1928 |
if ($after =~ /\}/) { |
Lines 2780-2786
sub translate_environments {
Link Here
|
2780 |
$open_tags_R = [ @save_open_tags ]; |
2780 |
$open_tags_R = [ @save_open_tags ]; |
2781 |
# check for color |
2781 |
# check for color |
2782 |
local($color_test) = join(',',@$open_tags_R); |
2782 |
local($color_test) = join(',',@$open_tags_R); |
2783 |
if ($color_test =~ /(color{[^}]*})/g ) { |
2783 |
if ($color_test =~ /(color\{[^}]*\})/g ) { |
2784 |
$color_env = $1; |
2784 |
$color_env = $1; |
2785 |
} # else { $color_env = '' } |
2785 |
} # else { $color_env = '' } |
2786 |
|
2786 |
|
Lines 2791-2797
sub translate_environments {
Link Here
|
2791 |
$open_tags_R = [ @save_open_tags ]; |
2791 |
$open_tags_R = [ @save_open_tags ]; |
2792 |
if ($color_env) { |
2792 |
if ($color_env) { |
2793 |
$color_test = join(',',@saved_tags); |
2793 |
$color_test = join(',',@saved_tags); |
2794 |
if ($color_test =~ /(color{[^}]*})/g ) { |
2794 |
if ($color_test =~ /(color\{[^}]*\})/g ) { |
2795 |
$color_env = $1; |
2795 |
$color_env = $1; |
2796 |
} |
2796 |
} |
2797 |
} |
2797 |
} |
Lines 6507-6513
sub parse_keyvalues {
Link Here
|
6507 |
print "\nATTRIBS: $saved\n" if ($VERBOSITY > 6); |
6507 |
print "\nATTRIBS: $saved\n" if ($VERBOSITY > 6); |
6508 |
|
6508 |
|
6509 |
$saved =~ s/$percent_mark/%/g; |
6509 |
$saved =~ s/$percent_mark/%/g; |
6510 |
$saved =~ s/((^|[\s,=])')\\\W{(\w)}/$1$3/g |
6510 |
$saved =~ s/((^|[\s,=])')\\\W\{(\w)\}/$1$3/g |
6511 |
if $is_german; #unwanted accents, from active " |
6511 |
if $is_german; #unwanted accents, from active " |
6512 |
if (@tags) { |
6512 |
if (@tags) { |
6513 |
foreach $tag (@tags) { |
6513 |
foreach $tag (@tags) { |
Lines 6877-6883
sub make_latex{
Link Here
|
6877 |
# \usepackage is invalid in LaTeX 2.09 and LaTeX-2e compatibility mode |
6877 |
# \usepackage is invalid in LaTeX 2.09 and LaTeX-2e compatibility mode |
6878 |
$LATEX_COLOR = ''; $LOAD_LATEX_COLOR = ''; |
6878 |
$LATEX_COLOR = ''; $LOAD_LATEX_COLOR = ''; |
6879 |
# ... so is \providecommand |
6879 |
# ... so is \providecommand |
6880 |
$preamble =~ s/\\documentstyle[^{]*{[^}]*}\n?/ |
6880 |
$preamble =~ s/\\documentstyle[^{]*\{[^}]*\}\n?/ |
6881 |
$&."\n\\let\\providecommand\\newcommand\n"/eo; |
6881 |
$&."\n\\let\\providecommand\\newcommand\n"/eo; |
6882 |
} |
6882 |
} |
6883 |
|
6883 |
|
Lines 7292-7298
sub encode_title {
Link Here
|
7292 |
sub encode { |
7292 |
sub encode { |
7293 |
local($_) = @_; |
7293 |
local($_) = @_; |
7294 |
# Remove invocation-specific stuff |
7294 |
# Remove invocation-specific stuff |
7295 |
1 while(s/\\(begin|end)\s*(($O|$OP)\d+($C|$CP))?|{?tex2html_(wrap|nowrap|deferred|)(_\w+)?}?(\2)?//go); |
7295 |
1 while(s/\\(begin|end)\s*(($O|$OP)\d+($C|$CP))?|\{?tex2html_(wrap|nowrap|deferred|)(_\w+)?\}?(\2)?//go); |
7296 |
$_ = &revert_to_raw_tex($_); |
7296 |
$_ = &revert_to_raw_tex($_); |
7297 |
s/\\protect//g; # remove redundant \protect macros |
7297 |
s/\\protect//g; # remove redundant \protect macros |
7298 |
#$_ = pack("u*", $_); # uuencode |
7298 |
#$_ = pack("u*", $_); # uuencode |