From 1c0137dee8ff3858707281366662891a5ff01044 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Wed, 26 Aug 2026 14:51:55 +0200 Subject: fix(cli): render the Second reading on colitur readings The OF lectionary (data/of/lectionary.sexp) carries 183 Second readings, 146 of them on Sunday keys, and the kernel resolves them correctly -- but readings_line (EF) and readings_line_of (OF) in bin/main.ml only ever printed Citation.First and Citation.Gospel, so `colitur readings --rite of` silently dropped every Second reading it computed. Both functions gain a second_suffix lookup, spliced between the existing First and Gospel fields, present only when the day carries a Second citation. No rite check: EF's citation_shapes is [[First; Gospel]] alone, so EF rows are unaffected by construction, not by special-casing. EF byte-identity verified two ways: `git diff --stat v1.0.0..HEAD -- data/ef/` is empty, and `colitur day`/`colitur readings --rite ef` for 2026, 1583 and 9999 cmp identical against a build of the prior commit. test/cli.t: fixed the one now-stale assertion and added coverage for the three-citation OF Sunday shape alongside the unchanged two-citation OF weekday and EF shapes. --- bin/main.ml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/main.ml b/bin/main.ml index eab41d8..6e3b03c 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -473,13 +473,32 @@ let readings_line ~lang ~sigla (d : (Rite_ef.Vocab_ef.season, Rite_ef.Vocab_ef.r | Some c -> Colitur_citation.Sigla.format sigla c.Colitur_kernel.Citation.reference | None -> "-" in + (* The Second reading (OLM n. 67: a Sunday/solemnity's own three-reading + shape) is present-or-absent, not present-or-"-": unlike First/Gospel + ({!Colitur_kernel.Validate}'s "citations" check guarantees exactly one + of each on every day of every rite), a day may legitimately carry no + Second reading at all ([Rite.t.citation_shapes] for EF is + [[First; Gospel]] alone), and EF never carries one. So this is an + append-only field, the same discipline [name_suffix] below already + uses -- absent, it contributes the empty string and this row is + byte-identical to what it printed before the Second reading existed. *) + let second_suffix = + match + List.find_opt + (fun (c : Colitur_kernel.Citation.t) -> c.Colitur_kernel.Citation.part = Colitur_kernel.Citation.Second) + d.Colitur_kernel.Liturgical_day.citations + with + | Some c -> " | " ^ Colitur_citation.Sigla.format sigla c.Colitur_kernel.Citation.reference + | None -> "" + in let slug_s = Colitur_kernel.Slug.to_string cel.Colitur_kernel.Celebration.slug in let name = Colitur_naming.Lang.celebration lang slug_s in let name_suffix = if name = slug_s then "" else " | " ^ name in - Printf.printf "%s %s | %s | %s%s\n" + Printf.printf "%s %s | %s%s | %s%s\n" (D.to_iso8601 d.Colitur_kernel.Liturgical_day.date) slug_s (part_ref Colitur_kernel.Citation.First) + second_suffix (part_ref Colitur_kernel.Citation.Gospel) name_suffix @@ -736,13 +755,27 @@ let readings_line_of ~lang ~sigla | Some c -> Colitur_citation.Sigla.format sigla c.Colitur_kernel.Citation.reference | None -> "-" in + (* Second reading: present-or-absent, not present-or-"-" -- see + [readings_line]'s own comment for the full reasoning (OLM n. 67, a + Sunday/solemnity's own three-reading shape; [Rite.t.citation_shapes] + is what actually distinguishes which OF days carry one). *) + let second_suffix = + match + List.find_opt + (fun (c : Colitur_kernel.Citation.t) -> c.Colitur_kernel.Citation.part = Colitur_kernel.Citation.Second) + d.Colitur_kernel.Liturgical_day.citations + with + | Some c -> " | " ^ Colitur_citation.Sigla.format sigla c.Colitur_kernel.Citation.reference + | None -> "" + in let slug_s = Colitur_kernel.Slug.to_string cel.Colitur_kernel.Celebration.slug in let name = observed_name_of ~lang cel slug_s in let name_suffix = if name = slug_s then "" else " | " ^ name in - Printf.printf "%s %s | %s | %s%s\n" + Printf.printf "%s %s | %s%s | %s%s\n" (D.to_iso8601 d.Colitur_kernel.Liturgical_day.date) slug_s (part_ref Colitur_kernel.Citation.First) + second_suffix (part_ref Colitur_kernel.Citation.Gospel) name_suffix -- cgit v1.3