diff options
Diffstat (limited to 'internal/render')
| -rw-r--r-- | internal/render/render.go | 63 | ||||
| -rw-r--r-- | internal/render/render_test.go | 17 |
2 files changed, 15 insertions, 65 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 { diff --git a/internal/render/render_test.go b/internal/render/render_test.go index 00c8a85..dd177bb 100644 --- a/internal/render/render_test.go +++ b/internal/render/render_test.go @@ -7,23 +7,6 @@ import ( "github.com/lukaszkasprzak/lectio/internal/liturgy" ) -func TestGatherBTDedup(t *testing.T) { - sec := liturgy.Section{ - Heading: "Psalm (Ps 1)", - Paragraphs: [][]string{{"stanza one"}, {"refrain"}, {"stanza two"}, {"refrain"}}, - } - _, blocks := GatherVersion("bt", sec, "new", "pl") - n := 0 - for _, b := range blocks { - if b == "refrain" { - n++ - } - } - if n != 1 { - t.Errorf("refrain appears %d times, want 1 (deduped)", n) - } -} - func TestGatherBible(t *testing.T) { // Offline sections carry the English-canonical lookup reference in Ref; the // display citation stays in the reader's sigla dialect. |
