Commit cd05ec78 authored by Agustin Martin Domingo's avatar Agustin Martin Domingo

fmt_latex2e.pl: Handle perl 5.22 deprecation of unescaped left brace in regular expressions.

This is to deal with new perl 5.22 warnings like

 Unescaped left brace in regex is deprecated, passed through in regex;
 marked by <-- HERE in m/\\nameurl{ <-- HERE (.*)}{(.*)}/
 at /usr/share/linuxdoc-tools/fmt/fmt_latex2e.pl line 287.

For consistency, right brackets are also escaped, although they
currently don't trigger any warning.
Signed-off-by: default avatarAgustin Martin Domingo <agmartin@debian.org>
parent 906bd64f
...@@ -284,11 +284,11 @@ $latex2e->{postASP} = sub ...@@ -284,11 +284,11 @@ $latex2e->{postASP} = sub
push @texlines, $_; push @texlines, $_;
# and check for nameurl # and check for nameurl
if ( /\\nameurl/ ){ if ( /\\nameurl/ ){
($urlid, $urlnam) = ($_ =~ /\\nameurl{(.*)}{(.*)}/); ($urlid, $urlnam) = ($_ =~ /\\nameurl\{(.*)\}\{(.*)\}/);
print $urlnum . ": " . $urlid . "\n" if ( $global->{debug} ); print $urlnum . ": " . $urlid . "\n" if ( $global->{debug} );
$urldef = latex2e_defnam($urlnum) . "url"; $urldef = latex2e_defnam($urlnum) . "url";
s/\\nameurl{.*}{.*}/{\\em $urlnam} {\\tt \\$urldef}/; s/\\nameurl\{.*\}\{.*\}/{\\em $urlnam} {\\tt \\$urldef}/;
push @urlnames, $_; push @urlnames, $_;
push @urldefines, "\\urldef{\\$urldef} \\url{$urlid}\n"; push @urldefines, "\\urldef{\\$urldef} \\url{$urlid}\n";
$urlnum++; $urlnum++;
...@@ -367,12 +367,12 @@ $latex2e->{postASP} = sub ...@@ -367,12 +367,12 @@ $latex2e->{postASP} = sub
$_ = $_ . "\\makeindex\n" if ($latex2e->{makeindex}); $_ = $_ . "\\makeindex\n" if ($latex2e->{makeindex});
} }
# Set correct DTD name # Set correct DTD name
elsif (/^\\usepackage{\@LINUXDOC_DTD\@-sgml}/) { elsif (/^\\usepackage\{\@LINUXDOC_DTD\@-sgml\}/) {
my $dtd = $global->{"dtd"}; my $dtd = $global->{"dtd"};
s/\@LINUXDOC_DTD\@/$dtd/; s/\@LINUXDOC_DTD\@/$dtd/;
} }
# Set correct babel options # Set correct babel options
elsif (/^\\usepackage\[\@BABELOPTIONS\@\]{babel}/) { elsif (/^\\usepackage\[\@BABELOPTIONS\@\]\{babel\}/) {
if ( $babeloptions ) { if ( $babeloptions ) {
s/\@BABELOPTIONS\@/$babeloptions/; s/\@BABELOPTIONS\@/$babeloptions/;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment