diff options
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 |
