diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 19:05:13 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 19:05:13 +0200 |
| commit | 7dbd16cdf5880c0006dffacd09214ee607050b64 (patch) | |
| tree | 01e1ee37a2be97a0b06fad70de975d8007beb702 /test/test_support.ml | |
| parent | 1aeca948c2a2a82bffaaec65077140aa05f7b3f4 (diff) | |
| parent | 1da70dc7ac03fe33fb92b172a0e26932764170d6 (diff) | |
| download | colitur-7dbd16cdf5880c0006dffacd09214ee607050b64.tar.gz colitur-7dbd16cdf5880c0006dffacd09214ee607050b64.zip | |
Merge branch 'citations-and-sigla'
Citations are parsed into structure and re-rendered, so book names,
abbreviations, punctuation style and numbering tradition become files a
user edits rather than strings frozen in the data.
New lib/citation (Book, Parse, Render, Sigla); [bible] and [sigla]
sections in language files; lang/traditions.ini for numbering; three
config keys and CLI flags. --raw emits every citation byte-for-byte as
stored, bypassing the whole pipeline, so output stays diffable against
lectio and the raw view does not depend on the parser being correct.
Diffstat (limited to 'test/test_support.ml')
| -rw-r--r-- | test/test_support.ml | 28 |
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) |
