summaryrefslogtreecommitdiff
path: root/test/cli.t
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 10:11:48 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 10:11:48 +0200
commitcd46163fa347bbc49bf8008d70d408f62feabda5 (patch)
tree36d3b7e910dfafe7740b12e6b206cd3b9c089d1e /test/cli.t
parent6aebb3ec513c0177a39c2eb8d4b741e90d6f53f4 (diff)
downloadcolitur-cd46163fa347bbc49bf8008d70d408f62feabda5.tar.gz
colitur-cd46163fa347bbc49bf8008d70d408f62feabda5.zip
fix(cli): close the flavour-list call sites Typst's addition exposed
The task this branch of work set out to test was whether the template engine is genuinely flavour-agnostic outside lib/render/escape.ml. It is not, quite: bin/main.ml's own --flavour error/help text and both man pages hand-typed the flavour list and its count ("the six flavours") as literal prose, so adding Typst as a seventh left three places silently wrong (an incomplete flavour list in two error messages, and "six" where the true count is now seven) until this commit. bin/main.ml's two error messages (unknown --flavour value, and cannot infer a flavour from an extension) now build their flavour list by walking Escape.all/to_string instead of a literal string, so the next flavour added will not reintroduce the same drift; the static --help body text and colitur(1)/colitur-templates(5) still name flavours and their count by hand; there was no equivalent gain available for prose formatted this specifically, so those were updated by hand instead, along with colitur-templates(5)'s FLAVOURS section, which gained typst's own subsection alongside latex/groff/html/xml/ics/none. test/cli.t's two pinned error-text assertions are updated to match, and gained a new case: .typ inferred from extension, and a real shipped citation's hyphen surviving --flavour typst's own escaping live, the same shape the 2035 Ss. Petri et Pauli case already proves for latex's ampersand just above it.
Diffstat (limited to 'test/cli.t')
-rw-r--r--test/cli.t15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/cli.t b/test/cli.t
index 610ce5b..ef1243e 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -621,18 +621,27 @@ An unknown extension with no --flavour is an error, not a silent fallback:
$ printf 'x' > /tmp/t.wat
$ colitur table --year 2027 --template /tmp/t.wat
- colitur: cannot infer a flavour from ".wat"; pass --flavour latex|groff|html|xml|ics|none
+ colitur: cannot infer a flavour from ".wat"; pass --flavour latex|typst|groff|html|xml|ics|none
[2]
$ colitur table --year 2027 --template /tmp/t.wat --flavour none
x
-An unrecognised --flavour value is also an error naming the six valid ones:
+An unrecognised --flavour value is also an error naming the seven valid ones:
$ colitur table --year 2027 --template /tmp/t.txt --flavour bogus
- colitur: unknown flavour "bogus" (want latex, groff, html, xml, ics or none)
+ colitur: unknown flavour "bogus" (want latex, typst, groff, html, xml, ics or none)
[2]
+Typst is inferred from .typ, like every other flavour's own extension.
+Its metacharacters are escaped the same way latex's own is above -- here
+'-', verified live (against the real typst binary) to collapse into an
+en dash if left unescaped; a real shipped citation carries one:
+
+ $ printf '{{#days}}{{first}}\n{{/days}}' > /tmp/t.typ
+ $ colitur table --year 2027 --template /tmp/t.typ | grep -c '11\\-16'
+ 1
+
A malformed template is a clear error, not a crash:
$ printf '{{#days}}oops' > /tmp/bad.txt