aboutsummaryrefslogtreecommitdiff
path: root/internal/readings/readings.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/readings/readings.go')
-rw-r--r--internal/readings/readings.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/internal/readings/readings.go b/internal/readings/readings.go
index 886c1eb..82d2fb9 100644
--- a/internal/readings/readings.go
+++ b/internal/readings/readings.go
@@ -6,6 +6,7 @@ package readings
import (
"fmt"
+ "strings"
"github.com/lukaszkasprzak/lectio/internal/config"
"github.com/lukaszkasprzak/lectio/internal/liturgy"
@@ -56,8 +57,12 @@ func Load(cfg config.Config, opts Options) ([]liturgy.Section, error) {
}
// filterParts keeps only the gospel when !all (PartID "ewangelia" modern or
-// "evangelium" traditional), otherwise keeps sections cfg.PartShown allows
-// (a section with an empty PartID is always kept). Pure and network-free.
+// "evangelium" traditional). When all and the lectionary is traditional, it
+// keeps only the scripture readings (isTraditionalReading) -- dropping
+// Introit/Kolekta/Graduale/Offertorium/Sekreta/Prefacja/Komunia/Pokomunia
+// and any commemoration, none of which are readings; the "new" lectionary
+// path is unchanged, keeping sections cfg.PartShown allows (a section with
+// an empty PartID is always kept). Pure and network-free.
func filterParts(secs []liturgy.Section, cfg config.Config, all bool) []liturgy.Section {
var out []liturgy.Section
for _, s := range secs {
@@ -67,9 +72,26 @@ func filterParts(secs []liturgy.Section, cfg config.Config, all bool) []liturgy.
}
continue
}
+ if cfg.Lectionary == "traditional" {
+ if isTraditionalReading(s.PartID) {
+ out = append(out, s)
+ }
+ continue
+ }
if s.PartID == "" || cfg.PartShown(cfg.Lectionary, s.PartID) {
out = append(out, s)
}
}
return out
}
+
+// isTraditionalReading reports whether partID (a lowercased missalemeum
+// section id) is a scripture reading -- the gospel, or an epistle/lesson --
+// rather than Introit/Kolekta/Graduale/Offertorium/Sekreta/Prefacja/
+// Komunia/Pokomunia or a commemoration.
+func isTraditionalReading(partID string) bool {
+ return partID == "evangelium" ||
+ strings.HasPrefix(partID, "lectio") ||
+ strings.HasPrefix(partID, "epistola") ||
+ strings.HasPrefix(partID, "prophetia")
+}