Skip to content

Commit bc6d64c

Browse files
jensmaurertkoeppe
authored andcommitted
[check] Flag undecorated concept names
1 parent 37189f8 commit bc6d64c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tools/check-output.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,28 @@ cat std-grammarindex.ind |
5050

5151
# Find concept index entries missing a definition
5252
cat std-conceptindex.ind |
53-
sed 's/.hyperindexformat/\nhyperindexformat/' |
53+
sed 's/.hyperindexformat/\nhyperindexformat/;s/.hyperpage/hyperpage/' |
5454
awk 'BEGIN { def=1 } /^ .item/ { if (def==0) { gsub("[{},]", "", item); print item } item=$NF; def=0; next } /hyperindexformat/ { def=1 }' |
5555
sed 's/^\(.*\)$/concept \1 has no definition/' |
5656
fail || failed=1
5757

58+
# Find undecorated concept names in code blocks
59+
patt="`cat std-conceptindex.ind |
60+
sed 's/.hyperindexformat/\nhyperindexformat/;s/.hyperpage/\nhyperpage/' |
61+
sed -n 's/^ .item.*{\([-a-z_]*\)}.*$/\1/p'`"
62+
63+
patt="`echo $patt | sed 's/ /\\\\|/g'`"
64+
# $patt contains all concept names, separated by \| to use as a sed regex
65+
66+
for f in *.tex; do
67+
sed -n 's,//.*$,,;s/%.*$//;s/"[^"]*"/""/;/begin{codeblock\(tu\)\?}/,/end{codeblock\(tu\)\?}/{/[^-_{a-z\]\('"$patt"'\)[^-_}a-z();]/{=;p;};}' $f |
68+
# prefix output with filename and line
69+
sed '/^[0-9]\+$/{N;s/\n/:/;}' | sed "s/.*/$f:&/" |
70+
grep -v "@.seebelow" |
71+
sed "s/\$/ -- concept name without markup/" |
72+
fail || failed=1
73+
done
74+
5875
# Cross references since the previous standard.
5976
function indexentries() { sed 's,\\glossaryentry{\(.*\)@.*,\1,' "$1" | LANG=C sort; }
6077
function removals() { diff -u "$1" "$2" | grep '^-' | grep -v '^---' | sed 's/^-//'; }

0 commit comments

Comments
 (0)