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 +++++++++++++++++++++++++++++++++++-- test/cli.t | 20 +++++++++++++++++++- 2 files changed, 54 insertions(+), 3 deletions(-) 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 diff --git a/test/cli.t b/test/cli.t index 86291a6..588616c 100644 --- a/test/cli.t +++ b/test/cli.t @@ -230,7 +230,25 @@ The OF rite resolves too, same two commands, its own vocabulary: $ colitur readings --rite of 2026 | wc -l 365 $ colitur readings --rite of 2026 | head -1 - 2026-01-01 of-mary-mother-of-god | Num 6:22-27 | Luc 2:16-21 + 2026-01-01 of-mary-mother-of-god | Num 6:22-27 | Gal 4:4-7 | Luc 2:16-21 + +fix-render-second-report (2026-08-26): the Second reading (OLM n. 67) now +renders between First and Gospel on the days that carry one -- a Sunday or +solemnity, [Rite.t.citation_shapes] on the OF side -- and is simply absent +(not printed as "-") on every other day, so an OF weekday's row keeps the +same two-citation shape it always had: + + $ colitur readings --rite of 2026 | grep '^2026-11-29 ' + 2026-11-29 of-advent-sunday-1 | Isai 63:16b-17, 19b; 64:2-7 | 1 Cor 1:3-9 | Marc 13:33-37 + $ colitur readings --rite of 2026 | grep '^2026-01-05 ' + 2026-01-05 of-christmas-1-monday | 1 Ioann 3:11-21 | Ioann 1:43-51 + +EF's own `citation_shapes` is `[First; Gospel]` alone -- no EF day ever +carries a Second reading, so EF's `readings` row is unaffected, still +exactly two citation fields: + + $ colitur readings --rite ef 2026 | grep '^2026-01-01 ' + 2026-01-01 ef-circumcision | Tit 2:11-15 | Luc 2:21 | In Octava Nativitatis Domini Fix wave I1 (final-review.md): a sanctoral-origin OF day names through its OWN transcribed title (calendar-2002.sexp, amended by 011's own rename), -- cgit v1.3