text-crossrefs: Typst + testing, coding and documentation improvements

This commit is contained in:
Bastien Dumont
2025-12-21 16:59:06 +01:00
parent 078b6ae71e
commit af22b6e167
15 changed files with 3236 additions and 207 deletions

View File

@ -4,7 +4,12 @@ SHELL=/bin/bash
return_statement_line_number := $(shell grep -nE '^return' text-crossrefs.lua | cut -d ':' -f 1)
line_before_return := $(shell echo $$(($(return_statement_line_number) - 1)))
test-all: test-internal test-context test-latex test-opendocument
README.pdf: README.md
sed -E 's/(C?[Lo]?[an]?TeXt?)/\\\1{}/g' $< | \
sed '7s/^/\\def\\ConTeXt{C\\kern-.0333em on\\kern-.0667em\\TeX\\kern-.0333em t}\\pagebreak /' | \
pandoc -M colorlinks=true --toc -N --syntax-highlighting=none -o $@
test-all: test-internal test-context test-latex test-opendocument test-typst
test-internal: text-crossrefs.lua
-rm --interactive=never test/tmp.lua
@ -15,9 +20,15 @@ test-internal: text-crossrefs.lua
@echo -e '==========================\nAll internal tests passed.\n==========================\n'
rm --interactive=never test/tmp.lua
samples := '' -with-options
test-%: text-crossrefs.lua sample.md
TESTED_FORMAT=$* pandoc -t native -L text-crossrefs.lua sample.md > test/tmp-$*.native
diff test/tmp-$*.native test/sample-$*.native
@echo -e '\n===============\ntest passed.\n===============\n'
rm test/tmp-$*.native
@$(foreach suffix,$(samples), \
TESTED_FORMAT=$* pandoc -t native -L text-crossrefs.lua sample$(suffix).md > test/tmp-$*$(suffix).native ;\
diff test/tmp-$*$(suffix).native test/sample-$*$(suffix).native ;\
if [[ $$? == 0 ]]; then \
echo -e '\n=== $*$(suffix): passed\n' ;\
else \
echo -e '\n=== $*$(suffix): FAILED\n' ;\
fi ;\
rm test/tmp-$*$(suffix).native ;\
)