aboutsummaryrefslogtreecommitdiff
path: root/internal/psalter/psalter.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 14:35:24 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 14:35:24 +0200
commita80e61963756a28a3963a0442a8ccc1572518373 (patch)
tree602540ee619ce1d64c16e7e9ca0adb7a7cfb2194 /internal/psalter/psalter.go
parent0586599fc6020df996c4278230eeea99b9d070cb (diff)
downloadlectio-a80e61963756a28a3963a0442a8ccc1572518373.tar.gz
lectio-a80e61963756a28a3963a0442a8ccc1572518373.zip
fix(calendar): OF precedence/transfer + readings resolution; EF Pentecost octave
Fixes found by validating the offline engine per-day vs the LiturgicalCalendar API (OF) and missalemeum (EF) across 2005-2050. OF calendar is now 0 real errors in the forward window (season/cycle already perfect). OF precedence/transfer (calendar): - Ash Wednesday and Holy Week Mon-Wed are band-2 privileged, so a coinciding feast (Chair of St Peter on Ash Wednesday) is suppressed, not observed. - Solemnities transfer out of Holy Week / the Easter octave: the Annunciation defers to the Monday after the 2nd Sunday of Easter; St Joseph is anticipated to the Saturday before Palm Sunday; the Nativity of St John the Baptist moves to Jun 23 when a Lord's solemnity (Sacred Heart / Corpus Christi) falls Jun 24. - Within a precedence band, a solemnity of the Lord/BVM outranks a saint's (dignity tiebreak) rather than losing an alphabetical slug tie. - Perpetua & Felicity corrected optional -> obligatory memorial. OF readings resolution (bible.OFRef + lectionary data): - Verse-accurate Hebrew->Vulgate psalm mapping incl. the split psalms (9/10, 114/115, 116, 147); "+" verse joins and abbreviated ranges ("127-28") normalized; single-chapter books (2/3 John, Jude) get chapter 1. - Cleaned harvest artifacts from of-lectionary.ini (descriptive-suffix gospels, "or Year A" alternates, "*"/"[Vulg.]"/bracket markers, slash abbreviations); Joel/Malachi/Zechariah/Esther book-versification citations fixed to Vulgate. - Split a merged Ps 15:10/11 row in vul.tsv. Result: 0 unresolvable OF readings over 2557 rendered days (cycles A/B/C, varied Easters). EF: the Octave of Pentecost (Whit Monday-Saturday) is red, not white.
Diffstat (limited to 'internal/psalter/psalter.go')
-rw-r--r--internal/psalter/psalter.go46
1 files changed, 36 insertions, 10 deletions
diff --git a/internal/psalter/psalter.go b/internal/psalter/psalter.go
index 815f660..3e50c53 100644
--- a/internal/psalter/psalter.go
+++ b/internal/psalter/psalter.go
@@ -25,22 +25,48 @@ func DrbVerse(hebrewPsalm, lectionaryVerse int) int {
}
// HebrewToVulgateChapter maps a Masoretic psalm number to its Vulgate chapter.
+// For the split psalms (116, 147) it returns the chapter of the FIRST verse;
+// use HebrewToVulgate for the verse-accurate mapping.
func HebrewToVulgateChapter(h int) int {
+ c, _ := HebrewToVulgate(h, 1)
+ return c
+}
+
+// HebrewToVulgate maps a Masoretic (modern) psalm number and verse to the
+// Vulgate chapter and verse. Most psalms differ only by a one-off chapter shift
+// with the verse unchanged, but four spans are joined or split, so the verse
+// carries an offset there:
+//
+// Hebrew 9 = Vulgate 9:1-21 Hebrew 10 = Vulgate 9:22-39 (10:v -> 9:v+21)
+// Hebrew 114 = Vulgate 113:1-8 Hebrew 115 = Vulgate 113:9-26 (115:v -> 113:v+8)
+// Hebrew 116:1-9 = Vulgate 114 Hebrew 116:10-19 = Vulgate 115:1-10 (116:v>=10 -> 115:v-9)
+// Hebrew 147:1-11 = Vulgate 146 Hebrew 147:12-20 = Vulgate 147:1-9 (147:v>=12 -> 147:v-11)
+func HebrewToVulgate(h, v int) (chapter, verse int) {
switch {
case h <= 8 || h >= 148:
- return h
- case h >= 9 && h <= 10:
- return 9
+ return h, v
+ case h == 9:
+ return 9, v
+ case h == 10:
+ return 9, v + 21
case h >= 11 && h <= 113:
- return h - 1
- case h >= 114 && h <= 115:
- return 113
+ return h - 1, v
+ case h == 114:
+ return 113, v
+ case h == 115:
+ return 113, v + 8
case h == 116:
- return 114
+ if v <= 9 {
+ return 114, v
+ }
+ return 115, v - 9
case h >= 117 && h <= 146:
- return h - 1
+ return h - 1, v
case h == 147:
- return 146
+ if v <= 11 {
+ return 146, v
+ }
+ return 147, v - 11
}
- return h
+ return h, v
}