summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-27 21:17:08 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-27 21:18:20 -0800
commit130959973a9a8750dbaa63ab3cf04bb39d91fe7f (patch)
tree7d48ff7ddadf4f8e4649ba3130bad2774cb0b77c /Makefile
parenta95ebf82d2f91858079f65daf71f6a89e9e383ae (diff)
Makefile: Added spec target with check of internal links/anchors.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files 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