From 0bcddd4ed0aff66452397dc0973337c535c0d2ed Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 27 Jul 2026 20:29:31 +0200 Subject: feat(cli): lectio --corpus-check validator --- internal/bible/booktable.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/bible/booktable.go') 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 { -- cgit v1.3