text

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMultiVerse = errors.New("multiple verses not supported")
)

Functions

This section is empty.

Types

type Content added in v0.4.0

type Content struct {
	Text string        `yaml:"text,omitempty" json:"text,omitempty"`
	HTML template.HTML `yaml:"html,omitempty" json:"html,omitempty"`
}

Content holds the content of a scripture of the day.

type Resolver

type Resolver interface {
	// Verse fetches a verse an associated metadata for the given reference..
	Verse(ctx context.Context, ref *ref.Resolved) (*Verse, error)

	// VerseText turns a reference into a string of text.
	VerseText(ctx context.Context, ref *ref.Resolved) (string, error)

	// VerseHTML turns a reference into a string of HTML.
	VerseHTML(ctx context.Context, ref *ref.Resolved) (template.HTML, error)

	// VersionInformation returns the metadata for the version of the Bible
	// used for the verse.
	VersionInformation(ctx context.Context) (*Version, error)
}

Resolver is the interface used to retrieve text for a scripture passage.

type Service

type Service struct {
	Resolver
	Abbreviations *ref.BookAbbreviations
	Canon         *ref.Canon
}

func NewService

func NewService(r Resolver, opt ...ServiceOption) *Service

func (*Service) RandomVerse

func (s *Service) RandomVerse(ctx context.Context, opt ...ref.RandomReferenceOption) (*ref.Resolved, *Verse, error)

func (*Service) RandomVerseHTML

func (s *Service) RandomVerseHTML(ctx context.Context, opt ...ref.RandomReferenceOption) (*ref.Resolved, template.HTML, error)

func (*Service) RandomVerseText added in v0.4.0

func (s *Service) RandomVerseText(ctx context.Context, opt ...ref.RandomReferenceOption) (*ref.Resolved, string, error)

func (*Service) Verse

func (s *Service) Verse(ctx context.Context, vr string) (*Verse, error)

func (*Service) VerseHTML

func (s *Service) VerseHTML(ctx context.Context, vr string) (template.HTML, error)

func (*Service) VerseText added in v0.4.0

func (s *Service) VerseText(ctx context.Context, vr string) (string, error)

func (*Service) VersionInformation added in v0.4.0

func (s *Service) VersionInformation(ctx context.Context) (*Version, error)

type ServiceOption added in v0.5.0

type ServiceOption func(*Service)

func WithAbbreviations added in v0.5.0

func WithAbbreviations(abbr *ref.BookAbbreviations) ServiceOption

func WithCanon added in v0.5.0

func WithCanon(c *ref.Canon) ServiceOption

func WithoutAbbreviations added in v0.5.0

func WithoutAbbreviations() ServiceOption

type Verse added in v0.4.0

type Verse struct {
	Reference string  `yaml:"reference" json:"reference"`
	Content   Content `yaml:"content" json:"content"`
	Link      string  `yaml:"link,omitempty" json:"link,omitempty"`
	Version   Version `yaml:"version" json:"version"`
}

Verse is the metadata and content for a verse of the day.

type Version added in v0.4.0

type Version struct {
	Name string `yaml:"name" json:"name"`
	Link string `yaml:"link" json:"link"`
}

Version is the metadata for the version of the Bible used for the verse.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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