From 130959973a9a8750dbaa63ab3cf04bb39d91fe7f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 27 Dec 2014 21:17:08 -0800 Subject: Makefile: Added spec target with check of internal links/anchors. --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6723f2e..7110998 100644 --- a/Makefile +++ b/Makefile @@ -175,6 +175,14 @@ dingus: js/commonmark.js spec.md: $(SPEC) perl spec2md.pl < $< > $@ +spec: spec.html + @anchors=`perl -ne '@matches = / id="([^"]*)"/g; foreach $$match (@matches) { print "$$match\n"; }' $<`; \ + links=`perl -ne '@matches = / href="#([^"]*)"/g; foreach $$match (@matches) { print "$$match\n"; }' $<`; \ + for link in $$links; do \ + [[ $$anchors =~ $$link ]] || \ + echo "Link to missing anchor #$$link"; \ + done + spec.html: spec.md template.html pandoc --no-highlight --number-sections --template template.html -s --toc -S $< | \ perl -pe 's/a href="@([^"]*)"/a id="\1" href="#\1" class="definition"/g' | \ @@ -189,8 +197,8 @@ spec.pdf: spec.md template.tex specfilter.hs ### Website ### -update-site: spec.html js/commonmark.js +update-site: spec js/commonmark.js make -C $(SITE) update -upload-site: spec.html +upload-site: spec js/commonmark.js make -C $(SITE) upload -- cgit v1.2.3