diff options
Diffstat (limited to 'internal/render')
| -rw-r--r-- | internal/render/render.go | 24 | ||||
| -rw-r--r-- | internal/render/render_test.go | 18 |
2 files changed, 21 insertions, 21 deletions
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) } } |
