Skip to content

Commit

Permalink
Properly escape curly braces in regular expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
iblech committed Oct 27, 2017
1 parent 77d4431 commit 5d58ab8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sshlatex
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ function texdeps {
# Of course, this crude heuristic does not cover all cases --
# the general case is intractable, since LaTeX is Turing
# complete. :-)
if($line =~ /$commands/ and $line =~ /\\newcommand{?\\(\w+)}?/) {
if($line =~ /$commands/ and $line =~ /\\newcommand\{?\\(\w+)\}?/) {
$commands .= "|$1";
}
if($line =~ /\\graphicspath{({.*?})+}/) {
if($line =~ /\\graphicspath\{(\{.*?\})+\}/) {
push @dirs, map { "$_/" } grep { length $_ > 0 } split /[{}]/, $1;
}
for my $dep ($line =~ /\\(?:$commands)(?:\[[^\]]*\])?{([^}]+)}/) {
for my $dep ($line =~ /\\(?:$commands)(?:\[[^\]]*\])?\{([^\}]+)\}/) {
# pdf_t is the default extension for the combined LaTeX/PDF export of xfig
for("", qw< .png .jpeg .jpg .pdf .tex .cls .sty .bbl .bib .pdf_t >) {
for my $dir (@dirs) {
Expand Down

0 comments on commit 5d58ab8

Please sign in to comment.