diff options
Diffstat (limited to 'internal/bible/booktable.go')
| -rw-r--r-- | internal/bible/booktable.go | 16 |
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 { |
