aboutsummaryrefslogtreecommitdiff
path: root/test/test_support.ml
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/test_support.ml
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/test_support.ml')
-rw-r--r--test/test_support.ml28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_support.ml b/test/test_support.ml
index 7d7662f..f12fcd7 100644
--- a/test/test_support.ml
+++ b/test/test_support.ml
@@ -63,3 +63,31 @@ let ef_context () =
match load_ef_commons () with
| Error e -> failwith e
| Ok commons -> Rite_ef.context ~lectionary ~commons)
+
+(* Mirrors bin/main.ml's [names_of] exactly (Task 9): {!Colitur_naming.Lang.bible}
+ is a total lookup that returns THE KEY on a miss (["luke.abbr"]), so this
+ degrades to the data's own spelling ({!Colitur_citation.Book.default_spelling})
+ rather than letting a miss render literally. Duplicated here rather than
+ shared, the same call this file's own header already makes for its three
+ loaders: [bin/] and [test/] are separate dune stanzas. *)
+let names_of lang id form =
+ let key =
+ Colitur_citation.Book.to_string id
+ ^ (match form with `Full -> ".full" | `Abbr -> ".abbr")
+ in
+ let v = Colitur_naming.Lang.bible lang key in
+ if v = key then Colitur_citation.Book.default_spelling id else v
+
+(* The [Sigla.t] a real CLI invocation with no --raw and no --sigla-* flags
+ builds (mirrors bin/main.ml's [load_sigla] under those defaults exactly):
+ [lang]'s own [\[sigla\]] section (none shipped yet, so
+ {!Colitur_citation.Render.default_style}), [abbr] books, the Vulgate
+ tradition. Used by test_view.ml/test_render_golden.ml so their golden and
+ shape assertions exercise the SAME rendering path `colitur table`/`emit`/
+ `publish` do by default, not a stand-in. *)
+let default_sigla lang =
+ Colitur_citation.Sigla.make
+ ~style:
+ (Colitur_citation.Render.with_book `Abbr
+ (Colitur_citation.Render.style_of_fields (Colitur_naming.Lang.sigla_fields lang)))
+ ~tradition:Colitur_citation.Book.vulgate ~names:(names_of lang)