aboutsummaryrefslogtreecommitdiff
path: root/internal/render/render.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 12:50:31 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 12:50:31 +0200
commit7b220084cf3951c8cde0582efdfcf628afc64336 (patch)
treee74bae03c61b62479ef4f68b046e3345618933c8 /internal/render/render.go
parentfeede51697be870ae183a95b513ef64f031dbd0f (diff)
downloadlectio-7b220084cf3951c8cde0582efdfcf628afc64336.tar.gz
lectio-7b220084cf3951c8cde0582efdfcf628afc64336.zip
refactor: remove the niedziela/missalemeum scrapers, bt, traditional_lang
The daily view now computes entirely offline (previous commit), so retire the network path and everything that served it: - Delete internal/tradlit (missalemeum) and the niedziela scraper from internal/liturgy (fetch/store/parse + fixtures); keep Section, DayInfo and ExtractCitation. - Remove the "bt" version everywhere (render gatherBT + branches, config, i18n, web form, TUI) and bible.ToEnglishRef (Polish citation converter). A legacy config carrying "bt" migrates to "wuj" on load (config.migrateBT). - Remove the traditional_lang config field and the -g/--lang flag from all three binaries. - Drop the now-dead flags -R/--refresh, -o/--offline, -u/--update, -C/--clean and the harvest/clean commands. - New defaults: versions = wuj,vul,grb,drb; default_version = vul. Update the README (offline-by-design, no harvest/update), help text, and stale niedziela/bt doc comments. Tests updated for the offline reality; go test ./... and go vet ./... are clean, all three binaries build and run offline (OF + EF, compare, web).
Diffstat (limited to 'internal/render/render.go')
-rw-r--r--internal/render/render.go63
1 files changed, 15 insertions, 48 deletions
diff --git a/internal/render/render.go b/internal/render/render.go
index 3d685d2..c744aac 100644
--- a/internal/render/render.go
+++ b/internal/render/render.go
@@ -99,22 +99,17 @@ func system(version string) string {
return "vulgate"
}
-const incipit = "Słowa Ewangelii"
-
// GatherVersion returns (label, blocks) for one version of one reading
-// section. Each block is a paragraph (Polish) or a verse line (bible
-// versions); on any failure the blocks hold a single short note instead.
+// section. Each block is a verse line; on any failure the blocks hold a single
+// short note instead.
//
-// lectionary selects how sec.Citation is read: "new" (modern/niedziela.pl)
-// citations are Polish and go through bible.ToEnglishRef; "traditional"
-// (missalemeum) citations are already English kjv-style and are used as-is.
-// lang selects the UI chrome language the label comes from (see
-// internal/i18n); it never affects the verse text/citation itself.
+// lectionary selects how sec.Ref is renumbered: "new" (Ordinary Form) refs are
+// modern-numbered and go through bible.OFRef for the target Psalter;
+// "traditional" (1962) refs are already Vulgate-numbered and used as-is. lang
+// selects the UI chrome language the label comes from (see internal/i18n); it
+// never affects the verse text/citation itself.
func GatherVersion(version string, sec liturgy.Section, lectionary, lang string) (label string, blocks []string) {
label = versionLabel(version, lang)
- if version == "bt" {
- return label, gatherBT(sec)
- }
ref, err := resolveRef(version, sec, lectionary, lang)
if err != nil {
@@ -170,15 +165,12 @@ func resolveRef(version string, sec liturgy.Section, lectionary, lang string) (s
}
// GatherVerses returns one version's verses for a section as raw bible.Verse
-// structs (for column/interlinear alignment). versified is false for "bt"
-// (paragraph text, no verse numbers) and on any resolution/lookup failure --
-// callers fall back to GatherVersion's string blocks for those. lang selects
-// the UI chrome language the label comes from, same as GatherVersion.
+// structs (for column/interlinear alignment). versified is false on any
+// resolution/lookup failure -- callers fall back to GatherVersion's string
+// blocks for those. lang selects the UI chrome language the label comes from,
+// same as GatherVersion.
func GatherVerses(version string, sec liturgy.Section, lectionary, lang string) (label string, verses []bible.Verse, versified bool) {
label = versionLabel(version, lang)
- if version == "bt" {
- return label, nil, false
- }
ref, err := resolveRef(version, sec, lectionary, lang)
if err != nil {
@@ -192,35 +184,10 @@ func GatherVerses(version string, sec liturgy.Section, lectionary, lang string)
return label, verses, true
}
-// gatherBT returns the section's paragraphs, one block per paragraph, with
-// the liturgical incipit ("Słowa Ewangelii według ...") dropped and repeated
-// blocks (a responsorial psalm's refrain) deduped to their first occurrence.
-func gatherBT(sec liturgy.Section) []string {
- var blocks []string
- for _, p := range sec.Paragraphs {
- b := strings.Join(p, " ")
- if strings.HasPrefix(b, incipit) {
- continue
- }
- blocks = append(blocks, b)
- }
-
- seen := map[string]bool{}
- deduped := make([]string, 0, len(blocks))
- for _, b := range blocks {
- if seen[b] {
- continue
- }
- seen[b] = true
- deduped = append(deduped, b)
- }
- return deduped
-}
-
-// OfflineVersions drops "bt" (which needs the network fetch of the liturgy
-// page) from versions. If "bt" was present but "wuj" (the Polish-language
-// bible version) was not, "wuj" takes bt's place, so the offline set still
-// carries a Polish column.
+// OfflineVersions maps a legacy "bt" version (the retired niedziela.pl scrape,
+// which has no embedded corpus) to "wuj", or drops it when "wuj" is already
+// present so the set keeps a single Polish column. Config load migrates bt out
+// (see config.migrateBT), so this only guards versions passed in directly.
func OfflineVersions(versions []string) []string {
hadWuj := false
for _, v := range versions {