aboutsummaryrefslogtreecommitdiff
path: root/internal/render/render.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 11:57:45 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 11:57:45 +0200
commitfeede51697be870ae183a95b513ef64f031dbd0f (patch)
tree6700a80f996d2bba204c0452db2d2bbc16bff619 /internal/render/render.go
parent626f2275438a37e5cd2efb5964281b9bef5ce8cc (diff)
downloadlectio-feede51697be870ae183a95b513ef64f031dbd0f.tar.gz
lectio-feede51697be870ae183a95b513ef64f031dbd0f.zip
feat(readings): compute the daily view offline (OF + EF)
Route readings.Load through the embedded calendar engine and lectionary data instead of the niedziela/missalemeum scrapers. The daily view now computes each day (calendar.Compute + caldata.Readings) and renders text from the public-domain corpora, with citations resolved per corpus. - bible.OFRef: normalise an English-canonical OF citation (drop sub-verse letters, ";" -> ",") and renumber Psalms for the target Psalter (Hebrew->Vulgate chapter for vul/grb/wuj; DRB title-fold verses for drb). - liturgy.Section gains Ref (English-canonical lookup ref) alongside Citation (sigla-dialect display); the loader fills both, resolveRef uses Ref, headings/citation command show Citation. - EffectiveVersions always drops "bt" (no offline corpus); the single daily version defaults to vernacularVersion (reading corpus else Latin). Scraper packages remain in the tree, unreferenced, pending removal.
Diffstat (limited to 'internal/render/render.go')
-rw-r--r--internal/render/render.go33
1 files changed, 17 insertions, 16 deletions
diff --git a/internal/render/render.go b/internal/render/render.go
index 6cdb939..3d685d2 100644
--- a/internal/render/render.go
+++ b/internal/render/render.go
@@ -146,7 +146,12 @@ func GatherVersion(version string, sec liturgy.Section, lectionary, lang string)
// it never affects which reference is resolved.
func resolveRef(version string, sec liturgy.Section, lectionary, lang string) (string, error) {
ui := i18n.Get(lang)
- citation := sec.Citation
+ // Ref is the English-canonical lookup reference; fall back to the display
+ // citation (or the one embedded in the heading) for sections that carry none.
+ citation := sec.Ref
+ if citation == "" {
+ citation = sec.Citation
+ }
if citation == "" {
if c, err := liturgy.ExtractCitation(sec.Heading); err == nil {
citation = c
@@ -157,13 +162,11 @@ func resolveRef(version string, sec liturgy.Section, lectionary, lang string) (s
}
if lectionary != "new" {
- return citation, nil
+ return citation, nil // Extraordinary Form: already Vulgate-numbered
}
- ref, err := bible.ToEnglishRef(citation, system(version))
- if err != nil {
- return "", fmt.Errorf(ui.NoReferenceErr, err)
- }
- return ref, nil
+ // Ordinary Form: the citation is lectio's English-canonical, modern-numbered
+ // form; renumber only the Psalms for the target corpus's Psalter.
+ return bible.OFRef(citation, system(version)), nil
}
// GatherVerses returns one version's verses for a section as raw bible.Verse
@@ -242,16 +245,14 @@ func OfflineVersions(versions []string) []string {
}
// EffectiveVersions is the version set actually loadable for a request: "bt"
-// (the niedziela.pl modern scrape) is dropped -- substituting "wuj" if it was
-// the only Polish column, via OfflineVersions -- whenever the scrape is
-// unavailable: offline (never fetch) OR the traditional lectionary
-// (missalemeum, which has no niedziela.pl scrape). Shared by cli, tui and web
-// so all three binaries treat traditional/offline versions identically.
+// (the former niedziela.pl modern scrape) has no embedded corpus, so it is
+// always dropped -- substituting "wuj" if it was the only Polish column, via
+// OfflineVersions. Every reading is now rendered offline from an embedded
+// corpus, so the swap is unconditional; the lectionary and offline arguments
+// are retained for caller compatibility but no longer change the result.
+// Shared by cli, tui and web so all three binaries agree on the version set.
func EffectiveVersions(versions []string, lectionary string, offline bool) []string {
- if offline || lectionary == "traditional" {
- return OfflineVersions(versions)
- }
- return versions
+ return OfflineVersions(versions)
}
// Compare lays the versions of one reading section out as parallel columns,