Instead of patterns "\label" and "ref{", use a regex pattern to match "foo:bar:Label String" and do checks after removing label strings. There still remains an assumption that each label string completes within an input line. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- utilities/periodcheck.pl | 13 +++++++++---- utilities/periodcheck.sh | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/utilities/periodcheck.pl b/utilities/periodcheck.pl index c585b147..27871507 100755 --- a/utilities/periodcheck.pl +++ b/utilities/periodcheck.pl @@ -28,8 +28,16 @@ my $Verbatim_begin = qr/\\begin\{Verbatim/ ; my $Verbatim_end = qr/\\end\{Verbatim/ ; my $tabular_begin = qr/\\begin\{tabula/ ; my $tabular_end = qr/\\end\{tabula/ ; +my $label_ptn = qr/(^|\{)(,?[a-z]{3}:[a-zMPS]+:[^\},]+)(\}|,)/ ; sub check_line { + my $line_raw = $line; + if ($line =~ /$label_ptn/) { + while ($line && $line =~ /$label_ptn/) { + my $quoted_2 = quotemeta $2; + $line =~ s/$quoted_2//; + } + } if ($line =~ /$Verbatim_begin/ || $line =~ /$tabular_begin/) { $skip = 1; @@ -49,9 +57,6 @@ sub check_line { } if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z\}]\.\s[^\\]+/) { $safe = 0; - if ($line =~ /ref\{/ || $line =~ /label\{/) { - $safe = 1; - } } if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) { $safe = 0; @@ -60,7 +65,7 @@ sub check_line { } } unless ($safe) { - print $ARGV[0], ':', $line_num, ':', $line; + print $ARGV[0], ':', $line_num, ':', $line_raw; } } if ($line =~ /$Verbatim_end/ || diff --git a/utilities/periodcheck.sh b/utilities/periodcheck.sh index a56657f3..d6cd7510 100755 --- a/utilities/periodcheck.sh +++ b/utilities/periodcheck.sh @@ -8,6 +8,9 @@ do case $f in ./perfbook*) ;; ./qqz*) ;; + ./glsdict.tex) ;; + ./origpub.tex) ;; + ./contrib.tex) ;; ./future/HTMtable*) ;; ./appendix/styleguide*) ;; *) tex_sources="$tex_sources $f" ;; -- 2.17.1