From 71042970c0cdb0cf2d247e209f26cdcc3c4b5bbe Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 21 Jun 2025 11:39:27 +0200 Subject: change make check-* targets, and refine coloring --- Makefile | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'Makefile') 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-%)) -- cgit v1.2.3