aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/corpusmeta.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:19:00 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:19:00 +0200
commit42636312160892d1bc6a7f021ce27354f7cbb80d (patch)
tree88d75c31ed996dfd459268b8d75aeb24cd646ac6 /internal/bible/corpusmeta.go
parent643d01c388eece9f3a00d2db16cb421f5483b229 (diff)
downloadlectio-42636312160892d1bc6a7f021ce27354f7cbb80d.tar.gz
lectio-42636312160892d1bc6a7f021ce27354f7cbb80d.zip
feat(config): reading_lang/reading_version + ReadingCorpus resolver
Task 3 of national-bibles. Adds reading_lang (any language code) and reading_version (explicit corpus code) config fields, setField cases, renderConfigINI lines + self-documenting header, and Config.ReadingCorpus(): reading_version > reading_lang match > ui_language match > "" (Latin fallback applied by the caller). Also adds an `autoselect` corpus-metadata flag (default true), surfaced during this task: the built-in wuj declares lang=pl, so lang-auto would have re-selected the incomplete Wujek for Polish users and defeated the wuj-drop. wuj.ini now sets autoselect=false, so it is reachable only via an explicit reading_version or --ref; the resolver's language auto-match skips non-autoselectable corpora. A corrected Wujek drop-in (autoselect defaults true) auto-serves Polish with zero config.
Diffstat (limited to 'internal/bible/corpusmeta.go')
-rw-r--r--internal/bible/corpusmeta.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/bible/corpusmeta.go b/internal/bible/corpusmeta.go
index 04b9dcb..60d90a9 100644
--- a/internal/bible/corpusmeta.go
+++ b/internal/bible/corpusmeta.go
@@ -3,15 +3,20 @@ package bible
import "github.com/lukaszkasprzak/lectio/internal/ini"
// CorpusMeta is the sidecar metadata for a bible corpus (<code>.ini).
+// Autoselect (default true) governs whether the corpus may be picked by the
+// reading resolver's language auto-match; a corpus with Autoselect=false stays
+// reachable only via an explicit reading_version or --ref (e.g. the built-in
+// wuj, which is incomplete). See docs national-bibles design.
type CorpusMeta struct {
Code, Lang, Name, PsalmSystem, Sigla string
+ Autoselect bool
}
// parseCorpusMeta reads a section-less sidecar. ini.Parse returns
// []ini.Section{Name, Pairs}; keys before any [section] land in the section
// whose Name == "" (verified against internal/ini).
func parseCorpusMeta(code string, data []byte) CorpusMeta {
- m := CorpusMeta{Code: code}
+ m := CorpusMeta{Code: code, Autoselect: true} // absent autoselect => true
secs, err := ini.Parse(data)
if err != nil {
return m
@@ -30,6 +35,8 @@ func parseCorpusMeta(code string, data []byte) CorpusMeta {
m.PsalmSystem = p.Val
case "sigla":
m.Sigla = p.Val
+ case "autoselect":
+ m.Autoselect = p.Val != "false"
}
}
}