From a865374755480a4aef2a6156afccdf08a91422ea Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 24 Jul 2026 09:55:36 +0200 Subject: rename the pl scripture version to bt (Biblia Tysiąclecia); v0.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The niedziela.pl scraped Polish paragraph text is the Biblia Tysiąclecia translation; rename its version code from "pl" to "bt" and its i18n label to "Biblia Tysiąclecia (niedziela.pl)" everywhere the scripture VERSION is meant, across config, i18n, render, web, tui, cli and both binaries' help text. Language-role "pl" (ui_language, traditional_lang, i18n.Get lang, --lang validation) is untouched. Behavior is identical -- bt is still dropped for offline/traditional and substituted with wuj. --- internal/cli/cli.go | 16 ++++++++-------- internal/config/config.go | 16 ++++++++-------- internal/config/config.toml | 4 ++-- internal/config/config_test.go | 2 +- internal/i18n/i18n.go | 6 +++--- internal/i18n/i18n_test.go | 4 ++-- internal/render/render.go | 24 ++++++++++++------------ internal/render/render_test.go | 18 +++++++++--------- internal/tui/tui.go | 6 +++--- internal/tui/tui_test.go | 14 +++++++------- internal/web/render.go | 14 +++++++------- internal/web/render_test.go | 12 ++++++------ internal/web/server.go | 2 +- internal/web/server_test.go | 10 +++++----- 14 files changed, 74 insertions(+), 74 deletions(-) (limited to 'internal') diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 253e718..f4aec28 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -28,7 +28,7 @@ Usage: Flags: -a, --all all readings, not just the gospel - -b, --bible VER one version's text: pl,wuj,vul,grb,drb + -b, --bible VER one version's text: bt,wuj,vul,grb,drb -c, --compare LIST versions side by side (comma-separated) -r, --raw text only, no banner/headings (for piping) -w, --width N wrap width; 0 = detect terminal @@ -43,13 +43,13 @@ Flags: -v, --version print the version and exit -h, --help this help -Versions: pl (Polski/niedziela.pl) wuj (Wujek) vul (Wulgata) grb (Grecki) +Versions: bt (Biblia Tysiąclecia) wuj (Wujek) vul (Wulgata) grb (Grecki) drb (Douay-Rheims) Examples: lectio today's gospel lectio 2026-07-22 -a all readings for a date - lectio -c pl,wuj 2026-07-22 compare two versions for a date + lectio -c bt,wuj 2026-07-22 compare two versions for a date lectio -b vul -a Vulgate text, all readings lectio -l trad -a traditional lectionary, all readings lectio -u harvest sigla to the horizon @@ -100,8 +100,8 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int { fs.BoolVar(&all, "a", false, "all readings, not just the gospel") fs.BoolVar(&all, "all", false, "all readings, not just the gospel") - fs.StringVar(&bibleVer, "b", "", "one version's text: pl,wuj,vul,grb,drb") - fs.StringVar(&bibleVer, "bible", "", "one version's text: pl,wuj,vul,grb,drb") + fs.StringVar(&bibleVer, "b", "", "one version's text: bt,wuj,vul,grb,drb") + fs.StringVar(&bibleVer, "bible", "", "one version's text: bt,wuj,vul,grb,drb") fs.StringVar(&compareList, "c", "", "versions side by side (comma list)") fs.StringVar(&compareList, "compare", "", "versions side by side (comma list)") fs.BoolVar(&raw, "r", false, "text only, no banner/headings") @@ -182,13 +182,13 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int { // compareList != "", bibleVer is unused (compare wins, as before) so it's // deliberately left unvalidated in that case. if bibleVer != "" && compareList == "" && !config.ValidVersion(bibleVer) { - fmt.Fprintf(stderr, "lectio: unknown version %q (want one of pl, wuj, vul, grb, drb)\n", bibleVer) + fmt.Fprintf(stderr, "lectio: unknown version %q (want one of bt, wuj, vul, grb, drb)\n", bibleVer) return 2 } if compareList != "" { for _, v := range strings.Split(compareList, ",") { if v = strings.TrimSpace(v); v != "" && !config.ValidVersion(v) { - fmt.Fprintf(stderr, "lectio: unknown version %q (want one of pl, wuj, vul, grb, drb)\n", v) + fmt.Fprintf(stderr, "lectio: unknown version %q (want one of bt, wuj, vul, grb, drb)\n", v) return 2 } } @@ -469,7 +469,7 @@ func renderCompare(cfg config.Config, list, date string, all, raw bool, width in } for _, v := range versions { if !config.ValidVersion(v) { - fmt.Fprintf(stderr, "lectio: unknown version %q (want one of pl, wuj, vul, grb, drb)\n", v) + fmt.Fprintf(stderr, "lectio: unknown version %q (want one of bt, wuj, vul, grb, drb)\n", v) return 2 } } diff --git a/internal/config/config.go b/internal/config/config.go index 5102d38..bee48a7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -24,11 +24,11 @@ var seedTOML []byte // Version is lectio's release version, shared by every binary's // -v/--version output (lectio, lectio-ui, lectio-web). -const Version = "0.3.0" +const Version = "0.4.0" // validVersions are the five scripture versions lectio understands. var validVersions = map[string]bool{ - "pl": true, + "bt": true, "wuj": true, "vul": true, "grb": true, @@ -36,7 +36,7 @@ var validVersions = map[string]bool{ } // ValidVersion reports whether v is one of the five scripture versions -// lectio understands (pl, wuj, vul, grb, drb). +// lectio understands (bt, wuj, vul, grb, drb). func ValidVersion(v string) bool { return validVersions[v] } @@ -129,8 +129,8 @@ func Default() Config { SchemaVersion: 1, Lectionary: "new", TraditionalLang: "pl", - Versions: []string{"pl", "wuj", "vul", "grb", "drb"}, - DefaultVersion: "pl", + Versions: []string{"bt", "wuj", "vul", "grb", "drb"}, + DefaultVersion: "bt", Width: 0, All: false, Offline: false, @@ -227,15 +227,15 @@ func validate(cfg Config) error { } for _, v := range cfg.Versions { if !validVersions[v] { - return fmt.Errorf("config: invalid version %q in versions (must be one of pl, wuj, vul, grb, drb)", v) + return fmt.Errorf("config: invalid version %q in versions (must be one of bt, wuj, vul, grb, drb)", v) } } if !validVersions[cfg.DefaultVersion] { - return fmt.Errorf("config: invalid default_version %q (must be one of pl, wuj, vul, grb, drb)", cfg.DefaultVersion) + return fmt.Errorf("config: invalid default_version %q (must be one of bt, wuj, vul, grb, drb)", cfg.DefaultVersion) } for _, v := range cfg.WebVersions { if !validVersions[v] { - return fmt.Errorf("config: invalid version %q in web_versions (must be one of pl, wuj, vul, grb, drb)", v) + return fmt.Errorf("config: invalid version %q in web_versions (must be one of bt, wuj, vul, grb, drb)", v) } } return nil diff --git a/internal/config/config.toml b/internal/config/config.toml index 49cca7f..656ddc5 100644 --- a/internal/config/config.toml +++ b/internal/config/config.toml @@ -1,8 +1,8 @@ schema_version = 1 lectionary = "new" # "new" (niedziela.pl) or "traditional" (missalemeum, 1962) traditional_lang = "pl" # vernacular for traditional propers: "pl" or "en" -versions = ["pl", "wuj", "vul", "grb", "drb"] # compare set + TUI cycle order -default_version = "pl" # TUI start / `lectio show` default +versions = ["bt", "wuj", "vul", "grb", "drb"] # compare set + TUI cycle order +default_version = "bt" # TUI start / `lectio show` default width = 0 # CLI wrap width; 0 = detect terminal all = false # default to all parts (true) or just the gospel (false) offline = false # true = never fetch; read only harvested sigla + cache diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 0f7bea8..a72383b 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -13,7 +13,7 @@ func TestLoadSeeds(t *testing.T) { if err != nil { t.Fatal(err) } - if cfg.DefaultVersion != "pl" || cfg.Offline { + if cfg.DefaultVersion != "bt" || cfg.Offline { t.Errorf("defaults wrong: %+v", cfg) } if cfg.Lectionary != "new" { diff --git a/internal/i18n/i18n.go b/internal/i18n/i18n.go index 4d034a5..a108323 100644 --- a/internal/i18n/i18n.go +++ b/internal/i18n/i18n.go @@ -8,7 +8,7 @@ package i18n // UI is one language's complete set of chrome strings. type UI struct { // Version names each bible version for column headers / prose, keyed by - // version code (pl, wuj, vul, grb, drb). + // version code (bt, wuj, vul, grb, drb). Version map[string]string // PartLabel names each modern-lectionary section's heading label word, @@ -64,7 +64,7 @@ func Get(lang string) UI { var enUI = UI{ Version: map[string]string{ - "pl": "Polish (niedziela.pl)", + "bt": "Biblia Tysiąclecia (niedziela.pl)", "wuj": "Wujek (Polish)", "vul": "Vulgate (Latin)", "grb": "Greek", @@ -107,7 +107,7 @@ var enUI = UI{ var plUI = UI{ Version: map[string]string{ - "pl": "Polski (niedziela.pl)", + "bt": "Biblia Tysiąclecia (niedziela.pl)", "wuj": "Wujek (pol.)", "vul": "Wulgata (lac.)", "grb": "Grecki", diff --git a/internal/i18n/i18n_test.go b/internal/i18n/i18n_test.go index 59771a8..381f87b 100644 --- a/internal/i18n/i18n_test.go +++ b/internal/i18n/i18n_test.go @@ -28,8 +28,8 @@ func TestVersionLabels(t *testing.T) { cases := []struct { lang, code, want string }{ - {"en", "pl", "Polish (niedziela.pl)"}, - {"pl", "pl", "Polski (niedziela.pl)"}, + {"en", "bt", "Biblia Tysiąclecia (niedziela.pl)"}, + {"pl", "bt", "Biblia Tysiąclecia (niedziela.pl)"}, {"en", "wuj", "Wujek (Polish)"}, {"pl", "wuj", "Wujek (pol.)"}, {"en", "vul", "Vulgate (Latin)"}, diff --git a/internal/render/render.go b/internal/render/render.go index 8a36f12..7ba8ebd 100644 --- a/internal/render/render.go +++ b/internal/render/render.go @@ -96,8 +96,8 @@ const incipit = "Słowa Ewangelii" // 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 == "pl" { - return label, gatherPL(sec) + if version == "bt" { + return label, gatherBT(sec) } ref, err := resolveRef(version, sec, lectionary, lang) @@ -120,7 +120,7 @@ func GatherVersion(version string, sec liturgy.Section, lectionary, lang string) return label, blocks } -// resolveRef resolves a non-"pl" version's bible.Lookup reference for sec: +// resolveRef resolves a non-"bt" version's bible.Lookup reference for sec: // sec.Citation (or, failing that, the citation extracted from sec.Heading), // converted to English/kjv-style via bible.ToEnglishRef when // lectionary=="new" (a "traditional" citation is already English-style and @@ -151,13 +151,13 @@ 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 "pl" +// 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. func GatherVerses(version string, sec liturgy.Section, lectionary, lang string) (label string, verses []bible.Verse, versified bool) { label = versionLabel(version, lang) - if version == "pl" { + if version == "bt" { return label, nil, false } @@ -173,10 +173,10 @@ func GatherVerses(version string, sec liturgy.Section, lectionary, lang string) return label, verses, true } -// gatherPL returns the section's paragraphs, one block per paragraph, with +// 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 gatherPL(sec liturgy.Section) []string { +func gatherBT(sec liturgy.Section) []string { var blocks []string for _, p := range sec.Paragraphs { b := strings.Join(p, " ") @@ -198,9 +198,9 @@ func gatherPL(sec liturgy.Section) []string { return deduped } -// OfflineVersions drops "pl" (which needs the network fetch of the liturgy -// page) from versions. If "pl" was present but "wuj" (the Polish-language -// bible version) was not, "wuj" takes pl's place, so the offline set still +// 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. func OfflineVersions(versions []string) []string { hadWuj := false @@ -213,7 +213,7 @@ func OfflineVersions(versions []string) []string { out := make([]string, 0, len(versions)) for _, v := range versions { - if v == "pl" { + if v == "bt" { if hadWuj { continue } @@ -225,7 +225,7 @@ func OfflineVersions(versions []string) []string { return out } -// EffectiveVersions is the version set actually loadable for a request: "pl" +// 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 diff --git a/internal/render/render_test.go b/internal/render/render_test.go index affaaf8..496dc23 100644 --- a/internal/render/render_test.go +++ b/internal/render/render_test.go @@ -7,12 +7,12 @@ import ( "github.com/lukaszkasprzak/lectio/internal/liturgy" ) -func TestGatherPLDedup(t *testing.T) { +func TestGatherBTDedup(t *testing.T) { sec := liturgy.Section{ Heading: "Psalm (Ps 1)", Paragraphs: [][]string{{"stanza one"}, {"refrain"}, {"stanza two"}, {"refrain"}}, } - _, blocks := GatherVersion("pl", sec, "new", "pl") + _, blocks := GatherVersion("bt", sec, "new", "pl") n := 0 for _, b := range blocks { if b == "refrain" { @@ -127,10 +127,10 @@ func TestGatherVersionNoReferenceErrLang(t *testing.T) { } func TestOfflineVersions(t *testing.T) { - got := OfflineVersions([]string{"pl", "wuj", "vul"}) + got := OfflineVersions([]string{"bt", "wuj", "vul"}) for _, v := range got { - if v == "pl" { - t.Error("pl not dropped offline") + if v == "bt" { + t.Error("bt not dropped offline") } } } @@ -152,17 +152,17 @@ func TestGatherVersesBible(t *testing.T) { } } -func TestGatherVersesPL(t *testing.T) { +func TestGatherVersesBT(t *testing.T) { sec := liturgy.Section{ Heading: "Psalm (Ps 1)", Paragraphs: [][]string{{"stanza one"}}, } - _, verses, versified := GatherVerses("pl", sec, "new", "pl") + _, verses, versified := GatherVerses("bt", sec, "new", "pl") if versified { - t.Error("versified = true, want false for pl (paragraph text, no verse numbers)") + t.Error("versified = true, want false for bt (paragraph text, no verse numbers)") } if verses != nil { - t.Errorf("verses = %+v, want nil for pl", verses) + t.Errorf("verses = %+v, want nil for bt", verses) } } diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 16cb304..db0e8da 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -43,7 +43,7 @@ type errMsg struct { err error } -// New builds the initial model: cfg.Offline drops "pl" from the version +// New builds the initial model: cfg.Offline drops "bt" from the version // list (render.OfflineVersions). startVersion selects the active version // (falling back to cfg.DefaultVersion when ""), still resolved through // EffectiveVersions/indexOf so an unavailable version falls back to index 0. @@ -334,9 +334,9 @@ func (m Model) bodyLines(w int) []string { _, blocks := render.GatherVersion(ver, sec, m.cfg.Lectionary, m.cfg.UILanguage) numW := maxNumWidth(blocks) - // The refrain-italic only applies to the pl responsorial-psalm block + // The refrain-italic only applies to the bt responsorial-psalm block // (its first, deduped paragraph); bible versions have no refrain block. - isPsalm := sec.PartID == "psalm" && ver == "pl" + isPsalm := sec.PartID == "psalm" && ver == "bt" for bi, b := range blocks { refrain := isPsalm && bi == 0 lines = append(lines, styleBlock(b, refrain, w, numW)...) diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go index 2b966ee..85a8175 100644 --- a/internal/tui/tui_test.go +++ b/internal/tui/tui_test.go @@ -10,8 +10,8 @@ import ( ) func TestVersionCycle(t *testing.T) { - m := New(config.Config{Versions: []string{"pl", "wuj", "vul"}, DefaultVersion: "pl"}, "", "") - if m.version() != "pl" { + m := New(config.Config{Versions: []string{"bt", "wuj", "vul"}, DefaultVersion: "bt"}, "", "") + if m.version() != "bt" { t.Fatalf("start = %q", m.version()) } m = m.cycleVersion(+1) @@ -19,16 +19,16 @@ func TestVersionCycle(t *testing.T) { t.Errorf("after tab = %q", m.version()) } m = m.cycleVersion(-1) - if m.version() != "pl" { + if m.version() != "bt" { t.Errorf("after shift-tab = %q", m.version()) } } -func TestOfflineDropsPL(t *testing.T) { - m := New(config.Config{Versions: []string{"pl", "wuj", "vul"}, DefaultVersion: "pl", Offline: true}, "", "") +func TestOfflineDropsBT(t *testing.T) { + m := New(config.Config{Versions: []string{"bt", "wuj", "vul"}, DefaultVersion: "bt", Offline: true}, "", "") for _, v := range m.versions { - if v == "pl" { - t.Error("offline model kept pl") + if v == "bt" { + t.Error("offline model kept bt") } } } diff --git a/internal/web/render.go b/internal/web/render.go index 208fc59..1afee1c 100644 --- a/internal/web/render.go +++ b/internal/web/render.go @@ -55,7 +55,7 @@ type columnView struct { // blockView is one paragraph or verse line. VNum is set (and Text holds // only the verse text) when the block was a bible verse line; otherwise // VNum is empty and Text holds the whole block, with Refrain set for a -// responsorial psalm's deduped first ("pl") block. +// responsorial psalm's deduped first ("bt") block. type blockView struct { VNum, Text string Refrain bool @@ -89,9 +89,9 @@ type ilLineView struct { // - "vertical": the same per-version columns side by side in a // ".display-vertical" grid, like the CLI `compare` view. // - "interlinear": versions interleaved verse-by-verse by chapter:verse -// (see buildInterlinearViews); "pl" cannot participate (no verse +// (see buildInterlinearViews); "bt" cannot participate (no verse // numbers) and is substituted/dropped via render.OfflineVersions' -// pl->wuj transform before gathering. +// bt->wuj transform before gathering. // // In every mode, heading, citation (subtitle), verse-number and refrain // text are wrapped in class="heading|citation|vnum|refrain|version-label" @@ -140,7 +140,7 @@ func buildColumnViews(secs []liturgy.Section, versions []string, lectionary, lan bviews := make([]blockView, 0, len(blocks)) for bi, b := range blocks { // A bible verse line always carries its "chapter:verse " - // prefix; only text without one (i.e. the "pl" version's + // prefix; only text without one (i.e. the "bt" version's // paragraphs) can be the deduped psalm refrain -- matches // internal/tui's styleBlock precedence. if m := verseNumRe.FindStringSubmatch(b); m != nil { @@ -162,8 +162,8 @@ func buildColumnViews(secs []liturgy.Section, versions []string, lectionary, lan return views } -// interlinearVersions maps versions through the same pl->wuj substitution -// render.OfflineVersions performs for offline mode: "pl" (niedziela.pl +// interlinearVersions maps versions through the same bt->wuj substitution +// render.OfflineVersions performs for offline mode: "bt" (niedziela.pl // paragraph text) carries no verse numbers and cannot interleave, so it is // dropped, substituting "wuj" (the Polish-language bible version) in its // place unless "wuj" was already selected. Reuses render.OfflineVersions @@ -173,7 +173,7 @@ func interlinearVersions(versions []string) []string { } // buildInterlinearViews gathers each requested version's verses via -// render.GatherVerses (after the pl->wuj substitution, see +// render.GatherVerses (after the bt->wuj substitution, see // interlinearVersions) and interleaves them by chapter:verse: the ordered // union of keys is taken from the first versified version's own verse // order, then any keys that only appear in a later version are appended in diff --git a/internal/web/render_test.go b/internal/web/render_test.go index 494cdcd..b7f5b1e 100644 --- a/internal/web/render_test.go +++ b/internal/web/render_test.go @@ -45,7 +45,7 @@ func TestRenderReadingsEscapesScriptText(t *testing.T) { PartID: "pierwsze_czytanie", Paragraphs: [][]string{{""}}, }} - html := string(RenderReadings(secs, []string{"pl"}, "new", "horizontal", "pl")) + html := string(RenderReadings(secs, []string{"bt"}, "new", "horizontal", "pl")) if strings.Contains(html, "") { t.Errorf("raw