// Package psalter bridges psalm versification between the Vulgate-family // versions and the Douay-Rheims source. See the Go port of psalm_versify.py. package psalter // DRBTitleFold maps a Hebrew psalm number to the number of title verses the DRB // source folds into verse 1 (1, or 2 for a historical superscription). Untitled // psalms are absent (k = 0). Copy every entry from psalm_versify.py DRB_TITLE_FOLD. var DRBTitleFold = map[int]int{ 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 11: 1, 12: 1, 14: 1, 18: 1, 19: 1, 20: 1, 21: 1, 22: 1, 30: 1, 31: 1, 34: 1, 36: 1, 38: 1, 39: 1, 40: 1, 41: 1, 42: 1, 44: 1, 45: 1, 46: 1, 47: 1, 48: 1, 49: 1, 51: 2, 52: 2, 53: 1, 54: 2, 55: 1, 56: 1, 57: 1, 58: 1, 59: 1, 60: 2, 61: 1, 62: 1, 63: 1, 64: 1, 65: 1, 67: 1, 68: 1, 69: 1, 70: 1, 75: 1, 76: 1, 77: 1, 80: 1, 81: 1, 83: 1, 84: 1, 85: 1, 88: 1, 89: 1, 92: 1, 102: 1, 108: 1, 140: 1, 142: 1, } // DrbVerse returns the DRB-source verse number for a lectionary (BT) psalm verse. func DrbVerse(hebrewPsalm, lectionaryVerse int) int { v := lectionaryVerse - DRBTitleFold[hebrewPsalm] if v < 1 { return 1 } return v } // 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, v case h == 9: return 9, v case h == 10: return 9, v + 21 case h >= 11 && h <= 113: return h - 1, v case h == 114: return 113, v case h == 115: return 113, v + 8 case h == 116: if v <= 9 { return 114, v } return 115, v - 9 case h >= 117 && h <= 146: return h - 1, v case h == 147: if v <= 11 { return 146, v } return 147, v - 11 } return h, v }