summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 10:07:15 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 10:07:37 +0200
commit6aebb3ec513c0177a39c2eb8d4b741e90d6f53f4 (patch)
tree3fb327d0b3fa9ffd67d493c7393cdf9a963bf8b9 /Makefile
parent66543815ae6cbf6e576a889c9291678744243953 (diff)
downloadcolitur-6aebb3ec513c0177a39c2eb8d4b741e90d6f53f4.tar.gz
colitur-6aebb3ec513c0177a39c2eb8d4b741e90d6f53f4.zip
feat(templates): ordo booklet and wall calendar in Typst
Adds templates/ef/ordo.typ (A5, one week per page, each day framed with a colour swatch, real names, every fixed string through term.*) and templates/ef/grid.typ (A4 landscape, one month per page, 7 columns, colour-filled cells, Epistle/Gospel sigla), matching what ordo.tex and grid.tex already do. Typst resolves its own table of contents inside a single compile: no pageref/aux-file dance, unlike pdflatex's own two-pass need for ordo.tex. ordo.typ's TOC is one flat heading per week (Month . Week N) rather than ordo.tex's own month-once/weeks-nested layout, since the view model has no first-of-month flag for a template to test and inventing one would be new engine state for a cosmetic grouping. grid.typ deliberately diverges from grid.tex's own partial-fill behaviour for a 5-week month: Typst's row-size list repeats its own last entry for every remaining row, so a two-entry rows spec fills the page completely regardless of week count, where LaTeX's fixed cellh leaves a 5-week month's bottom sixth blank on purpose. Both divergences are documented in the templates' own headers. Two bugs found and fixed while building these against the real typst 0.14.2 binary: two stray hash characters in grid.typ's header comment that were not actually inside a line-comment (would have been parsed as Typst code, not prose); and two lines merging into one wherever they were separated only by a bare newline (still the same soft-wrapped paragraph in Typst, unlike LaTeX's own explicit paragraph break) -- fixed with a trailing backslash to force a real line break without adding inter-paragraph spacing, verified against a full-year render (zero typst warnings across all 365 days of 2027, in both templates). Goldens (test/golden/ordo-2027.typ, test/golden/grid-2027.typ) were generated through the harness's own View.of_days/Template.render_string path, via a throwaway generator, NOT through the CLI: the CLI's default language table differs from the harness's own English-chained-to-Latin table, confirmed live (diffing CLI output against the harness's own render showed exactly the expected language divergence and nothing else) -- the same trap this project has hit before. make check-templates now typesets both templates with the typst binary, using the same SKIPPED-and-exit-0 shape the pdflatex/groff blocks already use when their own tool is absent, verified in both directions: absent (PATH without typst) skips loudly and exits 0, and a deliberately corrupted template fails the target with a non-zero exit and typst's own error text.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 23 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 6ba81ba..f1930f9 100644
--- a/Makefile
+++ b/Makefile
@@ -46,14 +46,14 @@ check-schema: build ## validate emitted XML against schema/colitur-v1.xsd (needs
# Typesets every shipped template through the real tool that would typeset it
# for a reader, not merely through this program's own renderer. The golden
-# tests already prove `colitur table` PRODUCES the expected LaTeX/groff/HTML
-# text; only this proves that text actually TYPESETS -- a template can render
-# byte-for-byte as pinned and still be malformed LaTeX or groff. Each tool is
-# genuinely optional (neither is in colitur's own frozen deps), so absence is
-# printed LOUDLY as SKIPPED rather than silently treated as a pass -- a
-# silent skip reads as a pass, which is the whole failure mode this guards
-# against.
-check-templates: build ## typeset every shipped template (needs pdflatex/groff; skipped if absent)
+# tests already prove `colitur table` PRODUCES the expected LaTeX/groff/HTML/
+# Typst text; only this proves that text actually TYPESETS -- a template can
+# render byte-for-byte as pinned and still be malformed LaTeX, groff or
+# Typst. Each tool is genuinely optional (none is in colitur's own frozen
+# deps), so absence is printed LOUDLY as SKIPPED rather than silently
+# treated as a pass -- a silent skip reads as a pass, which is the whole
+# failure mode this guards against.
+check-templates: build ## typeset every shipped template (needs pdflatex/groff/typst; skipped per-tool if absent)
@ok=1; \
if command -v pdflatex >/dev/null 2>&1; then \
for t in ordo grid; do \
@@ -84,6 +84,21 @@ check-templates: build ## typeset every shipped template (needs pdflatex/groff;
fi; \
done; \
else echo "SKIPPED: groff not installed -- groff templates render but are NOT typeset"; fi; \
+ if command -v typst >/dev/null 2>&1; then \
+ for t in ordo grid; do \
+ if opam exec -- dune exec colitur -- table --year 2027 --template templates/ef/$$t.typ \
+ > /tmp/$$t.typ 2>/tmp/$$t-render.err; then \
+ if typst compile /tmp/$$t.typ /tmp/$$t-typst.pdf 2>/tmp/$$t-typst.err; then \
+ echo "typst: $$t.typ OK (one pass -- typst resolves its own"; \
+ echo " table-of-contents page numbers inside a single compile, unlike pdflatex above)"; \
+ else \
+ echo "typst: $$t.typ FAILED:"; cat /tmp/$$t-typst.err; ok=0; \
+ fi; \
+ else \
+ echo "typst: $$t.typ FAILED (colitur table render):"; cat /tmp/$$t-render.err; ok=0; \
+ fi; \
+ done; \
+ else echo "SKIPPED: typst not installed -- Typst templates render but are NOT typeset"; fi; \
test $$ok -eq 1
# lang/la.ini's own discipline: every celebration/season/rank name cites the