aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-06-21 11:39:27 +0200
committerJonas Smedegaard <dr@jones.dk>2025-06-21 17:50:44 +0200
commit71042970c0cdb0cf2d247e209f26cdcc3c4b5bbe (patch)
tree4a12b863cfd36bd43d24f95af91dc1c3e19f2d8a /Makefile
parent8d6eb3d62147aa632ca085549c8b56c9053249b1 (diff)
change make check-* targets, and refine coloring
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 30 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index f02b1c0..575f9b5 100644
--- a/Makefile
+++ b/Makefile
@@ -9,10 +9,18 @@ FILTER = sem-md/sem-md.lua
DIFFTESTS = $(patsubst %.md.md,%,$(wildcard test/*.md.md))
_which = $(shell command -v $1 >/dev/null 2>&1 && echo $1 $2)
-DIFF = $(strip $(or \
+DIFF_md = $(strip $(or \
$(call _which,delta,--default-language md),\
$(call _which,git,--no-pager diff --no-index),\
diff -u))
+DIFF_html = $(strip $(or \
+ $(call _which,delta,--default-language html),\
+ $(call _which,git,--no-pager diff --no-index),\
+ diff -u))
+DIFF_json = $(strip $(or \
+ $(call _which,delta,--default-language json),\
+ $(call _which,git,--no-pager diff --no-index),\
+ diff -u))
#PANDOC = pandoc -f markdown+fenced_divs+bracketed_spans-auto_identifiers
PANDOC = pandoc --from commonmark
@@ -50,25 +58,32 @@ $(WORKFLOW_DIAGRAMS): %.svg: %.cwl
-e 's/label=\K[^\s",]+|translate_to_\w+/ "\"".join(" ", split(m{_}, $$&))."\"" /ge' \
| dot -Tsvg > $@
-check: $(DIFFTESTS:%=check-%)
+check: $(DIFFTESTS:%=check-md-%)
luacheck --quiet $(FILTER)
-#$(DIFFTESTS:%=check-%): check-%: %.md
-# -$(strip $(PANDOC) --lua-filter $(FILTER) --wrap preserve < $< \
-# | $(DIFF) $*.plain.html /dev/stdin)
-$(DIFFTESTS:%=check-%): check-%: %.md %.md.md
+$(DIFFTESTS:%=check-md-%): check-md-%: %.md %.md.md
-$(strip $(PANDOC) --to commonmark --lua-filter $(FILTER) --wrap preserve < $< \
- | $(DIFF) $*.md.md /dev/stdin)
+ | $(DIFF_md) $*.md.md /dev/stdin)
-$(DIFFTESTS:%=debug-%): debug-%: %.md
- $(PANDOC) --to native --lua-filter $(FILTER) < $<
+$(DIFFTESTS:%=check-html-%): check-html-%: %.md
+ -$(strip $(PANDOC) --lua-filter $(FILTER) --wrap preserve < $< \
+ | $(DIFF_html) $*.plain.html /dev/stdin)
-$(DIFFTESTS:%=debugdiff-%): SHELL = /bin/bash
-$(DIFFTESTS:%=debugdiff-%): debugdiff-%: %.md
- -$(strip $(DIFF) \
- <($(PANDOC) --to native < $<) \
+$(DIFFTESTS:%=check-native-%): SHELL = /bin/bash
+$(DIFFTESTS:%=check-native-%): check-native-%: %.md
+ -$(strip $(DIFF_json) \
+ <($(if $(wildcard $*.native),cat $*.native,$(PANDOC) --to native < $*.md.md)) \
<($(PANDOC) --to native --lua-filter $(FILTER) < $<))
+$(DIFFTESTS:%=delta-native-%): SHELL = /bin/bash
+$(DIFFTESTS:%=delta-native-%): delta-native-%: %.md.md %.native
+ -$(strip $(DIFF_json) \
+ <($(PANDOC) --to native < $*.md.md) \
+ <(cat $*.native))
+
+$(DIFFTESTS:%=dump-native-%): dump-native-%: %.md
+ $(PANDOC) --to native --lua-filter $(FILTER) < $<
+
$(DIFFTESTS:%=turtle-from-%): turtle-from-%: %.rdfa.html
$(RAPPER) -o turtle $< $(dir $<)
@@ -79,5 +94,6 @@ code.zip: sem-md/ Makefile README.md _make/ syntax/ test/
git archive -o $@ HEAD $^
.PHONY: check \
- $(foreach x,check debug debugdiff turtle-from xmp-from,\
+ $(foreach x,\
+ check-md check-html check-native delta-native dump-native turtle-from xmp-from,\
$(DIFFTESTS:%=$x-%))