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 /lib/naming/lang.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 'lib/naming/lang.ml')
| -rw-r--r-- | lib/naming/lang.ml | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/naming/lang.ml b/lib/naming/lang.ml index 2301513..f0fd989 100644 --- a/lib/naming/lang.ml +++ b/lib/naming/lang.ml @@ -16,6 +16,8 @@ type t = { colour : table; term : table; rite : table; + bible : table; + sigla : table; chain : t option; (** consulted when this table misses *) } @@ -35,6 +37,14 @@ let rank t k = get t (fun x -> x.rank) k let colour t k = get t (fun x -> x.colour) k let term t k = get t (fun x -> x.term) k let rite t k = get t (fun x -> x.rite) k +let bible t k = get t (fun x -> x.bible) k + +(* Not routed through [get]/[chain]: [sigla] is a set of RENDER SETTINGS + (Render.style_of_fields), not a per-key translation lookup, and it has no + miss-returns-the-key contract to keep -- a caller with no [sigla] table at + all just gets []. Order does not matter to callers (Render.style_of_fields + reads them by name), so [SM.bindings] (alphabetical) is fine here. *) +let sigla_fields t = SM.bindings t.sigla let weekday_key = [| "sunday"; "monday"; "tuesday"; "wednesday"; "thursday"; "friday"; "saturday" |] @@ -65,7 +75,8 @@ let fallback_code t = t.fallback_code let raw = { code = "raw"; fallback_code = None; celebration = empty_table; weekday = empty_table; month = empty_table; month_abbr = empty_table; season = empty_table; rank = empty_table; - colour = empty_table; term = empty_table; rite = empty_table; chain = None } + colour = empty_table; term = empty_table; rite = empty_table; bible = empty_table; + sigla = empty_table; chain = None } let with_fallback t base = { t with chain = Some base } @@ -107,12 +118,21 @@ let of_string text = colour = find "colour"; term = find "term"; rite = find "rite"; + bible = find "bible"; + sigla = find "sigla"; chain = None }) +(* [bible] joins this reference set: it is translatable book names, so a file + lacking them is genuinely incomplete and [lang --check] should say so. + [sigla] deliberately does NOT: it is five citation-style settings with + working defaults (Render.default_style), not names a translator owes -- + adding it here would make [--check] demand five settings from every + language file that has never needed them. *) let keys t = let qualify prefix m = SM.bindings m |> List.map (fun (k, v) -> (prefix ^ "." ^ k, v)) in List.concat [ qualify "celebration" t.celebration; qualify "weekday" t.weekday; qualify "month" t.month; qualify "month_abbr" t.month_abbr; qualify "season" t.season; - qualify "rank" t.rank; qualify "colour" t.colour; qualify "term" t.term; qualify "rite" t.rite ] + qualify "rank" t.rank; qualify "colour" t.colour; qualify "term" t.term; qualify "rite" t.rite; + qualify "bible" t.bible ] |> List.sort compare |
