diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 15:22:14 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 15:22:14 +0200 |
| commit | 88ade3a7b7e15e6742d367bdc4b95b1293b92429 (patch) | |
| tree | 91f721176e3f28dc9c06566101cb441538e145fc /internal/caldata/caldata.go | |
| parent | 28699aa44df1d791fb48618a8f06627f230432d4 (diff) | |
| download | lectio-88ade3a7b7e15e6742d367bdc4b95b1293b92429.tar.gz lectio-88ade3a7b7e15e6742d367bdc4b95b1293b92429.zip | |
feat: EF temporal Sunday lectionary (offline Sunday Mass readings)
Unique temporal-day slugs (season-sunday-week); scripts/genlect.go generates
tridentine-lectionary.ini from missalemeum keyed by slug (55 entries: the
Sundays of the whole EF year). caldata.TemporalReadings(form,slug) lookup;
--liturgy resolves proper-of-feast else the temporal cycle and renders the text.
bible.ParseRef strips abbreviation dots (1 Cor. -> 1 Cor). 52/53 Sundays fully
resolve offline.
Diffstat (limited to 'internal/caldata/caldata.go')
| -rw-r--r-- | internal/caldata/caldata.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/caldata/caldata.go b/internal/caldata/caldata.go index 14b3985..92f9327 100644 --- a/internal/caldata/caldata.go +++ b/internal/caldata/caldata.go @@ -19,6 +19,39 @@ var romanCalendar []byte //go:embed tridentine-calendar.ini var tridentineCalendar []byte +//go:embed tridentine-lectionary.ini +var tridentineLectionary []byte + +// efTempReadings maps an EF temporal-day slug to its readings (parsed once). +var efTempReadings = parseLectionary(tridentineLectionary) + +func parseLectionary(data []byte) map[string][]calendar.Reading { + l, err := ParseLayer(data) + if err != nil { + panic(fmt.Sprintf("caldata: tridentine-lectionary.ini invalid: %v", err)) + } + out := map[string][]calendar.Reading{} + for slug, rc := range l.Cels { + var rs []calendar.Reading + for _, part := range []string{"first", "psalm", "second", "gospel"} { + if c := rc.Fields[part]; c != "" { + rs = append(rs, calendar.Reading{Part: part, Citation: c}) + } + } + out[slug] = rs + } + return out +} + +// TemporalReadings returns the temporal-cycle readings for a computed day slug, +// or nil. Only the EF ("old") temporal lectionary exists so far. +func TemporalReadings(form, slug string) []calendar.Reading { + if form == "old" { + return efTempReadings[slug] + } + return nil +} + // Universal parses the embedded Ordinary Form universal calendar. It panics on a // malformed embedded file (a build-time bug caught by tests). func Universal() calendar.Layer { |
