bref

package module
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2020 License: AGPL-3.0 Imports: 4 Imported by: 2

README

bref

An advanced Bible reference parser with first class multi-language support written in Go.

Inspired by chapter-and-verse.

Features

  • First class support for parsing references in other languages
  • Simplicity and division into different functions
  • Good information about each book

Example

package main

import "code.heb12.com/heb12/bref"

func main() {
	reference := "John 3:16"
	referenceData, _ := bref.Process(reference)
}

Supported references:

  • Hebrews 4:12 (Book Chapter:Verse)
  • John 3:16-17 (Book Chapter:Start-End)
  • Hebrews 3 (Book Chapter)

For the most part bref doesn't care what separators you use to separate between the book, chapter, and verses. So these are also valid:

  • Hebrews.4.2.3
  • Hebrews 4 2 3
  • John+3
  • John:4+2_16
  • John (provides information about the book itself)

Users make typos or may just enter a reference in an awkward way. bref can handle this.

Todo

  • Search function (for searching different bookInfo fields and returning the matching books)
  • More language names (and find a better way to store them)
  • Possibly support non-linear Bible references. E.g. "John 3:16,18
  • Figure out a better way to process chapters without verses (possibly implement it into Process instead of Parse)
  • Improve testing to cover more cases and other functions

Contributing

The biggest way to contribute is to add more languages. Add the books of the Bible in a language to the books.go file. Here are some things to keep in mind:

  • Only alts different than the English alts should be added
  • If there are no alts for a particular book, leave it as []string{}

License

Copyright (C) 2020 Josias Allestad justjosias@tutanota.com and contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.

See COPYING.LESSER for more license information.

The JSON files are licensed under the ISC license, as found in chapter-and-verse.

Documentation

Overview

Package bref processes Bible verse references into a machine workable format

Index

Constants

This section is empty.

Variables

View Source
var AllBookNames = map[string][]BookName{

	"en": {
		{
			Name: "Genesis",
			Alt:  []string{"ge", "gn"},
		},
		{
			Name: "Exodus",
			Alt:  []string{"ex"},
		},
		{
			Name: "Leviticus",
			Alt:  []string{"le", "lv"},
		},
		{
			Name: "Numbers",
			Alt:  []string{"nu", "nm", "nb"},
		},
		{
			Name: "Deuteronomy",
			Alt:  []string{"deu", "du", "dt", "de"},
		},
		{
			Name: "Joshua",
			Alt:  []string{"jsh", "jos"},
		},
		{
			Name: "Judges",
			Alt:  []string{"jdg", "jg", "jdgs"},
		},
		{
			Name: "Ruth",
			Alt:  []string{"rth", "ru"},
		},
		{
			Name: "1 Samuel",
			Alt:  []string{"1sm", "1s", "2sam", "1st Samuel"},
		},
		{
			Name: "2 Samuel",
			Alt:  []string{"2sm", "2s", "2sam", "2nd Samuel"},
		},
		{
			Name: "1 Kings",
			Alt:  []string{"1ki", "1k", "1kgs"},
		},
		{
			Name: "2 Kings",
			Alt:  []string{"2ki", "2k", "2kgs"},
		},
		{
			Name: "1 Chronicles",
			Alt:  []string{"1ch", "1st Chronicles"},
		},
		{
			Name: "2 Choronicles",
			Alt:  []string{"2ch", "2nd Chronicles"},
		},
		{
			Name: "Ezra",
			Alt:  []string{"ez", "ezr"},
		},
		{
			Name: "Nehemiah",
			Alt:  []string{"neh", "ne"},
		},
		{
			Name: "Esther",
			Alt:  []string{"est", "es"},
		},
		{
			Name: "Job",
			Alt:  []string{"jb"},
		},
		{
			Name: "Psalms",
			Alt:  []string{"pslm", "psm", "pss", "Psalm"},
		},
		{
			Name: "Proverbs",
			Alt:  []string{"prv", "pr", "pro"},
		},
		{
			Name: "Ecclesiastes",
			Alt:  []string{"ec", "qoh"},
		},
		{
			Name: "Song of Solomon",
			Alt:  []string{"sos", "so", "canticles", "cant", "Song of Songs", "Songs"},
		},
		{
			Name: "Isaiah",
			Alt:  []string{"is"},
		},
		{
			Name: "Jeremiah",
			Alt:  []string{"je", "jr"},
		},
		{
			Name: "Lamentations",
			Alt:  []string{"la", "lam"},
		},
		{
			Name: "Ezekiel",
			Alt:  []string{"ezk"},
		},
		{
			Name: "Daniel",
			Alt:  []string{"da", "dn"},
		},
		{
			Name: "Hosea",
			Alt:  []string{"hos", "ho"},
		},
		{
			Name: "Joel",
			Alt:  []string{"joe", "jl"},
		},
		{
			Name: "Amos",
			Alt:  []string{"am", "amo"},
		},
		{
			Name: "Obadiah",
			Alt:  []string{"oba", "ob"},
		},
		{
			Name: "Jonah",
			Alt:  []string{"jon"},
		},
		{
			Name: "Micah",
			Alt:  []string{"mic", "mc"},
		},
		{
			Name: "Nahum",
			Alt:  []string{"na", "nah"},
		},
		{
			Name: "Habakkuk",
			Alt:  []string{"hab", "hb"},
		},
		{
			Name: "Zephaniah",
			Alt:  []string{"zep", "zp"},
		},
		{
			Name: "Haggai",
			Alt:  []string{"hag", "hg"},
		},
		{
			Name: "Zachariah",
			Alt:  []string{"zc", "zecheriah", "zech"},
		},
		{
			Name: "Malachi",
			Alt:  []string{"mal", "ml"},
		},
		{
			Name: "Matthew",
			Alt:  []string{"mat", "mt"},
		},
		{
			Name: "Mark",
			Alt:  []string{"mrk", "mk", "mr"},
		},
		{
			Name: "Luke",
			Alt:  []string{"luk", "lk"},
		},
		{
			Name: "John",
			Alt:  []string{"jhn", "jn"},
		},
		{
			Name: "Acts",
			Alt:  []string{"ac", "act"},
		},
		{
			Name: "Romans",
			Alt:  []string{"ro", "rm"},
		},
		{
			Name: "1 Corinthians",
			Alt:  []string{"1co", "1st Corinthians"},
		},
		{
			Name: "2 Corinthians",
			Alt:  []string{"2co", "2 Corinthians"},
		},
		{
			Name: "Galatians",
			Alt:  []string{"gal", "ga"},
		},
		{
			Name: "Ephesians",
			Alt:  []string{"eph"},
		},
		{
			Name: "Philippians",
			Alt:  []string{"phil", "php", "pp", "phili"},
		},
		{
			Name: "Colossians",
			Alt:  []string{"co", "col"},
		},
		{
			Name: "1 Thessalonians",
			Alt:  []string{"1th", "1st Thessalonians"},
		},
		{
			Name: "2 Thessalonians",
			Alt:  []string{"2th", "2nd Thessalonians"},
		},
		{
			Name: "1 Timothy",
			Alt:  []string{"1ti", "1st Timothy"},
		},
		{
			Name: "2 Timothy",
			Alt:  []string{"2ti", "2nd Timothy"},
		},
		{
			Name: "Titus",
			Alt:  []string{"ti", "tit"},
		},
		{
			Name: "Philemon",
			Alt:  []string{"phm", "pm"},
		},
		{
			Name: "Hebrews",
			Alt:  []string{"hebrew", "heb", "heb12"},
		},
		{
			Name: "James",
			Alt:  []string{"jms", "jm", "js"},
		},
		{
			Name: "1 Peter",
			Alt:  []string{"1pt", "1p", "1st Peter"},
		},
		{
			Name: "2 Peter",
			Alt:  []string{"2pt", "2p", "2nd Peter"},
		},
		{
			Name: "1 John",
			Alt:  []string{"1jhn", "1jn", "1j", "1st John"},
		},
		{
			Name: "2 John",
			Alt:  []string{"2jhn", "2jn", "2j", "2nd John"},
		},
		{
			Name: "3 John",
			Alt:  []string{"3jhn", "3jn", "3j", "3rd John"},
		},
		{
			Name: "Jude",
			Alt:  []string{"jud", "jd"},
		},
		{
			Name: "Revelation",
			Alt:  []string{"re"},
		},
	},

	"fr": {
		{
			Name: "Genèse",
			Alt:  []string{},
		},
		{
			Name: "Exode",
			Alt:  []string{},
		},
		{
			Name: "Lévitique",
			Alt:  []string{},
		},
		{
			Name: "Nombres",
			Alt:  []string{},
		},
		{
			Name: "Deutéronome",
			Alt:  []string{},
		},
		{
			Name: "Josué",
			Alt:  []string{},
		},
		{
			Name: "Juges",
			Alt:  []string{},
		},
		{
			Name: "Ruth",
			Alt:  []string{},
		},
		{
			Name: "1 Samuel",
			Alt:  []string{},
		},
		{
			Name: "2 Samuel",
			Alt:  []string{},
		},
		{
			Name: "1 Rois",
			Alt:  []string{},
		},
		{
			Name: "2 Rois",
			Alt:  []string{},
		},
		{
			Name: "1 Chroniques",
			Alt:  []string{},
		},
		{
			Name: "2 Chroniques",
			Alt:  []string{},
		},
		{
			Name: "Esdras",
			Alt:  []string{},
		},
		{
			Name: "Néhémie",
			Alt:  []string{},
		},
		{
			Name: "Esther",
			Alt:  []string{},
		},
		{
			Name: "Job",
			Alt:  []string{},
		},
		{
			Name: "Psaumes",
			Alt:  []string{},
		},
		{
			Name: "Proverbes",
			Alt:  []string{},
		},
		{
			Name: "Ecclésiaste",
			Alt:  []string{},
		},
		{
			Name: "Cantique des Cantiques",
			Alt:  []string{},
		},
		{
			Name: "Ésaïe",
			Alt:  []string{},
		},
		{
			Name: "Jérémie",
			Alt:  []string{},
		},
		{
			Name: "Lamentations",
			Alt:  []string{},
		},
		{
			Name: "Ézéchiel",
			Alt:  []string{},
		},
		{
			Name: "Daniel",
			Alt:  []string{},
		},
		{
			Name: "Osée",
			Alt:  []string{},
		},
		{
			Name: "Joël",
			Alt:  []string{},
		},
		{
			Name: "Amos",
			Alt:  []string{},
		},
		{
			Name: "Abdias",
			Alt:  []string{},
		},
		{
			Name: "Jonas",
			Alt:  []string{},
		},
		{
			Name: "Michée",
			Alt:  []string{},
		},
		{
			Name: "Nahum",
			Alt:  []string{},
		},
		{
			Name: "Habacuc",
			Alt:  []string{},
		},
		{
			Name: "Sophonie",
			Alt:  []string{},
		},
		{
			Name: "Aggée",
			Alt:  []string{},
		},
		{
			Name: "Zacharie",
			Alt:  []string{},
		},
		{
			Name: "Malachie",
			Alt:  []string{},
		},
		{
			Name: "Matthieu",
			Alt:  []string{},
		},
		{
			Name: "Marc",
			Alt:  []string{},
		},
		{
			Name: "Luc",
			Alt:  []string{},
		},
		{
			Name: "Jean",
			Alt:  []string{},
		},
		{
			Name: "Actes",
			Alt:  []string{},
		},
		{
			Name: "Romains",
			Alt:  []string{},
		},
		{
			Name: "1 Corinthians",
			Alt:  []string{},
		},
		{
			Name: "2 Corinthians",
			Alt:  []string{},
		},
		{
			Name: "Galates",
			Alt:  []string{},
		},
		{
			Name: "Éphésiens",
			Alt:  []string{},
		},
		{
			Name: "Philippiens",
			Alt:  []string{},
		},
		{
			Name: "Colossiens",
			Alt:  []string{},
		},
		{
			Name: "1 Thessaloniciens",
			Alt:  []string{},
		},
		{
			Name: "2 Thessaloniciens",
			Alt:  []string{},
		},
		{
			Name: "1 Timothée",
			Alt:  []string{},
		},
		{
			Name: "2 Timothée",
			Alt:  []string{},
		},
		{
			Name: "Tite",
			Alt:  []string{},
		},
		{
			Name: "Philémon",
			Alt:  []string{},
		},
		{
			Name: "Hébreux",
			Alt:  []string{},
		},
		{
			Name: "Jacques",
			Alt:  []string{},
		},
		{
			Name: "1 Pierre",
			Alt:  []string{},
		},
		{
			Name: "2 Pierre",
			Alt:  []string{},
		},
		{
			Name: "1 Jean",
			Alt:  []string{},
		},
		{
			Name: "2 Jean",
			Alt:  []string{},
		},
		{
			Name: "3 Jean",
			Alt:  []string{},
		},
		{
			Name: "Jude",
			Alt:  []string{},
		},
		{
			Name: "Apocalypse",
			Alt:  []string{},
		},
	},

	"es": {
		{
			Name: "Génesis",
			Alt:  []string{"ge", "gn"},
		},
		{
			Name: "Éxodo",
			Alt:  []string{"ex"},
		},
		{
			Name: "Levítico",
			Alt:  []string{"le", "lv"},
		},
		{
			Name: "Números",
			Alt:  []string{"nu", "nm", "nb"},
		},
		{
			Name: "Deuteronomio",
			Alt:  []string{"deu", "du", "dt", "de"},
		},
		{
			Name: "Josué",
			Alt:  []string{"jsh", "jos"},
		},
		{
			Name: "Jueces",
			Alt:  []string{"jdg", "jg", "jdgs"},
		},
		{
			Name: "Rut",
			Alt:  []string{"rth", "ru"},
		},
		{
			Name: "1 Samuel",
			Alt:  []string{"1sm", "1s", "2sam"},
		},
		{
			Name: "2 Samuel",
			Alt:  []string{"2sm", "2s", "2sam"},
		},
		{
			Name: "1 Reyes",
			Alt:  []string{"1ki", "1k", "1kgs"},
		},
		{
			Name: "2 Reyes",
			Alt:  []string{"2ki", "2k", "2kgs"},
		},
		{
			Name: "1 Crónicas",
			Alt:  []string{"1ch"},
		},
		{
			Name: "2 Crónicas",
			Alt:  []string{"2ch"},
		},
		{
			Name: "Esdras",
			Alt:  []string{"ez", "ezr"},
		},
		{
			Name: "Nehemías",
			Alt:  []string{"neh", "ne"},
		},
		{
			Name: "Ester",
			Alt:  []string{"est", "es"},
		},
		{
			Name: "Job",
			Alt:  []string{"jb"},
		},
		{
			Name: "Salmos",
			Alt:  []string{"pslm", "psm", "pss"},
		},
		{
			Name: "Proverbios",
			Alt:  []string{"prv", "pr", "pro"},
		},
		{
			Name: "Eclesiastés",
			Alt:  []string{"ec", "qoh"},
		},
		{
			Name: "Cantares",
			Alt:  []string{"sos", "so", "canticles", "cant", "Cantares de Cantares"},
		},
		{
			Name: "Isaías",
			Alt:  []string{"is"},
		},
		{
			Name: "Jeremías",
			Alt:  []string{"je", "jr"},
		},
		{
			Name: "Lamentaciones",
			Alt:  []string{"la", "lam"},
		},
		{
			Name: "Ezequiel",
			Alt:  []string{"ezk"},
		},
		{
			Name: "Daniel",
			Alt:  []string{"da", "dn"},
		},
		{
			Name: "Oseas",
			Alt:  []string{"hos", "ho"},
		},
		{
			Name: "Joel",
			Alt:  []string{"joe", "jl"},
		},
		{
			Name: "Amós",
			Alt:  []string{"am", "amo"},
		},
		{
			Name: "Abdías",
			Alt:  []string{"oba", "ob"},
		},
		{
			Name: "Jonás",
			Alt:  []string{"jon"},
		},
		{
			Name: "Miqueas",
			Alt:  []string{"mic", "mc"},
		},
		{
			Name: "Nahum",
			Alt:  []string{"na", "nah"},
		},
		{
			Name: "Habacuc",
			Alt:  []string{"hab", "hb"},
		},
		{
			Name: "Sofonías",
			Alt:  []string{"zep", "zp"},
		},
		{
			Name: "Hageo",
			Alt:  []string{"hag", "hg"},
		},
		{
			Name: "Zachariah",
			Alt:  []string{"zc", "zecheriah", "zech"},
		},
		{
			Name: "Malaquías",
			Alt:  []string{"mal", "ml"},
		},
		{
			Name: "Mateo",
			Alt:  []string{"mat", "mt"},
		},
		{
			Name: "Marcos",
			Alt:  []string{"mrk", "mk", "mr"},
		},
		{
			Name: "Lucas",
			Alt:  []string{"luk", "lk"},
		},
		{
			Name: "Juan",
			Alt:  []string{"jhn", "jn"},
		},
		{
			Name: "Hechos",
			Alt:  []string{"ac", "act"},
		},
		{
			Name: "Romanos",
			Alt:  []string{"ro", "rm"},
		},
		{
			Name: "1 Corintios",
			Alt:  []string{"1co"},
		},
		{
			Name: "2 Corintios",
			Alt:  []string{"2co"},
		},
		{
			Name: "Galatians",
			Alt:  []string{"gal", "ga"},
		},
		{
			Name: "Efesios",
			Alt:  []string{"eph"},
		},
		{
			Name: "Filipenses",
			Alt:  []string{"phil", "php", "pp", "phili"},
		},
		{
			Name: "Colosenses",
			Alt:  []string{"co", "col"},
		},
		{
			Name: "1 Tesalonicenses",
			Alt:  []string{"1th"},
		},
		{
			Name: "2 Tesalonicenses",
			Alt:  []string{"2th"},
		},
		{
			Name: "1 Timoteo",
			Alt:  []string{"1ti"},
		},
		{
			Name: "2 Timoteo",
			Alt:  []string{"2ti"},
		},
		{
			Name: "Tito",
			Alt:  []string{"ti", "tit"},
		},
		{
			Name: "Filemón",
			Alt:  []string{"phm", "pm"},
		},
		{
			Name: "Hebreos",
			Alt:  []string{},
		},
		{
			Name: "Santiago",
			Alt:  []string{"jms", "jm", "js"},
		},
		{
			Name: "1 Pedro",
			Alt:  []string{"1pt", "1p"},
		},
		{
			Name: "2 Pedro",
			Alt:  []string{"2pt", "2p"},
		},
		{
			Name: "1 Juan",
			Alt:  []string{"1jhn", "1jn", "1j"},
		},
		{
			Name: "2 Juan",
			Alt:  []string{"2jhn", "2jn", "2j"},
		},
		{
			Name: "3 Juan",
			Alt:  []string{"3jhn", "3jn", "3j"},
		},
		{
			Name: "Judas",
			Alt:  []string{"jud", "jd"},
		},
		{
			Name: "Apocalipsis",
			Alt:  []string{"re"},
		},
	},
}

AllBookNames contains a map of Bible book names in different languages

View Source
var AllBooksInfo = []BookInfo{
	{
		Order:            1,
		ID:               "Gen",
		Testament:        "O",
		Start:            "gen",
		Chapters:         50,
		VerseCount:       1533,
		VersesPerChapter: []int{31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26},
	},
	{
		Order:            2,
		ID:               "Exod",
		Testament:        "O",
		Start:            "exo",
		Chapters:         40,
		VerseCount:       1213,
		VersesPerChapter: []int{22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38},
	},
	{
		Order:            3,
		ID:               "Lev",
		Testament:        "O",
		Start:            "lev",
		Chapters:         27,
		VerseCount:       859,
		VersesPerChapter: []int{17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34},
	},
	{
		Order:            4,
		ID:               "Num",
		Testament:        "O",
		Start:            "num",
		Chapters:         36,
		VerseCount:       1288,
		VersesPerChapter: []int{54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25, 18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13},
	},
	{
		Order:            5,
		ID:               "Deut",
		Testament:        "O",
		Start:            "deu",
		Chapters:         34,
		VerseCount:       959,
		VersesPerChapter: []int{46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21, 20, 23, 30, 25, 22, 19, 19, 26, 68, 29, 20, 30, 52, 29, 12},
	},
	{
		Order:            6,
		ID:               "Josh",
		Testament:        "O",
		Start:            "jos",
		Chapters:         24,
		VerseCount:       658,
		VersesPerChapter: []int{18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33},
	},
	{
		Order:            7,
		ID:               "Judg",
		Testament:        "O",
		Start:            "judg",
		Chapters:         21,
		VerseCount:       618,
		VersesPerChapter: []int{36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25},
	},
	{
		Order:            8,
		ID:               "Ruth",
		Testament:        "O",
		Start:            "rut",
		Chapters:         4,
		VerseCount:       85,
		VersesPerChapter: []int{22, 23, 18, 22},
	},
	{
		Order:            9,
		ID:               "1Sam",
		Testament:        "O",
		Start:            "1sa",
		Chapters:         31,
		VerseCount:       810,
		VersesPerChapter: []int{28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 15, 23, 29, 22, 44, 25, 12, 25, 11, 31, 13},
	},
	{
		Order:            10,
		ID:               "2Sam",
		Testament:        "O",
		Start:            "2sa",
		Chapters:         24,
		VerseCount:       695,
		VersesPerChapter: []int{27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43, 26, 22, 51, 39, 25},
	},
	{
		Order:            11,
		ID:               "1Kgs",
		Testament:        "O",
		Start:            "1ki",
		Chapters:         22,
		VerseCount:       816,
		VersesPerChapter: []int{53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53},
	},
	{
		Order:            12,
		ID:               "2Kgs",
		Testament:        "O",
		Start:            "2ki",
		Chapters:         25,
		VerseCount:       719,
		VersesPerChapter: []int{18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30},
	},
	{
		Order:            13,
		ID:               "1Chr",
		Testament:        "O",
		Start:            "1ch",
		Chapters:         29,
		VerseCount:       942,
		VersesPerChapter: []int{54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31, 32, 34, 21, 30},
	},
	{
		Order:            14,
		ID:               "2Chr",
		Testament:        "O",
		Start:            "2ch",
		Chapters:         36,
		VerseCount:       822,
		VersesPerChapter: []int{17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23},
	},
	{
		Order:            15,
		ID:               "Ezra",
		Testament:        "O",
		Start:            "ezr",
		Chapters:         10,
		VerseCount:       280,
		VersesPerChapter: []int{11, 70, 13, 24, 17, 22, 28, 36, 15, 44},
	},
	{
		Order:            16,
		ID:               "Neh",
		Testament:        "O",
		Start:            "neh",
		Chapters:         13,
		VerseCount:       406,
		VersesPerChapter: []int{11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31},
	},
	{
		Order:            17,
		ID:               "Esth",
		Testament:        "O",
		Start:            "est",
		Chapters:         10,
		VerseCount:       167,
		VersesPerChapter: []int{22, 23, 15, 17, 14, 14, 10, 17, 32, 3},
	},
	{
		Order:            18,
		ID:               "Job",
		Testament:        "O",
		Start:            "job",
		Chapters:         42,
		VerseCount:       1070,
		VersesPerChapter: []int{22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 24, 34, 17},
	},
	{
		Order:            19,
		ID:               "Ps",
		Testament:        "O",
		Start:            "psa",
		Chapters:         150,
		VerseCount:       2461,
		VersesPerChapter: []int{6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13, 31, 6, 10, 22, 12, 14, 9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17, 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9, 6, 7, 23, 13, 11, 11, 17, 12, 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72, 13, 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9, 5, 8, 28, 22, 35, 45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 13, 10, 7, 12, 15, 21, 10, 20, 14, 9, 6},
	},
	{
		Order:            20,
		ID:               "Prov",
		Testament:        "O",
		Start:            "pro",
		Chapters:         31,
		VerseCount:       915,
		VersesPerChapter: []int{33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29, 30, 31, 29, 35, 34, 28, 28, 27, 28, 27, 33, 31},
	},
	{
		Order:            21,
		ID:               "Eccl",
		Testament:        "O",
		Start:            "ecc",
		Chapters:         12,
		VerseCount:       222,
		VersesPerChapter: []int{18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14},
	},
	{
		Order:            22,
		ID:               "Song",
		Testament:        "O",
		Start:            "son",
		Chapters:         8,
		VerseCount:       117,
		VersesPerChapter: []int{17, 17, 11, 16, 16, 13, 13, 14},
	},
	{
		Order:            23,
		ID:               "Isa",
		Testament:        "O",
		Start:            "isa",
		Chapters:         66,
		VerseCount:       1292,
		VersesPerChapter: []int{31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24},
	},
	{
		Order:            24,
		ID:               "Jer",
		Testament:        "O",
		Start:            "jer",
		Chapters:         52,
		VerseCount:       1364,
		VersesPerChapter: []int{19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34},
	},
	{
		Order:            25,
		ID:               "Lam",
		Testament:        "O",
		Start:            "lam",
		Chapters:         5,
		VerseCount:       154,
		VersesPerChapter: []int{22, 22, 66, 22, 22},
	},
	{
		Order:            26,
		ID:               "Ezek",
		Testament:        "O",
		Start:            "eze",
		Chapters:         48,
		VerseCount:       1273,
		VersesPerChapter: []int{28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35},
	},
	{
		Order:            27,
		ID:               "Dan",
		Testament:        "O",
		Start:            "dan",
		Chapters:         12,
		VerseCount:       357,
		VersesPerChapter: []int{21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13},
	},
	{
		Order:            28,
		ID:               "Hos",
		Testament:        "O",
		Start:            "hos",
		Chapters:         14,
		VerseCount:       197,
		VersesPerChapter: []int{11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9},
	},
	{
		Order:            29,
		ID:               "Joel",
		Testament:        "O",
		Start:            "joe",
		Chapters:         3,
		VerseCount:       73,
		VersesPerChapter: []int{20, 32, 21},
	},
	{
		Order:            30,
		ID:               "Amos",
		Testament:        "O",
		Start:            "amo",
		Chapters:         9,
		VerseCount:       146,
		VersesPerChapter: []int{15, 16, 15, 13, 27, 14, 17, 14, 15},
	},
	{
		Order:            31,
		ID:               "Obad",
		Testament:        "O",
		Start:            "oba",
		Chapters:         1,
		VerseCount:       21,
		VersesPerChapter: []int{21},
	},
	{
		Order:            32,
		ID:               "Jonah",
		Testament:        "O",
		Start:            "jon",
		Chapters:         4,
		VerseCount:       48,
		VersesPerChapter: []int{17, 10, 10, 11},
	},
	{
		Order:            33,
		ID:               "Mic",
		Testament:        "O",
		Start:            "mic",
		Chapters:         7,
		VerseCount:       105,
		VersesPerChapter: []int{16, 13, 12, 13, 15, 16, 20},
	},
	{
		Order:            34,
		ID:               "Nah",
		Testament:        "O",
		Start:            "nah",
		Chapters:         3,
		VerseCount:       47,
		VersesPerChapter: []int{15, 13, 19},
	},
	{
		Order:            35,
		ID:               "Hab",
		Testament:        "O",
		Start:            "hab",
		Chapters:         3,
		VerseCount:       56,
		VersesPerChapter: []int{17, 20, 19},
	},
	{
		Order:            36,
		ID:               "Zeph",
		Testament:        "O",
		Start:            "zep",
		Chapters:         3,
		VerseCount:       53,
		VersesPerChapter: []int{18, 15, 20},
	},
	{
		Order:            37,
		ID:               "Hag",
		Testament:        "O",
		Start:            "hag",
		Chapters:         2,
		VerseCount:       38,
		VersesPerChapter: []int{15, 23},
	},
	{
		Order:            38,
		ID:               "Zech",
		Testament:        "O",
		Start:            "zec",
		Chapters:         14,
		VerseCount:       211,
		VersesPerChapter: []int{21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21},
	},
	{
		Order:            39,
		ID:               "Mal",
		Testament:        "O",
		Start:            "mal",
		Chapters:         4,
		VerseCount:       55,
		VersesPerChapter: []int{14, 17, 18, 6},
	},
	{
		Order:            40,
		ID:               "Matt",
		Testament:        "N",
		Start:            "mat",
		Chapters:         28,
		VerseCount:       1071,
		VersesPerChapter: []int{25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51, 46, 75, 66, 20},
	},
	{
		Order:            41,
		ID:               "Mark",
		Testament:        "N",
		Start:            "mar",
		Chapters:         16,
		VerseCount:       678,
		VersesPerChapter: []int{45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20},
	},
	{
		Order:            42,
		ID:               "Luke",
		Testament:        "N",
		Start:            "luk",
		Chapters:         24,
		VerseCount:       1151,
		VersesPerChapter: []int{80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53},
	},
	{
		Order:            43,
		ID:               "John",
		Testament:        "N",
		Start:            "joh",
		Chapters:         21,
		VerseCount:       879,
		VersesPerChapter: []int{51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25},
	},
	{
		Order:            44,
		ID:               "Acts",
		Testament:        "N",
		Start:            "act",
		Chapters:         28,
		VerseCount:       1007,
		VersesPerChapter: []int{26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41, 38, 40, 30, 35, 27, 27, 32, 44, 31},
	},
	{
		Order:            45,
		ID:               "Rom",
		Testament:        "N",
		Start:            "rom",
		Chapters:         16,
		VerseCount:       433,
		VersesPerChapter: []int{32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27},
	},
	{
		Order:            46,
		ID:               "1Cor",
		Testament:        "N",
		Start:            "1co",
		Chapters:         16,
		VerseCount:       437,
		VersesPerChapter: []int{31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24},
	},
	{
		Order:            47,
		ID:               "2Cor",
		Testament:        "N",
		Start:            "2co",
		Chapters:         13,
		VerseCount:       257,
		VersesPerChapter: []int{24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14},
	},
	{
		Order:            48,
		ID:               "Gal",
		Testament:        "N",
		Start:            "gal",
		Chapters:         6,
		VerseCount:       149,
		VersesPerChapter: []int{24, 21, 29, 31, 26, 18},
	},
	{
		Order:            49,
		ID:               "Eph",
		Testament:        "N",
		Start:            "eph",
		Chapters:         6,
		VerseCount:       155,
		VersesPerChapter: []int{23, 22, 21, 32, 33, 24},
	},
	{
		Order:            50,
		ID:               "Phil",
		Testament:        "N",
		Start:            "phili",
		Chapters:         4,
		VerseCount:       104,
		VersesPerChapter: []int{30, 30, 21, 23},
	},
	{
		Order:            51,
		ID:               "Col",
		Testament:        "N",
		Start:            "col",
		Chapters:         4,
		VerseCount:       95,
		VersesPerChapter: []int{29, 23, 25, 18},
	},
	{
		Order:            52,
		ID:               "1Thess",
		Testament:        "N",
		Start:            "1th",
		Chapters:         5,
		VerseCount:       89,
		VersesPerChapter: []int{10, 20, 13, 18, 28},
	},
	{
		Order:            53,
		ID:               "2Thess",
		Testament:        "N",
		Start:            "2th",
		Chapters:         3,
		VerseCount:       47,
		VersesPerChapter: []int{12, 17, 18},
	},
	{
		Order:            54,
		ID:               "1Tim",
		Testament:        "N",
		Start:            "1ti",
		Chapters:         6,
		VerseCount:       113,
		VersesPerChapter: []int{20, 15, 16, 16, 25, 21},
	},
	{
		Order:            55,
		ID:               "2Tim",
		Testament:        "N",
		Start:            "2ti",
		Chapters:         4,
		VerseCount:       83,
		VersesPerChapter: []int{18, 26, 17, 22},
	},
	{
		Order:            56,
		ID:               "Titus",
		Testament:        "N",
		Start:            "tit",
		Chapters:         3,
		VerseCount:       46,
		VersesPerChapter: []int{16, 15, 15},
	},
	{
		Order:            57,
		ID:               "Phlm",
		Testament:        "N",
		Start:            "phile",
		Chapters:         1,
		VerseCount:       25,
		VersesPerChapter: []int{25},
	},
	{
		Order:            58,
		ID:               "Heb",
		Testament:        "N",
		Start:            "heb",
		Chapters:         13,
		VerseCount:       303,
		VersesPerChapter: []int{14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25},
	},
	{
		Order:            59,
		ID:               "Jas",
		Testament:        "N",
		Start:            "jam",
		Chapters:         5,
		VerseCount:       108,
		VersesPerChapter: []int{27, 26, 18, 17, 20},
	},
	{
		Order:            60,
		ID:               "1Pet",
		Testament:        "N",
		Start:            "1pe",
		Chapters:         5,
		VerseCount:       105,
		VersesPerChapter: []int{25, 25, 22, 19, 14},
	},
	{
		Order:            61,
		ID:               "2Pet",
		Testament:        "N",
		Start:            "2pe",
		Chapters:         3,
		VerseCount:       61,
		VersesPerChapter: []int{21, 22, 18},
	},
	{
		Order:            62,
		ID:               "1John",
		Testament:        "N",
		Start:            "1jo",
		Chapters:         5,
		VerseCount:       105,
		VersesPerChapter: []int{10, 29, 24, 21, 21},
	},
	{
		Order:            63,
		ID:               "2John",
		Testament:        "N",
		Start:            "2jo",
		Chapters:         1,
		VerseCount:       13,
		VersesPerChapter: []int{13},
	},
	{
		Order:            64,
		ID:               "3John",
		Testament:        "N",
		Start:            "3jo",
		Chapters:         1,
		VerseCount:       14,
		VersesPerChapter: []int{14},
	},
	{
		Order:            65,
		ID:               "Jude",
		Testament:        "N",
		Start:            "jude",
		Chapters:         1,
		VerseCount:       25,
		VersesPerChapter: []int{25},
	},
	{
		Order:            66,
		ID:               "Rev",
		Testament:        "N",
		Start:            "rev",
		Chapters:         22,
		VerseCount:       404,
		VersesPerChapter: []int{20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 17, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21},
	},
}

AllBooksInfo contains information for every book of the Bible

View Source
var AvailableLanguages = []string{"en", "fr", "es"}

AvailableLanguages contains the languages that bref supports

Functions

func BookNameToID

func BookNameToID(bookName string) (string, error)

BookNameToID looks up a book name in different languages and gets the basic ID for it

func Check

func Check(reference Reference) error

Check verifies the validity of a Reference

Types

type BookInfo

type BookInfo struct {
	Order            int
	ID               string
	Testament        string
	Start            string
	Chapters         int
	VerseCount       int
	VersesPerChapter []int
	Exceptions       []map[string]interface{}
}

BookInfo contains information of the Bible verse as outlined in the BooksFile

func GetBookInfo

func GetBookInfo(id string) (BookInfo, error)

GetBookInfo returns the BookInfo data for a specific book

type BookName

type BookName struct {
	Name string
	Alt  []string
}

A BookName contains a name and alternative names for a Bible reference

type Info added in v0.2.0

type Info struct {
	// Book contains an instance of bookData
	Book bookData
	// Chapter is the chapter of a reference
	Chapter int
	// From is the starting verse of a reference
	From int
	// To is the ending verse of a reference
	To int
	// Verses is the number of verses in the reference
	Verses int
	// Whole is whether or not the reference is a whole chapter
	Whole bool
}

Info contains data returned from the Process() function, including some information from OsisData

func Process

func Process(ref string) (Info, error)

Process combines other functions to provide book information in the form of the Info struct

type Reference

type Reference struct {
	ID      string
	Chapter int
	From    int
	To      int
}

Reference contains the reference to a Bible verse

func Parse

func Parse(ref string) Reference

Parse parses a reference string into the Reference struct using Regex

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL