diff options
Diffstat (limited to 'internal/calendar/precedence.go')
| -rw-r--r-- | internal/calendar/precedence.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/calendar/precedence.go b/internal/calendar/precedence.go index 3b7c0a6..3c7bf5f 100644 --- a/internal/calendar/precedence.go +++ b/internal/calendar/precedence.go @@ -82,6 +82,13 @@ func pick(cands []candidate) (candidate, []candidate) { if pi != pj { return pi < pj } + // Within a band, higher liturgical dignity wins (Table of Liturgical Days: + // of the Lord, then of the BVM, then of saints) -- so a Lord's solemnity + // (Sacred Heart, Corpus Christi) outranks a coinciding saint's solemnity + // rather than losing an alphabetical tie. + if di, dj := dignity(sorted[i].Cel), dignity(sorted[j].Cel); di != dj { + return di < dj + } return sorted[i].Cel.Slug < sorted[j].Cel.Slug }) // General Norms 60: when two obligatory memorials fall on the same day, both @@ -108,6 +115,20 @@ func pick(cands []candidate) (candidate, []candidate) { return sorted[0], sorted[1:] } +// dignity ranks a celebration within its precedence band by the Table of +// Liturgical Days' order of dignity: of the Lord (0), of the BVM (1), of saints +// or unclassified (2). +func dignity(c Celebration) int { + switch c.Class { + case ClassLord: + return 0 + case ClassBVM: + return 1 + default: + return 2 + } +} + // slugIndex returns the position of the candidate with the given slug, or -1. func slugIndex(cands []candidate, slug string) int { for i, c := range cands { |
