From e240d4c03cc30b583a0811553580fe2a15cd1097 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 23 Jul 2026 13:01:33 +0200 Subject: 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/. --- internal/liturgy/section.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 internal/liturgy/section.go (limited to 'internal/liturgy/section.go') 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 +} -- cgit v1.3