From 90584d87e763789808329847c46dbaa8e22dca47 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Wed, 26 Aug 2026 23:53:49 +0200 Subject: fix(citation): represent chapter-crossing verse ranges (W4) Parse.verse_range's [last] endpoint gains an optional chapter (Parse.verse_end: { chapter : int option; verse : verse_num }), so a hyphen range whose two endpoints lie in different chapters ("1 John 1:5-2:2") can be represented at all. Rejected: a bare [int option] living alongside [last] as a second field on verse_range -- that would let 'a chapter with no verse' exist as a constructible value. parse_part now splits a part's leading "chapter:" at the FIRST colon only (not every colon), so the verses side can itself carry a second colon from a crossing range. parse_range detects a crossing by checking whether the range's right-hand side contains ':', and skips the same-chapter descending-range guard for that case (a later chapter is always "ahead", whatever its own verse numbers are). Handles the compound shape too -- a crossing range followed by further, same-chapter verse references in the same comma list ("Matthew 9:35-10:1,5a,6-8") -- since those trailing pieces parse as ordinary bare verses/ranges, unaffected by the preceding crossing. Render's one_range renders a crossing [last] through the same chapter_verse template one_part already uses for the part's own leading "chapter:verses", so a style that reconfigures the chapter/verse separator renders a crossing endpoint in that same convention rather than a hardcoded ':'. This closes the W4 known-wrong: 41 (now 49, after an intervening Second-reading extraction) of the OF lectionary's citations printed unconverted, every one this exact shape. test_citation_coverage_of.ml's pinned residual is now empty and asserted exactly, over the full 1725-field data/of/lectionary.sexp population, including the round-trip check (parse -> render -> parse structural equality). test_citation.ml gains direct parse-suite cases for the basic crossing, the compound shape, a mid-list crossing, a crossing with a sub-verse letter, and a malformed-crossing rejection. data/of/lectionary.sexp is regenerated via its own generator (tools/bootstrap_lectionary_of.ml, whose own embedded header text is updated to match); only comment lines change, confirmed by diff -- no lectionary entry differs. test_lectionary_of.ml's whole-file SHA-256 pin is updated to match. EF is unaffected: data/ef/ is untouched since v1.0.0, and a direct byte comparison of `colitur day`/`colitur readings` for 2026, 1583 and 9999 against a git-worktree build of 1c0137d is identical on all six outputs. --- data/of/lectionary.sexp | 80 ++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 64 deletions(-) (limited to 'data') diff --git a/data/of/lectionary.sexp b/data/of/lectionary.sexp index 7fe5b24..693b768 100644 --- a/data/of/lectionary.sexp +++ b/data/of/lectionary.sexp @@ -89,20 +89,21 @@ ; ferial (Lectionary_of.readings' own step 2 -> step 3) -- this is ; OLM norms working as designed for a saint with no proper of ; their own, not a gap in this data. -; (4) Citation-siglum conversion (fix wave I2, 2026-08-26 review): of -; 1725 emitted (First, Second, Gospel) citation fields, 49 distinct -; references (out of the full 1725) do not parse -- every one a -; hyphen range that crosses a chapter boundary ("2:29-3:6"), a -; {!Colitur_citation.Parse.t} shape this parser's [part]/ -; [verse_range] types do not represent, deliberately not built -; this task (see book.ml's own [is_single_chapter] neighbourhood -; for what WAS fixed: 345 previously-unregistered book names and -; verse sub-letter markers, both closed at the parser/book-table -; level, not here). Such a reference still prints, verbatim, -; never a crash or a dropped citation -- {!Colitur_citation.Sigla -; .format}'s own documented contract on a parse miss. Pinned -; exactly, both directions, by test/test_citation_coverage_of.ml. -; Named below. +; (4) Citation-siglum conversion (fix wave I2, 2026-08-26 review; +; CLOSED by W4): of 1725 emitted (First, Second, Gospel) citation +; fields, 0 distinct references (out of the full 1725) do not +; parse. I2/I7 left 49 unconverted here, every one a hyphen +; range crossing a chapter boundary ("2:29-3:6"); W4 gave +; {!Colitur_citation.Parse.t} a [verse_end] so a range's [last] +; can name its own, later chapter (see book.ml's own +; [is_single_chapter] neighbourhood for the other, earlier fix: +; 345 previously-unregistered book names and verse sub-letter +; markers, closed at the parser/book-table level). A reference +; that still fails to parse would still print verbatim, never a +; crash or a dropped citation -- {!Colitur_citation.Sigla +; .format}'s own documented contract on a parse miss -- but none +; does today. Pinned exactly, both directions, by +; test/test_citation_coverage_of.ml. Named below (if any). ; (5) Second-reading coverage (fix wave I7, 2026-08-26): 183 of the ; 1725 emitted citation fields above are a Second reading -- every ; one from a SUNDAY-CYCLE (-A/-B/-C, i.e. Sunday/solemnity) @@ -119,56 +120,7 @@ ; Regenerate with: ; eval $(opam env) && dune exec tools/bootstrap_lectionary_of.exe -- ../lectio/internal/caldata/of-lectionary.ini data/of/lectionary.sexp ; Unmapped lectio bases (0): -; Citations that do not parse (49 distinct, all chapter-crossing ranges): -; 1 Corinthians 10:31-11:1 -; 1 Corinthians 12:31-13:13 -; 1 John 1:5-2:2 -; 1 John 2:29-3:6 -; 1 John 3:22-4:6 -; 1 John 4:19-5:4 -; 1 Thessalonians 3:12-4:2 -; 2 Corinthians 3:15-4:1,3-6 -; 2 Corinthians 4:13-5:1 -; 2 Samuel 18:9-10,14b,24-25a,30-19:3 -; 2 Thessalonians 1:11-2:2 -; 2 Thessalonians 2:16-3:5 -; 2 Timothy 3:14-4:2 -; Colossians 1:24-2:3 -; Ecclesiastes 11:9-12:8 -; Ephesians 4:30-5:2 -; Ephesians 4:32-5:8 -; Exodus 11:10-12:14 -; Exodus 14:21-15:1 -; Ezekiel 2:8-3:4 -; Galatians 4:22-24,26-27,31-5:1 -; Genesis 1:1-2:2 -; Genesis 1:20-2:4a -; Habakkuk 1:12-2:4 -; Hebrews 7:25-8:6 -; Isaiah 52:13-53:12 -; Isaiah 8:23b-9:3 -; James 3:16-4:3 -; John 15:26-16:4a -; John 18:1-19:42 -; Jonah 1:1-2:2,11 -; Luke 7:36-8:3 -; Malachi 1:14b-2:2b,8-10 -; Mark 2:23-3:6 -; Mark 8:34-9:1 -; Matthew 10:34-11:1 -; Matthew 18:21-19:1 -; Matthew 9:35-10:1,5a,6-8 -; Matthew 9:36-10:8 -; Numbers 13:1-2,25-14:1,26a-29a,34-35 -; Philippians 3:17-4:1 -; Revelation 20:1-4,11-21:2 -; Sirach 27:30-28:7 -; The Acts 12:24-13:5a -; The Acts 17:15,22-18:1 -; The Acts 7:51-8:1a -; Wisdom 11:22-12:2 -; Wisdom 2:23-3:9 -; Wisdom 7:22b-8:1 +; Citations that do not parse (0 distinct): ; Temporal_of slugs (2004-2051) with no lectionary entry (0, informational -- ; most are the Christmas-season/late-Advent date-vs-weekday gap named above): ((all-saints -- cgit v1.3