aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/booktable.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:29:31 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-27 20:29:31 +0200
commit0bcddd4ed0aff66452397dc0973337c535c0d2ed (patch)
treefffae4df5ba0efe80c0f7c2501ebf0396e438fdd /internal/bible/booktable.go
parent399f0d428050ee104f16e8d4a289b65a4a68eb13 (diff)
downloadlectio-0bcddd4ed0aff66452397dc0973337c535c0d2ed.tar.gz
lectio-0bcddd4ed0aff66452397dc0973337c535c0d2ed.zip
feat(cli): lectio --corpus-check validator
Diffstat (limited to 'internal/bible/booktable.go')
-rw-r--r--internal/bible/booktable.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/bible/booktable.go b/internal/bible/booktable.go
index ffa3907..360f526 100644
--- a/internal/bible/booktable.go
+++ b/internal/bible/booktable.go
@@ -92,6 +92,22 @@ func mustReadEmbedded() []byte {
// /settings editor shows when the user has no override yet).
func DefaultBooksINI() []byte { return mustReadEmbedded() }
+// CanonicalBooks returns the 73 canonical English book keys -- the exact
+// vocabulary a corpus .tsv's Book column must use -- read from the embedded
+// books.ini [en] section. It reuses the existing embedded parse (parseBooks
+// + mustReadEmbedded); the book list is never re-embedded or hardcoded here.
+func CanonicalBooks() map[string]bool {
+ out := map[string]bool{}
+ def, err := parseBooks(mustReadEmbedded())
+ if err != nil {
+ return out // our bug, not the caller's; an empty set flags everything
+ }
+ for canon := range def["en"] {
+ out[canon] = true
+ }
+ return out
+}
+
func parseBooks(data []byte) (map[string]map[string][]string, error) {
secs, err := ini.Parse(data)
if err != nil {