From 378926240f34759116b19e078d2b2504965f5329 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 24 Jul 2026 16:56:07 +0200 Subject: export: month calendar PDF (A4 landscape, Monday-first grid, feast name + gospel ref + liturgical colour per day); cli --calendar YYYY-MM; web /calendar + link; readings.GospelCitation; v0.23.0 --- internal/readings/readings.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'internal/readings') diff --git a/internal/readings/readings.go b/internal/readings/readings.go index 047e901..49c9adc 100644 --- a/internal/readings/readings.go +++ b/internal/readings/readings.go @@ -57,6 +57,31 @@ func Load(cfg config.Config, opts Options) ([]liturgy.Section, liturgy.DayInfo, return filterParts(secs, cfg, opts.All), info, nil } +// GospelCitation returns the gospel's scripture reference from loaded sections: +// the section tagged "ewangelia" (modern) or "evangelium" (traditional), else +// the first section; preferring its Citation, else the reference parsed from its +// heading. Used by the month-calendar export (and mirrors the CLI helper). +func GospelCitation(secs []liturgy.Section) string { + pick := func(s liturgy.Section) string { + if s.Citation != "" { + return s.Citation + } + if c, err := liturgy.ExtractCitation(s.Heading); err == nil { + return c + } + return "" + } + for _, s := range secs { + if s.PartID == "ewangelia" || s.PartID == "evangelium" { + return pick(s) + } + } + if len(secs) > 0 { + return pick(secs[0]) + } + return "" +} + // filterParts keeps only the gospel when !all (PartID "ewangelia" modern or // "evangelium" traditional). When all and the lectionary is traditional, it // keeps only the scripture readings (isTraditionalReading) -- dropping -- cgit v1.3