diff options
Diffstat (limited to 'internal/psalter/psalter.go')
| -rw-r--r-- | internal/psalter/psalter.go | 46 |
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 } |
