Skip to content

Commit 016cc2d

Browse files
committed
[check] Detect hanging paragraphs.
2 parents 2fe6255 + b5409e6 commit 016cc2d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/check.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ for f in $texfiles; do
8585
sed 's/$/ <--- "shall" inside a note/'
8686
done | grep . && exit 1
8787

88+
# Hanging paragraphs
89+
for f in $texfiles; do
90+
sed -n '/^\\rSec/{=;p};/^[^\\]/{s/^.*$/x/;=;p}' $f |
91+
# prefix output with filename and line
92+
sed '/^[0-9]\+$/{N;s/\n/:/}' | sed "s/.*/$f:&/" |
93+
awk -F: 'BEGIN { prevlevel = 0 } $3 ~ /^\\rSec./ { match($3, "[0-9]"); level=substr($3, RSTART, 1); if (text && level > prevlevel) { print prevsec " <-- Hanging paragraph follows" } prevlevel = level; prevsec = $3; text = 0 } $3 == "x" { text = 1 }'
94+
done | grep . && exit 1
95+
8896
# Library descriptive macros not immediately preceded by \pnum.
8997
for f in $texlibdesc; do
9098
sed -n '/^\\pnum/{h;:x;n;/^\\index/b x;/^\\\(constraints\|mandates\|expects\|effects\|sync\|ensures\|returns\|throws\|complexity\|remarks\|errors\)/{x;/\n/{x;=;p};d};/^\\pnum/D;H;b x}' $f |

0 commit comments

Comments
 (0)