diff options
author | Akira Yokosawa <akiyks@gmail.com> | 2023-03-05 08:40:47 +0900 |
---|---|---|
committer | Akira Yokosawa <akiyks@gmail.com> | 2023-03-05 16:00:50 +0900 |
commit | 4081f4dd8dfff8e88eb8f6514c8485f5242604e4 (patch) | |
tree | 27900fde668903efe77d3c4354b80ea5049bcad3 /utilities | |
parent | 70087288387efc2f9f3ccca17b6920e8d73027ef (diff) | |
download | perfbook-4081f4dd8dfff8e88eb8f6514c8485f5242604e4.tar.gz |
Makefile: Move CREFPAIR check into cleverefcheck.sh
"grep -z" in CREFPAIR runs before precheck.sh, and "make precheck"
doesn't work as expected if grep doesn't recognize the -z option.
The test at perfbook_flat.tex is to prevent known-to-fail latex runs.
Positive CREFPAIR won't cause fatal error in latex runs and doing
the check after the fact should be safe.
Remove "grep -z" from Makefile and do the check in cleverefcheck.sh.
Allow alternative name for grep via make/env variable "GREP" for
this script.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/cleverefcheck.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/utilities/cleverefcheck.sh b/utilities/cleverefcheck.sh index 33f50ba7..893031dd 100755 --- a/utilities/cleverefcheck.sh +++ b/utilities/cleverefcheck.sh @@ -1,5 +1,8 @@ #!/bin/sh +: ${GREP:=grep} +CREFPTN='\\[Cc](ln)?ref[{][^}]+}\s*[{][^}]+}' + tex_sources_all=`find . -name "*.tex" -print` tex_sources="" @@ -21,4 +24,15 @@ done for g in $tex_sources do utilities/cleverefcheck.pl $g + if $GREP -q -zo -E $CREFPTN $g ; then + echo "------" ; + if $GREP -q -E $CREFPTN $g ; then + $GREP -n -B 2 -A 2 -E $CREFPTN $g + else + $GREP -zo -B 2 -A 2 -E $CREFPTN $g + echo + fi + echo "------" + echo "Need to use \[Cc]refrange or \[Cc]lnrefrange in $g." + fi done |