Update regular expressions to work with perl 5.26 Perl 5.26 requires escaping braces in regular expressions. diff --git a/latex2html.pin b/latex2html.pin index d670c0d..9981a77 100644 --- a/latex2html.pin +++ b/latex2html.pin @@ -1207,7 +1207,7 @@ sub process_ext_file { &slurp_input($file); if ($ext =~ /bbl/) { # remove the \newcommand{\etalchar}{...} since not needed - s/^\\newcommand{\\etalchar}[^\n\r]*[\n\r]+//s; + s/^\\newcommand\{\\etalchar\}[^\n\r]*[\n\r]+//s; } &pre_process; &substitute_meta_cmds if (%new_command || %new_environment); @@ -1401,8 +1401,8 @@ sub pre_process { &replace_html_special_chars; # Remove fake environment which should be invisible to LaTeX2HTML. s/\001//m; - s/[%]end\s*{latexonly}/\001/gom; - s/[%]begin\s*{latexonly}([^\001]*)\001/%/gos; + s/[%]end\s*\{latexonly\}/\001/gom; + s/[%]begin\s*\{latexonly\}([^\001]*)\001/%/gos; s/\001//m; &preprocess_alltt if defined(&preprocess_alltt); @@ -1426,13 +1426,13 @@ sub pre_process { &write_mydb("verbatim", $global{'verbatim_counter'}, $3); "$1$comment_mark".$global{'verbatim_counter'}."\n"/mge; # Remove the htmlonly-environment - s/\\begin\s*{htmlonly}\s*\n?//gom; - s/\\end\s*{htmlonly}\s*\n?//gom; + s/\\begin\s*\{htmlonly\}\s*\n?//gom; + s/\\end\s*\{htmlonly\}\s*\n?//gom; # Remove enviroments which should be invisible to LaTeX2HTML. - s/\n[^%\n]*\\end\s*{latexonly}\s*\n?/\001/gom; - s/((^|\n)[^%\n]*)\\begin\s*{latexonly}([^\001]*)\001/$1/gom; - s/\\end\s*{comment}\s*\n?/\001/gom; - s/\\begin\s*{comment}([^\001]*)\001//gom; + s/\n[^%\n]*\\end\s*\{latexonly\}\s*\n?/\001/gom; + s/((^|\n)[^%\n]*)\\begin\s*\{latexonly\}([^\001]*)\001/$1/gom; + s/\\end\s*\{comment\}\s*\n?/\001/gom; + s/\\begin\s*\{comment\}([^\001]*)\001//gom; # this used to be earlier, but that can create problems with comments &wrap_other_environments if (%other_environments); @@ -1465,7 +1465,7 @@ sub pre_process { push(@processedV,$before); print "'";$before = ''; } - if ($after =~ /\s*\\end{$env[*]?}/) { # Must NOT use the s///o option!!! + if ($after =~ /\s*\\end\{$env[*]?\}/) { # Must NOT use the s///o option!!! ($contents, $after) = ($`, $'); $contents =~ s/^\n+/\n/s; # $contents =~ s/\n+$//s; @@ -1898,16 +1898,16 @@ sub mark_string { # local (*_) = @_; # Modifies $_ in the caller; # -> MRO: changed to $_[0] (same effect) # MRO: removed deprecated $*, replaced by option /m - $_[0] =~ s/(^|[^\\])\\{/$1tex2html_escaped_opening_bracket/gom; - $_[0] =~ s/(^|[^\\])\\{/$1tex2html_escaped_opening_bracket/gom; # repeat this - $_[0] =~ s/(^|[^\\])\\}/$1tex2html_escaped_closing_bracket/gom; - $_[0] =~ s/(^|[^\\])\\}/$1tex2html_escaped_closing_bracket/gom; # repeat this + $_[0] =~ s/(^|[^\\])\\\{/$1tex2html_escaped_opening_bracket/gom; + $_[0] =~ s/(^|[^\\])\\\{/$1tex2html_escaped_opening_bracket/gom; # repeat this + $_[0] =~ s/(^|[^\\])\\\}/$1tex2html_escaped_closing_bracket/gom; + $_[0] =~ s/(^|[^\\])\\\}/$1tex2html_escaped_closing_bracket/gom; # repeat this my $id = $global{'max_id'}; my $prev_id = $id; # mark all balanced braces # MRO: This should in fact mark all of them as the hierarchy is # processed inside-out. - 1 while($_[0] =~ s/{([^{}]*)}/join("",$O,++$id,$C,$1,$O,$id,$C)/geo); + 1 while($_[0] =~ s/\{([^{}]*)\}/join("",$O,++$id,$C,$1,$O,$id,$C)/geo); # What follows seems esoteric... my @processedB = (); # Take one opening brace at a time @@ -1922,7 +1922,7 @@ sub mark_string { } $_[0] = join('',$before,"\{",$after) if($change); # MRO: mark one opening brace - if($_[0] =~ s/^([^{]*){/push(@processedB,$1);join('',$O,++$id,$C)/eos) { + if($_[0] =~ s/^([^{]*)\{/push(@processedB,$1);join('',$O,++$id,$C)/eos) { $before=''; $after=$'; } if ($after =~ /\}/) { @@ -2780,7 +2780,7 @@ sub translate_environments { $open_tags_R = [ @save_open_tags ]; # check for color local($color_test) = join(',',@$open_tags_R); - if ($color_test =~ /(color{[^}]*})/g ) { + if ($color_test =~ /(color\{[^}]*\})/g ) { $color_env = $1; } # else { $color_env = '' } @@ -2791,7 +2791,7 @@ sub translate_environments { $open_tags_R = [ @save_open_tags ]; if ($color_env) { $color_test = join(',',@saved_tags); - if ($color_test =~ /(color{[^}]*})/g ) { + if ($color_test =~ /(color\{[^}]*\})/g ) { $color_env = $1; } } @@ -6507,7 +6507,7 @@ sub parse_keyvalues { print "\nATTRIBS: $saved\n" if ($VERBOSITY > 6); $saved =~ s/$percent_mark/%/g; - $saved =~ s/((^|[\s,=])')\\\W{(\w)}/$1$3/g + $saved =~ s/((^|[\s,=])')\\\W\{(\w)\}/$1$3/g if $is_german; #unwanted accents, from active " if (@tags) { foreach $tag (@tags) { @@ -6877,7 +6877,7 @@ sub make_latex{ # \usepackage is invalid in LaTeX 2.09 and LaTeX-2e compatibility mode $LATEX_COLOR = ''; $LOAD_LATEX_COLOR = ''; # ... so is \providecommand - $preamble =~ s/\\documentstyle[^{]*{[^}]*}\n?/ + $preamble =~ s/\\documentstyle[^{]*\{[^}]*\}\n?/ $&."\n\\let\\providecommand\\newcommand\n"/eo; } @@ -7292,7 +7292,7 @@ sub encode_title { sub encode { local($_) = @_; # Remove invocation-specific stuff - 1 while(s/\\(begin|end)\s*(($O|$OP)\d+($C|$CP))?|{?tex2html_(wrap|nowrap|deferred|)(_\w+)?}?(\2)?//go); + 1 while(s/\\(begin|end)\s*(($O|$OP)\d+($C|$CP))?|\{?tex2html_(wrap|nowrap|deferred|)(_\w+)?\}?(\2)?//go); $_ = &revert_to_raw_tex($_); s/\\protect//g; # remove redundant \protect macros #$_ = pack("u*", $_); # uuencode diff --git a/versions/html3_2.pl b/versions/html3_2.pl index 58429ac..0cb404c 100644 --- a/versions/html3_2.pl +++ b/versions/html3_2.pl @@ -607,7 +607,7 @@ sub process_tabular { if ($color_env) { local($color_test) = join(',',@$open_tags_R); - if ($color_test =~ /(color{[^}]*})/g ) { + if ($color_test =~ /(color\{[^}]*\})/g ) { $color_env = $1; } } diff --git a/versions/html4_0.pl b/versions/html4_0.pl index 57c16e2..e77b090 100644 --- a/versions/html4_0.pl +++ b/versions/html4_0.pl @@ -955,7 +955,7 @@ sub process_tabular { if ($color_env) { local($color_test) = join(',',@$open_tags_R); - if ($color_test =~ /(color{[^}]*})/g ) { + if ($color_test =~ /(color\{[^}]*\})/g ) { $color_env = $1; } } diff --git a/versions/html4_01.pl b/versions/html4_01.pl index 9cc3e31..250b5b0 100644 --- a/versions/html4_01.pl +++ b/versions/html4_01.pl @@ -976,7 +976,7 @@ sub process_tabular { if ($color_env) { local($color_test) = join(',',@$open_tags_R); - if ($color_test =~ /(color{[^}]*})/g ) { + if ($color_test =~ /(color\{[^}]*\})/g ) { $color_env = $1; } } diff --git a/versions/html4_1.pl b/versions/html4_1.pl index 9cc3e31..250b5b0 100644 --- a/versions/html4_1.pl +++ b/versions/html4_1.pl @@ -976,7 +976,7 @@ sub process_tabular { if ($color_env) { local($color_test) = join(',',@$open_tags_R); - if ($color_test =~ /(color{[^}]*})/g ) { + if ($color_test =~ /(color\{[^}]*\})/g ) { $color_env = $1; } }