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/readings/readings.go | 44 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) (limited to 'internal/readings/readings.go') diff --git a/internal/readings/readings.go b/internal/readings/readings.go index 49c9adc..b6fae51 100644 --- a/internal/readings/readings.go +++ b/internal/readings/readings.go @@ -1,7 +1,8 @@ -// Package readings is the single entry point the CLI and TUI use to fetch -// a day's readings. It routes between the modern (liturgy) and traditional -// (tradlit) lectionaries by config, then applies part filtering, returning -// source-agnostic liturgy.Section values either way. +// Package readings is the single entry point the CLI and TUI use to resolve a +// day's readings. It computes them offline from the embedded calendar engine +// and lectionary data (Ordinary Form when cfg.Lectionary is "new", the 1962 +// Extraordinary Form when "traditional"), then applies part filtering, returning +// source-agnostic liturgy.Section values. package readings import ( @@ -9,51 +10,30 @@ import ( "github.com/lukaszkasprzak/lectio/internal/config" "github.com/lukaszkasprzak/lectio/internal/liturgy" - "github.com/lukaszkasprzak/lectio/internal/tradlit" ) // Options controls how Load resolves a day's readings. type Options struct { // Date is the day to load, formatted YYYY-MM-DD. Date string - // Refresh bypasses cache layers and re-fetches from the network - // (modern lectionary only; see liturgy.Options.Refresh). + // Refresh and Offline are retained for caller compatibility but no longer + // have any effect: readings are always computed offline from embedded data. Refresh bool - // Offline restricts Load to previously cached/harvested data, never - // hitting the network (both lectionaries; see liturgy.Options.Offline - // and tradlit.Load's offline parameter). Offline bool // All, when true, keeps every part the config doesn't explicitly hide; // when false, only the gospel is kept. All bool } -// Load fetches the day's sections and its DayInfo (celebration name, -// temporal, liturgical colour -- see liturgy.DayInfo) for the configured -// lectionary (cfg.Lectionary: "traditional" or "new") and applies part -// filtering. Returns liturgy.Section values regardless of source. A source -// that yields no DayInfo (see liturgy.Load/tradlit.Load) comes back as a -// zero liturgy.DayInfo, not an error -- callers omit the header for it. +// Load computes the day's sections and its DayInfo (celebration name, +// liturgical colour -- see liturgy.DayInfo) for the configured form +// (cfg.Lectionary: "traditional" or "new") and applies part filtering. Every +// reading is resolved offline from the embedded calendar and lectionary data. func Load(cfg config.Config, opts Options) ([]liturgy.Section, liturgy.DayInfo, error) { - offline := opts.Offline || cfg.Offline - - var secs []liturgy.Section - var info liturgy.DayInfo - var err error - - if cfg.Lectionary == "traditional" { - secs, info, err = tradlit.Load(opts.Date, cfg.TraditionalLang, offline) - } else { - secs, info, err = liturgy.Load(liturgy.Options{ - Date: opts.Date, - Refresh: opts.Refresh, - Offline: offline, - }) - } + secs, info, err := offlineLoad(cfg, opts.Date) if err != nil { return nil, liturgy.DayInfo{}, err } - return filterParts(secs, cfg, opts.All), info, nil } -- cgit v1.3