summaryrefslogtreecommitdiff
path: root/internal/cli
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 16:17:18 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 16:17:18 +0200
commita1e041dfbe55194c7fea0636d38cff33ee28315d (patch)
tree1138c5cbf5ca008dc3da11e93634c1017c63eeef /internal/cli
parentde102e446a715883c74e6295ff223e37e397f5ed (diff)
downloadlectio-a1e041dfbe55194c7fea0636d38cff33ee28315d.tar.gz
lectio-a1e041dfbe55194c7fea0636d38cff33ee28315d.zip
feat(ef): complete offline EF readings — proper ferias, deuterocanon, Latin fallback
Finish the Extraordinary Form (1962) offline Mass readings so every day of the year resolves in both English and Polish. Temporal engine (temporal_ef.go): - Unique ferial slugs "ef-<season>-<week>-<weekday>" so penitential-season weekdays (Lent, Advent, Passiontide, Easter octave) can key their own proper Masses; green-season ferias have no entry and fall back to the preceding Sunday (the 1962 rule). - Special "ef-lent-after-ashes-<weekday>" case for the days between Ash Wednesday and Lent I, which have their own propers. Lectionary (tridentine-lectionary.ini, 55 -> 143 entries) via genlect.go: - Generator now fetches proper-season weekdays and stores a feria only when its Mass differs from the preceding Sunday's. - cleanCite() normalises two missalemeum data glitches: a stray comma between book and chapter ("4 Kings, 5:1" -> "4 Kings 5:1") and a period-as-separator ("John 20. 19-31" -> "John 20:19-31"), both guarded so legitimate multi-chapter citations are untouched. Citations & corpora: - books.ini: Douay abbreviations in the [en] dialect (Ex, Ezech, Jonas, and 3/4 Kings -> canonical 1/2 Kings), so the EF Lenten epistles resolve while the display keeps modern sigla. - drb.tsv: +205 rows backfilling the deuterocanonical Daniel 13-14 (Susanna, Bel) and Esther 11-16 (Greek additions) from get.bible douayrheims, which the base corpus omitted; scripts/gen-deutero.py documents the fetch. Rendering (liturgy.go): - readingLine() falls back to the Latin Vulgate (complete) when the vernacular corpus lacks a passage, with a clear note. Covers the Polish Wujek deuterocanon gap (no clean public-domain source exists) and any future vernacular gap; faithful to the EF as a Latin rite. Result: 730/730 days resolve for both EN (native) and PL (native + Latin fallback for 3 deuterocanon days). Version 0.32.0 -> 0.33.0.
Diffstat (limited to 'internal/cli')
-rw-r--r--internal/cli/liturgy.go58
1 files changed, 42 insertions, 16 deletions
diff --git a/internal/cli/liturgy.go b/internal/cli/liturgy.go
index af58a34..9dcdb69 100644
--- a/internal/cli/liturgy.go
+++ b/internal/cli/liturgy.go
@@ -10,6 +10,7 @@ import (
"github.com/lukaszkasprzak/lectio/internal/caldata"
"github.com/lukaszkasprzak/lectio/internal/calendar"
"github.com/lukaszkasprzak/lectio/internal/config"
+ "github.com/lukaszkasprzak/lectio/internal/i18n"
"github.com/lukaszkasprzak/lectio/internal/render"
)
@@ -69,23 +70,44 @@ func vernacularVersion(cfg config.Config) string {
return "drb"
}
-// readingLine resolves an English-authored citation and returns (display,
-// text): display is the citation re-formatted in the user's configured sigla
-// dialect (SiglaLang); text is the verses from version (or "" if unresolved).
-// The reading data is authored in English, so it is parsed in the "en" dialect;
-// only the display honors the configured dialect's abbreviations.
-func readingLine(tbl *bible.BookTable, cfg config.Config, version, citation string) (string, string) {
+// latinFallback is the corpus used to render a passage the vernacular corpus
+// lacks: the Latin Vulgate, which carries the full canon -- including the
+// deuterocanonical Daniel (13-14) and Esther (11-16) additions the vernacular
+// corpora omit and which the EF Lenten lectionary reads. The EF is a Latin
+// rite, so the Latin is the authoritative text to fall back to.
+const latinFallback = "vul"
+
+// readingLine resolves an English-authored citation and returns (display, text,
+// used): display is the citation re-formatted in the user's configured sigla
+// dialect (SiglaLang); text is the verses; used is the version that actually
+// supplied the text -- version, else latinFallback, else "" when neither has
+// it. The reading data is authored in English, so it is parsed in the "en"
+// dialect; only the display honors the configured dialect's abbreviations.
+func readingLine(tbl *bible.BookTable, cfg config.Config, version, citation string) (display, text, used string) {
engRef, ok := tbl.ParseRef("en", citation)
if !ok {
- return citation, "" // unparseable: show as authored
+ return citation, "", "" // unparseable: show as authored
+ }
+ display = tbl.FormatRef(cfg.SiglaLang(), engRef)
+ if txt := lookupText(version, engRef); txt != "" {
+ return display, txt, version
+ }
+ if version != latinFallback {
+ if txt := lookupText(latinFallback, engRef); txt != "" {
+ return display, txt, latinFallback
+ }
}
- display := tbl.FormatRef(cfg.SiglaLang(), engRef)
- vs, _ := bible.Lookup(version, engRef)
+ return display, "", ""
+}
+
+// lookupText joins the verses of ref in version into one string ("" if none).
+func lookupText(version, ref string) string {
+ vs, _ := bible.Lookup(version, ref)
parts := make([]string, 0, len(vs))
for _, v := range vs {
parts = append(parts, strings.TrimSpace(v.Text))
}
- return display, strings.Join(parts, " ")
+ return strings.Join(parts, " ")
}
func printLiturgicalDay(out io.Writer, cfg config.Config, tbl *bible.BookTable, day calendar.LiturgicalDay, readings []calendar.Reading) {
@@ -104,14 +126,18 @@ func printLiturgicalDay(out io.Writer, cfg config.Config, tbl *bible.BookTable,
}
vern := vernacularVersion(cfg)
for _, r := range readings {
- disp, txt := readingLine(tbl, cfg, vern, r.Citation)
+ disp, txt, used := readingLine(tbl, cfg, vern, r.Citation)
fmt.Fprintf(out, "\n %s (%s):\n", r.Part, disp)
- if txt != "" {
- for _, line := range strings.Split(render.Wrap(txt, 72), "\n") {
- fmt.Fprintf(out, " %s\n", line)
- }
- } else {
+ if txt == "" {
fmt.Fprintf(out, " (text not in %s)\n", vern)
+ continue
+ }
+ if used != vern { // the vernacular lacked it; fell back to Latin
+ names := i18n.Get("en").Version
+ fmt.Fprintf(out, " [%s has no text here -- showing %s]\n", names[vern], names[used])
+ }
+ for _, line := range strings.Split(render.Wrap(txt, 72), "\n") {
+ fmt.Fprintf(out, " %s\n", line)
}
}
}