aboutsummaryrefslogtreecommitdiff
path: root/test/cli.t
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 16:43:04 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 16:43:04 +0200
commit27606c42b7506ab7ffc7f1bd32d4d4a72c6400c8 (patch)
tree26c132598ef132a38e26b4922a93b9923defa562 /test/cli.t
parent87b155b913cea7f5c55b5a2391aff7819ba541a6 (diff)
downloadcolitur-27606c42b7506ab7ffc7f1bd32d4d4a72c6400c8.tar.gz
colitur-27606c42b7506ab7ffc7f1bd32d4d4a72c6400c8.zip
feat(render): citations render through Sigla at both call sites
View.citation_ref and readings' part_ref are the only two places a citation reaches output; every emitter goes through View. --raw passes Sigla.verbatim rather than a style built over Lang.raw: an identity name table would still reformat punctuation and renumber. Loosen reject_sigla_for: --sigla-style/--sigla-book/--sigla-tradition now actually render on readings/table/render/emit/publish (each builds its own Sigla.t via the new load_sigla), and stay refused only on commands that render no citation (day, easter, temporal, ...). names_of degrades a Lang.bible miss to Book.default_spelling rather than printing the lookup key itself ("luke.abbr"); pinned in cli.t against a language file with no [bible] section at all, independent of la.ini/en.ini's own eventual [bible] section. Regenerate the 11 golden templates for 2027: every changed line is one canonical citation replacing a stored variant, verified against the full readings 2027 diff (raw vs default) cell by cell -- 86 distinct (raw, rendered) pairs account for the entire diff across all 11 files, with zero unexplained residue. Two families: the seven duplicate book spellings collapsing onto one canonical form (Isa./Isa, 3 Kgs./3 Kings, ...), and citations reconstructed from parsed structure dropping stray punctuation the parser already treats as noise (a trailing period or semicolon, a comma chapter/verse separator, an elided inherited chapter) -- each of the latter already named and tested in test_citation.ml's parse_suite before this task.
Diffstat (limited to 'test/cli.t')
-rw-r--r--test/cli.t92
1 files changed, 87 insertions, 5 deletions
diff --git a/test/cli.t b/test/cli.t
index e0a0058..82feff4 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -535,6 +535,36 @@ rather than merely asserted:
$ colitur readings 2027 --raw | head -1
2027-01-01 ef-circumcision | Titus 2:11-15 | Luke 2:21
+Every citation now renders through a {!Colitur_citation.Sigla.t} (Task 9),
+at both places one reaches output -- [View.citation_ref] (`table`/`render`/
+`emit`/`publish`) and `readings`' own `part_ref`. The DEFAULT style
+normalises the seven duplicate book spellings the shipped data inherited
+from lectio onto one canonical form (`3 Kgs.`/`3 Kings` -> `3 Kings`,
+`Isa.` -> `Isa`, ...) and reconstructs each citation from its PARSED
+structure, so stray punctuation the parser already treats as noise
+(a trailing full stop or semicolon, a comma used as a chapter/verse
+separator) does not survive either:
+
+ $ colitur readings 2027 | grep -E '3 K(gs|ings)' | head -3
+ 2027-02-17 ef-lent-ember-wed | 3 Kings 19:3-8 | Matt 12:38-50 | Feria IV Quatuor Temporum Quadragesimae
+ 2027-02-23 ef-lent-2-tuesday | 3 Kings 17:8-16 | Matt 23:1-12 | Feria III post Dominicam II in Quadragesima
+ 2027-03-08 ef-lent-4-monday | 3 Kings 3:16-28 | John 2:13-25 | Feria II post Dominicam IV in Quadragesima
+
+`--raw` passes {!Colitur_citation.Sigla.verbatim}, NEVER a styled `Sigla.t`
+built over `Lang.raw` -- the latter would still parse and reformat every
+citation, defeating the byte-exact diffing `--raw` exists for. So the
+dotted, unnormalised spelling the data actually stores survives `--raw`
+untouched, proving the bypass is real and not merely a style that happens
+to look unstyled:
+
+ $ colitur readings 2027 --raw | grep -E '3 K(gs|ings)' | head -3
+ 2027-02-17 ef-lent-ember-wed | 3 Kgs. 19:3-8 | Matt 12:38-50
+ 2027-02-23 ef-lent-2-tuesday | 3 Kings 17:8-16 | Matt 23:1-12
+ 2027-03-08 ef-lent-4-monday | 3 Kings 3:16-28 | John 2:13-25
+
+ $ colitur readings 2027 --raw | grep -c '3 Kgs\.'
+ 1
+
A language file by path (--lang accepts a bare code OR a file path -- a
value containing '/' or ending ".ini" is read literally rather than looked
up in the installed language directory). The synthetic file below declares
@@ -546,6 +576,21 @@ shows the override:
$ colitur day 2027 --lang ./lang-xx.ini | head -1
2027-01-01 friday christmastide - ef-circumcision class-1 white TEST FEAST
+A book name's own `[bible]` lookup is TOTAL and returns THE KEY on a miss
+(e.g. "luke.abbr"), the same contract every other `Lang` lookup keeps --
+rendering that literally into a citation would print "luke.abbr 2:21".
+The language file below has no `[bible]` section AT ALL (and, unlike
+`lang-xx.ini` above, no `fallback` either, so it can never inherit one
+through the chain), pinning the degrade-to-the-data's-own-spelling path
+independently of whatever `la.ini`/`en.ini` ship in `[bible]` themselves:
+this stays a real witness even after they gain one, where a test relying
+on their own current bare state would quietly stop testing anything the
+day they do.
+
+ $ printf '[meta]\nlang = yy\n' > lang-no-bible.ini
+ $ colitur readings 2027 --lang ./lang-no-bible.ini | head -1
+ 2027-01-01 ef-circumcision | Titus 2:11-15 | Luke 2:21
+
An unknown language is a usage error naming what is available, never a
silent fallback to Latin: a booklet quietly printed in the wrong language is
worse than one that refuses to print. The exact "(looked in ...)" path is
@@ -1356,16 +1401,53 @@ sidesteps that same non-portability:
$ XDG_CONFIG_HOME=xdg-sigla colitur config --show --sigla-tradition nonsense 2>&1 >/dev/null | grep -c 'no tradition "nonsense"; falling back to the Vulgate'
1
-`--sigla-style`/`--sigla-book`/`--sigla-tradition` have no effect on any
-other command yet -- resolving and reporting them is all this build does;
-actually rendering a citation through them is a later task -- refused
-rather than silently ignored, the same discipline `--dump`/`--check`/
-`--list`/`--show` already get above:
+`--sigla-style`/`--sigla-book`/`--sigla-tradition` (Task 9) actually render
+a citation on every command that emits one -- `readings`, `table`/`render`,
+`emit`, `publish` -- and are refused, rather than silently ignored, on
+every command that reads no sanctoral data or renders no citation at all
+(`day` included: it prints no `first`/`gospel` field of its own), the same
+discipline `--overlay`/`--lang` already get:
$ colitur day 2027 --sigla-style la > /dev/null
colitur: --sigla-style/--sigla-book/--sigla-tradition have no effect on `day`; refusing rather than ignoring them
[2]
+ $ colitur easter 2026 --sigla-book full
+ colitur: --sigla-style/--sigla-book/--sigla-tradition have no effect on `easter`; refusing rather than ignoring them
+ [2]
+
+`--sigla-style` selects a DIFFERENT file's own `[sigla]` section than
+`--lang` selects for names -- a booklet may want Polish names but
+Latin-convention punctuation. The synthetic file below overrides only
+`chapter_verse` (comma instead of colon), leaving `--lang`'s own default
+(Latin) name resolution untouched:
+
+ $ printf '[meta]\nlang = zz\n[sigla]\nchapter_verse = "{chapter}, {verses}"\n' > lang-sigla.ini
+ $ colitur readings 2027 --sigla-style ./lang-sigla.ini | head -1
+ 2027-01-01 ef-circumcision | Titus 2, 11-15 | Luke 2, 21 | In Octava Nativitatis Domini
+
+`--sigla-tradition` renumbers which book an id DENOTES (lang/traditions.ini),
+independently of style or naming -- `modern` maps `3 Kings` onto the id
+`kings_1`, which has no registered spelling of its own (only a Vulgate
+tradition target, book.mli), so it prints literally until a language file
+names it -- a real, if plain, witness that the tradition actually applied
+rather than a no-op:
+
+ $ colitur readings 2027 --sigla-tradition modern | grep '^2027-02-17'
+ 2027-02-17 ef-lent-ember-wed | kings_1 19:3-8 | Matt 12:38-50 | Feria IV Quatuor Temporum Quadragesimae
+
+`table`/`render`, `emit` and `publish` accept the same three flags too --
+smoke-tested for exit status alone here (a minimal inline template, the
+same device the table/render examples above use), since their own
+byte-for-byte content is already the golden/emit suites' job, not this
+file's:
+
+ $ printf '{{#days}}{{first}}\n{{/days}}' > /tmp/t-sigla.txt
+ $ colitur table --year 2027 --template /tmp/t-sigla.txt --sigla-book full > /dev/null
+ $ colitur render --template /tmp/t-sigla.txt --year 2027 --sigla-book full > /dev/null
+ $ colitur emit --format csv --from 2027 --to 2027 --sigla-book full > /dev/null
+ $ colitur publish --from 2027 --to 2027 --out /tmp/pub-sigla --sigla-book full > /dev/null
+
`config` requires --show:
$ colitur config