- DOCUMENTS = report
- PDF_DOCUMENTS = _site/report.pdf
- include _make/*.mk
- 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_md = $(strip $(or \
- $(call _which,delta,--paging never --default-language md),\
- $(call _which,git,--no-pager diff --no-index),\
- diff -u))
- DIFF_html = $(strip $(or \
- $(call _which,delta,--paging never --default-language html),\
- $(call _which,git,--no-pager diff --no-index),\
- diff -u))
- DIFF_json = $(strip $(or \
- $(call _which,delta,--paging never --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
- #PANDOC = quarto pandoc --from commonmark
- SYNTAX_DIAGRAMS := $(patsubst %.py,%.svg,$(wildcard syntax/*.py))
- WORKFLOW_DIAGRAMS := $(patsubst %.cwl,%.svg,$(wildcard workflow/phase*.cwl))
- RAPPER = rapper -i rdfa
- #RAPPER += -f relativeURIs
- # implicit namespaces at <https://www.w3.org/2011/rdfa-context/rdfa-1.1>
- NS += foaf=http://xmlns.com/foaf/0.1/
- NS += rdfa=http://www.w3.org/ns/rdfa\#
- NS += rdfs=http://www.w3.org/2000/01/rdf-schema\#
- NS += schema=http://schema.org/
- NS += wd=https://www.wikidata.org/entity/
- NS += bibo=http://purl.org/ontology/bibo/
- NS += ov=http://open.vocab.org/terms/
- RAPPER += $(foreach s,$(NS),$(let a b,$(subst =, $(),$s), -f 'xmlns:$a="$b"'))
- _site/report.pdf: $(wildcard _*.qmd) $(SYNTAX_DIAGRAMS) $(WORKFLOW_DIAGRAMS)
- $(SYNTAX_DIAGRAMS): %.svg: %.py
- python3 $< > $@
- $(WORKFLOW_DIAGRAMS): %.svg: %.cwl
- cwltool --print-dot $< \
- | gvpr -f workflow/rotate.gvpr \
- | perl -pe 's/phase\d_//g;' \
- -e 's/label=\K[^\s",]+|translate_to_\w+/ "\"".join(" ", split(m{_}, $$&))."\"" /ge' \
- | dot -Tsvg > $@
- check: $(DIFFTESTS:%=check-native-%)
- $(strip luacheck --quiet --std none \
- --read-globals assert error ipairs os type pandoc PANDOC_VERSION \
- -- $(FILTER))
- $(DIFFTESTS:%=check-md-%): check-md-%: %.md %.md.md
- -$(strip $(PANDOC) --to commonmark --lua-filter $(FILTER) --wrap preserve < $< \
- | $(DIFF_md) $*.md.md /dev/stdin)
- $(DIFFTESTS:%=check-html-%): check-html-%: %.md
- -$(strip $(PANDOC) --lua-filter $(FILTER) --wrap preserve < $< \
- | $(DIFF_html) $*.plain.html /dev/stdin)
- $(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 $<)
- $(DIFFTESTS:%=xmp-from-%): xmp-from-%: %.rdfa.html
- $(RAPPER) -o rdfxml-xmp $< $(dir $<)
- code.zip: sem-md/ Makefile README.md _make/ syntax/ test/
- git archive -o $@ HEAD $^
- .PHONY: check \
- $(foreach x,\
- check-md check-html check-native delta-native dump-native turtle-from xmp-from,\
- $(DIFFTESTS:%=$x-%))
|