summaryrefslogtreecommitdiff
path: root/internal/psalter/psalter.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 15:07:12 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 15:07:12 +0200
commit310ac404f25b412c5c1ead12247b4eb36e9f0025 (patch)
tree6e1dcc5e1f85a483cef7044d341b7c940c1690a8 /internal/psalter/psalter.go
parent44472bbe31475a3c672ae003d928d7caffb4b50a (diff)
parentc5abf87fa7198c8f245f407774e2326e4b6c9b9c (diff)
downloadlectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.tar.gz
lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.zip
Merge branch 'engine-precedence-fixes': OF/EF calendar+readings flawlessness pass
Per-day validation vs litcal (OF) and missalemeum (EF) 2005-2050, all defects fixed and re-validated to zero: OF calendar 0 real errors forward, OF readings 0 unresolvable, EF 0 reading gaps + resumed Sundays correct.
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
}