diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-24 12:26:23 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-24 12:26:23 +0200 |
| commit | ed34fd574b4fc2e0a52c655ececddd1be29b271e (patch) | |
| tree | 8980a2b86ec279289abcabe3a691fa8a2a925765 /internal/bible/bible.go | |
| parent | a26fed000ad9f292618f9cecfd2b505dddfd004a (diff) | |
| download | lectio-ed34fd574b4fc2e0a52c655ececddd1be29b271e.tar.gz lectio-ed34fd574b4fc2e0a52c655ececddd1be29b271e.zip | |
reader: lectio-ui --reader fuzzy book picker + chapter reader over the corpora; v0.8.0
Diffstat (limited to 'internal/bible/bible.go')
| -rw-r--r-- | internal/bible/bible.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/bible/bible.go b/internal/bible/bible.go index 0254ceb..312daeb 100644 --- a/internal/bible/bible.go +++ b/internal/bible/bible.go @@ -2,6 +2,7 @@ package bible import ( "embed" + "sort" "strconv" "strings" "sync" @@ -58,3 +59,15 @@ func load(version string) *corpus { func Verses(version, book string, chap int) []Verse { return load(version).books[book][chap] } + +// Chapters returns the chapter numbers present for a book in a version, sorted +// ascending (empty if the version has no such book). +func Chapters(version, book string) []int { + chapMap := load(version).books[book] + chaps := make([]int, 0, len(chapMap)) + for ch := range chapMap { + chaps = append(chaps, ch) + } + sort.Ints(chaps) + return chaps +} |
