aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 10:45:09 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 10:45:09 +0200
commitd571091e25e87758c3c77fbc8b2d935bcc8304a4 (patch)
tree5a523c231760040d57ebb2e556d17656b0c0ba81 /scripts
parent44cb30b7ffcd776b26952080d1ec3587282a3db4 (diff)
downloadlectio-d571091e25e87758c3c77fbc8b2d935bcc8304a4.tar.gz
lectio-d571091e25e87758c3c77fbc8b2d935bcc8304a4.zip
feat(of): Christmas-season weekday ferials from catholic-resources.org (date-based)
Completes the seasonal weekday lectionary. The Christmas-season weekdays sit on the AdventChristmas page in a SHIFTED 6-column layout (Day in c[1], not c[2] like Advent's 7-column) -- the generator now finds the Day column wherever it is. Adds date-based slugs to temporal.go: christmas-dec-<29..31> (octave), christmas-jan-<2..7> (before Epiphany), christmas-after-epiphany-<weekday> (before the Baptism). Fixes the christmas-octave-fri coverage gap and the by-date/by-week collision. 362/362 seasonal ferial-days render across 2026-2029 with 0 gaps. Extends TestOFSeasonalFerials. All of Advent/Lent/Easter/Christmas weekdays now CR-sourced; only the Commons remain (optional -- memorials default to the ferial).
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genlect-of-season-ferials-cr.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/genlect-of-season-ferials-cr.py b/scripts/genlect-of-season-ferials-cr.py
index 13c56a3..4cca802 100644
--- a/scripts/genlect-of-season-ferials-cr.py
+++ b/scripts/genlect-of-season-ferials-cr.py
@@ -66,6 +66,12 @@ def slug_of(day):
d = re.sub(r"\s+", " ", st(day).lower())
m = re.match(r"december (\d+)", d) # late Advent Dec 17-24: proper to the date
if m and 17 <= int(m.group(1)) <= 24: return "advent-dec-" + m.group(1)
+ m = re.match(r"dec\.? (\d+)", d) # Christmas octave ferials Dec 29-31
+ if m and 29 <= int(m.group(1)) <= 31: return "christmas-dec-" + m.group(1)
+ m = re.match(r"\[?\s*jan\.? (\d+)", d) # Christmas weekdays before Epiphany, Jan 2-7
+ if m and 2 <= int(m.group(1)) <= 7: return "christmas-jan-" + m.group(1)
+ m = re.match(r"(monday|tuesday|wednesday|thursday|friday|saturday) after epiphany", d)
+ if m: return "christmas-after-epiphany-" + WD[m.group(1)]
if "ash wednesday" in d: return "lent-after-ashes-wed"
m = re.match(r"(thursday|friday|saturday) after ash", d)
if m: return "lent-after-ashes-" + WD[m.group(1)]
@@ -87,12 +93,18 @@ def main():
n = 0
for tr in re.split(r"<tr\b", h):
c = [x for x in re.findall(r"<td\b[^>]*>(.*?)</td>", tr, re.S)]
- if len(c) < 6: continue
- slug = slug_of(c[2])
- if not slug: continue
- cr[slug] = {"first": clean_cite(c[3]), "psalm": clean_cite(c[4]), "gospel": clean_cite(c[-1])}
+ if len(c) < 5: continue
+ # the "Day" column sits at c[2] (Advent's 7-col table) or c[1] (the
+ # Christmas 6-col table) — find it by which cell yields a slug, then the
+ # readings follow it (first, psalm, ..., gospel last).
+ di = next((i for i, cell in enumerate(c) if slug_of(cell)), None)
+ if di is None or di + 1 >= len(c): continue
+ slug = slug_of(c[di])
+ cr[slug] = {"first": clean_cite(c[di + 1]),
+ "psalm": clean_cite(c[di + 2]) if di + 2 < len(c) - 1 else "",
+ "gospel": clean_cite(c[-1])}
n += 1
- sys.stderr.write(f"{p}: {n} week-based seasonal ferials\n")
+ sys.stderr.write(f"{p}: {n} seasonal ferials mapped\n")
text = open(INI).read()
head = text[:text.index("\n[")]