From feede51697be870ae183a95b513ef64f031dbd0f Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 28 Jul 2026 11:57:45 +0200 Subject: 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. --- internal/render/render_test.go | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'internal/render/render_test.go') diff --git a/internal/render/render_test.go b/internal/render/render_test.go index e2a26fc..00c8a85 100644 --- a/internal/render/render_test.go +++ b/internal/render/render_test.go @@ -25,7 +25,9 @@ func TestGatherBTDedup(t *testing.T) { } func TestGatherBible(t *testing.T) { - sec := liturgy.Section{Heading: "Ewangelia (J 20, 1. 11-18)"} + // Offline sections carry the English-canonical lookup reference in Ref; the + // display citation stays in the reader's sigla dialect. + sec := liturgy.Section{Heading: "Ewangelia", Citation: "J 20, 1. 11-18", Ref: "John 20:1,11-18"} label, blocks := GatherVersion("wuj", sec, "new", "pl") if !strings.Contains(label, "Wujek") { t.Errorf("label = %q", label) @@ -109,23 +111,6 @@ func TestGatherVersionNoReferenceLang(t *testing.T) { } } -// TestGatherVersionNoReferenceErrLang checks the "(no reference: ...)" block -// (a citation that bible.ToEnglishRef fails to convert, e.g. an unrecognised -// book) follows lang. -func TestGatherVersionNoReferenceErrLang(t *testing.T) { - sec := liturgy.Section{Citation: "Xyz 1, 1-2"} - - _, blocks := GatherVersion("wuj", sec, "new", "pl") - if len(blocks) == 0 || !strings.HasPrefix(blocks[0], "(brak odwołania: ") { - t.Errorf(`GatherVersion(..., "pl") blocks = %v, want prefix "(brak odwołania: "`, blocks) - } - - _, blocks = GatherVersion("wuj", sec, "new", "en") - if len(blocks) == 0 || !strings.HasPrefix(blocks[0], "(no reference: ") { - t.Errorf(`GatherVersion(..., "en") blocks = %v, want prefix "(no reference: "`, blocks) - } -} - func TestOfflineVersions(t *testing.T) { got := OfflineVersions([]string{"bt", "wuj", "vul"}) for _, v := range got { @@ -136,7 +121,7 @@ func TestOfflineVersions(t *testing.T) { } func TestGatherVersesBible(t *testing.T) { - sec := liturgy.Section{Heading: "Ewangelia (J 20, 1. 11-18)"} + sec := liturgy.Section{Heading: "Ewangelia", Citation: "J 20, 1. 11-18", Ref: "John 20:1,11-18"} label, verses, versified := GatherVerses("wuj", sec, "new", "pl") if !strings.Contains(label, "Wujek") { t.Errorf("label = %q", label) -- cgit v1.3