aboutsummaryrefslogtreecommitdiff
path: root/internal/liturgy/section.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 13:01:33 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 13:01:33 +0200
commite240d4c03cc30b583a0811553580fe2a15cd1097 (patch)
tree616b80f2aecc1ca99200c15f7336a07d430700dc /internal/liturgy/section.go
parent343a675a5a779cfce5a3dec9a3ad4a6ffb22de75 (diff)
downloadlectio-e240d4c03cc30b583a0811553580fe2a15cd1097.tar.gz
lectio-e240d4c03cc30b583a0811553580fe2a15cd1097.zip
liturgy: Section type + HTML parse (fixtures)
Ports parse_sections, html_to_lines, extract_reference from ewangelia.py. Parse(html) prefers the tabnowy0all lectionary tab (falls back to tabstary0all) and errors loudly if the tab is present-but-empty or absent. ExtractCitation(heading) pulls the parenthetical citation. Section gains a PartID field (Addendum A): set from the heading prefix (1. czytanie -> pierwsze_czytanie, a second same-day 1. czytanie -> drugie_czytanie, Psalm -> psalm, Aklamacja -> aklamacja, Ewangelia -> ewangelia; anything else -> ""). Adds testdata/2026-07-22.html (split-feast day, two 1. czytanie sections) and testdata/2026-06-22.html (normal day), copied from ~/.cache/daily-reading/.
Diffstat (limited to 'internal/liturgy/section.go')
-rw-r--r--internal/liturgy/section.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/liturgy/section.go b/internal/liturgy/section.go
new file mode 100644
index 0000000..498b201
--- /dev/null
+++ b/internal/liturgy/section.go
@@ -0,0 +1,12 @@
+// Package liturgy parses the daily Catholic liturgy readings page into
+// structured sections (1st reading, psalm, acclamation, gospel).
+package liturgy
+
+// Section is one reading section of the liturgy page (e.g. "1. czytanie",
+// "Psalm", "Aklamacja", "Ewangelia"): its heading, optional subtitle, the
+// citation extracted from the heading, a stable identifier for which liturgical
+// part it is, and its body split into paragraphs of text lines.
+type Section struct {
+ Heading, Subtitle, Citation, PartID string
+ Paragraphs [][]string
+}