diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 21:30:56 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 21:30:56 +0200 |
| commit | bec7c034aca15537900d74a7063d85c0f4deacae (patch) | |
| tree | baf4cac4e3a38507b8a0f9de80ac251a5df82908 /internal/cli/liturgy.go | |
| parent | 2901c73fde7ff19e8cdea00f933dc628d11c6ec6 (diff) | |
| download | lectio-bec7c034aca15537900d74a7063d85c0f4deacae.tar.gz lectio-bec7c034aca15537900d74a7063d85c0f4deacae.zip | |
feat(calfeed): shared day builder + reusable reading resolver
Diffstat (limited to 'internal/cli/liturgy.go')
| -rw-r--r-- | internal/cli/liturgy.go | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/internal/cli/liturgy.go b/internal/cli/liturgy.go index ced23ae..5b6036e 100644 --- a/internal/cli/liturgy.go +++ b/internal/cli/liturgy.go @@ -38,27 +38,11 @@ func runLiturgy(cfg config.Config, date string, stdout, stderr io.Writer) int { return 0 } -// dayReadings resolves the day's Mass readings: the observed celebration's -// inline propers, else the temporal lectionary for its slug, else -- for an EF -// weekday with no proper Mass -- the preceding Sunday's Mass (the 1962 rule -// that green-season ferias repeat the Sunday). +// dayReadings resolves the day's Mass readings; the logic lives in +// caldata.Readings (shared with calfeed.Build) so it stays reusable outside +// the CLI. func dayReadings(sel calendar.Selection, layers []calendar.Layer, date time.Time, day calendar.LiturgicalDay) []calendar.Reading { - var rs []calendar.Reading - for _, m := range day.Observed.Masses { - rs = append(rs, m.Readings...) - } - if len(rs) > 0 { - return rs - } - if r := caldata.TemporalReadings(sel.Form, day.Observed.Slug); len(r) > 0 { - return r - } - if sel.Form == "old" && day.Observed.Layer == "temporal" && date.Weekday() != time.Sunday { - sun := date.AddDate(0, 0, -int(date.Weekday())) // preceding Sunday (Sunday = 0) - sd := calendar.Compute(sun, sel, layers) - return caldata.TemporalReadings(sel.Form, sd.Observed.Slug) - } - return nil + return caldata.Readings(sel, layers, date, day) } // vernacularVersion is the corpus that renders reading text: the config's |
