diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 16:43:04 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 16:43:04 +0200 |
| commit | 27606c42b7506ab7ffc7f1bd32d4d4a72c6400c8 (patch) | |
| tree | 26c132598ef132a38e26b4922a93b9923defa562 /lib/render/view.ml | |
| parent | 87b155b913cea7f5c55b5a2391aff7819ba541a6 (diff) | |
| download | colitur-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 'lib/render/view.ml')
| -rw-r--r-- | lib/render/view.ml | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/render/view.ml b/lib/render/view.ml index 9f489aa..0691ffb 100644 --- a/lib/render/view.ml +++ b/lib/render/view.ml @@ -1,6 +1,7 @@ module K = Colitur_kernel module T = Template module Lang = Colitur_naming.Lang +module Sigla = Colitur_citation.Sigla let str s = T.Str s let bool b = T.Bool b @@ -43,11 +44,14 @@ let dow_int = function | K.Date.Sun -> 0 | K.Date.Mon -> 1 | K.Date.Tue -> 2 | K.Date.Wed -> 3 | K.Date.Thu -> 4 | K.Date.Fri -> 5 | K.Date.Sat -> 6 -let citation_ref cits part = +(* [sigla] renders the stored reference in the caller's chosen style + (Task 9) -- under [Sigla.verbatim] this is the identity, so [--raw]'s + own byte-exact contract is unaffected. *) +let citation_ref ~sigla cits part = match List.find_opt (fun (c : K.Citation.t) -> c.K.Citation.part = part) cits with - | Some c -> c.K.Citation.reference + | Some c -> Sigla.format sigla c.K.Citation.reference | None -> "" (* A commemoration's own name resolves through the SAME [lang.celebration] @@ -85,7 +89,7 @@ let padding_cell dow = ("transferred_in", T.List []); ("transferred_out", T.List []); ("first", str ""); ("gospel", str ""); ("last", bool false) ] -let day_value ~lang ~vocab (d : ('s, 'r) K.Liturgical_day.t) = +let day_value ~lang ~sigla ~vocab (d : ('s, 'r) K.Liturgical_day.t) = let date = d.K.Liturgical_day.date in let tmp = d.K.Liturgical_day.temporal in let cel = d.K.Liturgical_day.observed in @@ -135,8 +139,8 @@ let day_value ~lang ~vocab (d : ('s, 'r) K.Liturgical_day.t) = [ ("slug", str (K.Slug.to_string c.K.Celebration.slug)); ("to", str (K.Date.to_iso8601 dest)) ]) d.K.Liturgical_day.transferred_out) ); - ("first", str (citation_ref d.K.Liturgical_day.citations K.Citation.First)); - ("gospel", str (citation_ref d.K.Liturgical_day.citations K.Citation.Gospel)); + ("first", str (citation_ref ~sigla d.K.Liturgical_day.citations K.Citation.First)); + ("gospel", str (citation_ref ~sigla d.K.Liturgical_day.citations K.Citation.Gospel)); (* overwritten per grid row by [set_last]; false in the flat [days] list *) ("last", bool false) ] @@ -245,8 +249,8 @@ let weekday_headings lang = T.List (List.init 7 (fun i -> T.Obj [ ("name", str (Lang.weekday lang i)); ("last", bool (i = 6)) ])) -let of_days ~lang ~vocab ~rite ~year days = - let dvs = List.map (fun d -> (d, day_value ~lang ~vocab d)) days in +let of_days ~lang ~sigla ~vocab ~rite ~year days = + let dvs = List.map (fun d -> (d, day_value ~lang ~sigla ~vocab d)) days in let months = List.init 12 (fun i -> let m = i + 1 in |
