osis

package
v0.0.0-...-7b4b16e Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2015 License: MIT Imports: 5 Imported by: 0

README

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"`
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoSuchVerse = fmt.Errorf("No such verse")
	InvalidRef  = fmt.Errorf("Invalid verse reference")
)

Functions

This section is empty.

Types

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"`
}

Jump to

Keyboard shortcuts

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