romanus

package module
v0.0.0-...-d6c674c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 11 Imported by: 0

README

GoDoc Build Status Go Report Card codecov

romanus

Golang library containing the entire Roman Catechism of the Council of Trent.

Documentation here: https://godoc.org/github.com/mborders/romanus

Example Usage

// Create a new catechism instance
c := romanus.NewCatechism()

// Get Part 1
part, err := c.GetPart(1)

// Get Part 1, Article 1
a, err := c.GetArticle(1, 1)

// Get Part 1, Article 1, Section 1
s, err := c.GetSection(1, 1, 1)

// Get Part 1, Article 1, Section 1, Paragraph 1
p, err := c.GetParagraph(1, 1, 1, 1)
fmt.Print(p.Text) // English

// Search for paragraphs
r := c.Search("I believe", 10)
fmt.Print(r[0].Part.PartNumber)
fmt.Print(r[0].Article.ArticleNumber)
fmt.Print(r[0].Section.SectionNumber)
fmt.Print(r[0].Paragraph.ParagraphNumber)
fmt.Print(r[0].Paragraph.Text)
fmt.Print(r[0].String()) // Part 4, Article 3, Section 4, Paragraph 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Title         string    `json:"title"`
	ArticleNumber uint8     `json:"articleNumber"`
	Sections      []Section `json:"sections"`
}

Article contains a list of sections

type ArticleSummary

type ArticleSummary struct {
	Title         string `json:"title"`
	ArticleNumber uint8  `json:"articleNumber"`
}

ArticleSummary contains metadata for an article

type Catechism

type Catechism struct {
	Parts       []Part        `json:"-"`
	PartSummary []PartSummary `json:"parts"`
	// contains filtered or unexported fields
}

Catechism contains a list of parts

func NewCatechism

func NewCatechism() *Catechism

NewCatechism parses and creates a new catechism instance

func (*Catechism) GetArticle

func (c *Catechism) GetArticle(partNumber, articleNumber int) (*Article, error)

GetArticle obtains an article within the catechism by its number

func (*Catechism) GetParagraph

func (c *Catechism) GetParagraph(partNumber, articleNumber, sectionNumber, paragraphNumber int) (*Paragraph, error)

GetParagraph obtains a paragraph within the catechism by its number

func (*Catechism) GetPart

func (c *Catechism) GetPart(partNumber int) (*Part, error)

GetPart obtains a part within the catechism by its number

func (*Catechism) GetSection

func (c *Catechism) GetSection(partNumber, articleNumber, sectionNumber int) (*Section, error)

GetSection obtains a section within the catechism by its number

func (*Catechism) Search

func (c *Catechism) Search(query string, maxResults int) []SearchNode

Search finds top matching verses based on the given query. The number of search results are restricted by maxResults

type Paragraph

type Paragraph struct {
	ParagraphNumber uint8  `json:"paragraphNumber"`
	Text            string `json:"text"`
}

Paragraph contains text

type Part

type Part struct {
	Title      string    `json:"title"`
	PartNumber uint8     `json:"partNumber"`
	Articles   []Article `json:"articles"`
}

Part contains a list of articles

type PartSummary

type PartSummary struct {
	Title      string           `json:"title"`
	PartNumber uint8            `json:"partNumber"`
	Articles   []ArticleSummary `json:"articles"`
}

PartSummary contains metadata for a part

type SearchNode

type SearchNode struct {
	Part      *Part
	Article   *Article
	Section   *Section
	Paragraph *Paragraph
}

SearchNode represents a search result for a given paragraph inquiry

func (*SearchNode) String

func (s *SearchNode) String() string

String creates a string representation for the SearchNode, ex. Part 1, Article 1, Section 1, Paragraph 1

type Section

type Section struct {
	Title         string      `json:"title"`
	SectionNumber uint8       `json:"sectionNumber"`
	Paragraphs    []Paragraph `json:"paragraphs"`
}

Section contains a list of paragraphs

Jump to

Keyboard shortcuts

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