Skip to content

Commit

Permalink
Merge pull request #365 from quicwg/linecount2
Browse files Browse the repository at this point in the history
Count line length differently
  • Loading branch information
martinthomson committed Mar 7, 2017
2 parents 1bea6b8 + f550e84 commit 21a0b36
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Makefile
Expand Up @@ -11,12 +11,11 @@ endif
latest::
@if grep -l ' $$' *.md; then ! echo "Trailing whitespace found"; fi
@err=0; for f in draft-*.md ; do \
line=$$(cat "$$f" | sed -e 's/[|].*[|]//' | wc -L); \
if [ "$$line" -gt 80 ]; then \
echo "$$f contains a line with >80 ($$line) characters"; err=1; \
if grep -n '^.\{81\}' "$$f"; then \
echo "$$f contains a line with >80 characters"; err=1; \
fi; \
figure=$$(sed -e '/^~~~/,/^~~~/p;d' "$$f" | wc -L); \
if [ "$$figure" -gt 69 ]; then \
echo "$$f contains a figure with >69 ($$figure) characters"; err=1; \
if cat "$$f" | (l=0; while read -r a; do l=$$(($$l + 1)); echo -E "$$l:$$a"; done) | \
sed -e '/^[0-9]*:~~~/,/^[0-9]*:~~~/p;d' | grep '^[0-9]*:.\{70\}'; then \
echo "$$f contains a figure with >69 characters"; err=1; \
fi; \
done; [ "$$err" -eq 0 ]

0 comments on commit 21a0b36

Please sign in to comment.