aboutsummaryrefslogtreecommitdiff
path: root/internal/readings
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-24 16:56:07 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-24 16:56:07 +0200
commit378926240f34759116b19e078d2b2504965f5329 (patch)
treec8e8f2288869882ccc01845eaead8f3c11f067dd /internal/readings
parent29e244c48222278c2f255ff2adf45e3af7c9f895 (diff)
downloadlectio-378926240f34759116b19e078d2b2504965f5329.tar.gz
lectio-378926240f34759116b19e078d2b2504965f5329.zip
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
Diffstat (limited to 'internal/readings')
-rw-r--r--internal/readings/readings.go25
1 files changed, 25 insertions, 0 deletions
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