osis
--
import "github.com/andrewstuart/bible-http-server/osis"
Usage
var (
NoSuchVerse = fmt.Errorf("No such verse")
InvalidRef = fmt.Errorf("Invalid verse reference")
)
type Bible
type Bible struct {
Books []*Book `json:"-"xml:"-"`
BooksById map[string]int `json:"-"xml:"-"`
XMLName xml.Name `xml:"osis"json:"-"`
Testaments []Testament `xml:"osisText>div"json:"testaments"`
Version Version `xml:"osisText>header>work"json:"version"`
}
func NewBible
func NewBible(r io.Reader) (*Bible, error)
func (*Bible) GetVerse
func (b *Bible) GetVerse(ref string) (*Verse, error)
func (*Bible) GetVerses
func (b *Bible) GetVerses(from, to string) ([]*Verse, error)
GetVerses takes two reference strings and returns a slice of verses
type Book
type Book struct {
Chs []*Chapter `xml:"chapter"`
ID string `xml:"osisID,attr"`
}
type Chapter
type Chapter struct {
Vrs []*Verse `xml:"verse"`
ID string `xml:"osisWork,attr"`
}
type Reference
type Reference struct {
Text string `xml:",chardata"json:"text"json:"comment"`
RefID string `xml:"osisRef,attr"json:"refid"`
}
type Testament
type Testament struct {
Books []Book `xml:"div"`
}
type Verse
type Verse struct {
Text string `xml:",chardata"json:"text"`
ID string `xml:"osisID,attr"json:"id"`
Words []Word `xml:"w"json:"words,omitempty"`
Refs []Reference `xml:"note>reference"json:"references,omitempty"`
}
type VerseRef
type VerseRef struct {
BookID string
Chapter, Verse int
}
func NewVerseRef
func NewVerseRef(ref string) (*VerseRef, error)
type Version
type Version struct {
Title string `xml:"title"json:"title"`
ID string `xml:"identifier"json:"id"`
RefSystem string `xml:"refSystem"json:"refSystem"`
}
type Word
type Word struct {
N int `xml:"n,attr"`
Text string `xml:",chardata"`
Translit string `xml:"xlit,attr"`
Lemma string `xml:"lemma,attr"`
Morphology string `xml:"morph,attr"`
}