diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 10:11:48 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 10:11:48 +0200 |
| commit | cd46163fa347bbc49bf8008d70d408f62feabda5 (patch) | |
| tree | 36d3b7e910dfafe7740b12e6b206cd3b9c089d1e /man/colitur-templates.5 | |
| parent | 6aebb3ec513c0177a39c2eb8d4b741e90d6f53f4 (diff) | |
| download | colitur-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 'man/colitur-templates.5')
| -rw-r--r-- | man/colitur-templates.5 | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/man/colitur-templates.5 b/man/colitur-templates.5 index 06ad583..e04560b 100644 --- a/man/colitur-templates.5 +++ b/man/colitur-templates.5 @@ -303,9 +303,9 @@ same file exactly as any other tag would). selects how an interpolated .I value is escaped before being written. It never touches the template's own literal -markup (the LaTeX, groff, HTML, XML or ICS surrounding a +markup (the LaTeX, Typst, groff, HTML, XML or ICS surrounding a .BR {{tag}} ), -which is the template author's and is trusted exactly as written. One of six: +which is the template author's and is trusted exactly as written. One of seven: .TP .B latex .BR \e " \(-> " \etextbackslash{} , @@ -320,6 +320,42 @@ which is the template author's and is trusted exactly as written. One of six: .BR ~ " \(-> " \etextasciitilde{} . Every LaTeX special character is covered; nothing else is touched. .TP +.B typst +.BR \e " \(-> " \e\e , +.BR # " \(-> " \e# , +.BR * " \(-> " \e* , +.BR _ " \(-> " \e_ , +.BR $ " \(-> " \e$ , +.BR @ " \(-> " \e@ , +.BR < " \(-> " \e< , +.BR > " \(-> " \e> , +.BR \(ga " \(-> " \e\(ga , +.BR ~ " \(-> " \e~ , +.BR \- " \(-> " \e\- . +Verified against the installed +.B typst +binary rather than assumed: each escaped character was confirmed to survive +as the literal character, and each was separately confirmed to do something +else when left bare +.RB ( # " opens code mode, " * / _ " toggle strong/emph, " $ " opens math, " +.B @ +opens a reference \(em a bare unresolved +.B @word +is a hard +.B typst +compile error, not merely mangled output \(em +.BR < / > " can close around a bare word into label syntax that swallows it, " +.B \(ga +opens raw text, and +.B ~ +is a non\-breaking space). A run of two or three unescaped hyphens becomes an +en or em dash; every +.B \- +is escaped unconditionally, not only inside a detected run, since escaping +is applied one character at a time with no lookahead \(em confirmed live that +escaping every hyphen independently still typesets as literal hyphens for a +run of any length. +.TP .B groff A backslash is escaped to .BR \ee , @@ -373,6 +409,7 @@ own file extension when the flag is omitted: .nf .I .tex \(-> latex +.I .typ \(-> typst .I .ms .mom .me \(-> groff .I .html .htm \(-> html .I .xml \(-> xml @@ -385,7 +422,7 @@ An extension .B colitur does not recognise is a hard .B ERROR -naming the six flavours above; it is +naming the seven flavours above; it is .I never a silent fallback to .BR none . @@ -401,7 +438,7 @@ flavour (selected for as well as .IR .txt ) passes every interpolated value through unchanged. This is a deliberate -choice, not a gap: unlike LaTeX, groff, HTML, XML or ICS, AsciiDoc and +choice, not a gap: unlike LaTeX, Typst, groff, HTML, XML or ICS, AsciiDoc and Markdown have no fixed, small metacharacter set that could be escaped mechanically \(em their own metacharacters are context\-dependent (a .B * |
