solafide-dev / gobible Goto Github PK
View Code? Open in Web Editor NEWA Golang Module for Interacting with the Christian Bible.
License: MIT License
A Golang Module for Interacting with the Christian Bible.
License: MIT License
Currently, there is some logic (specifically around book name normalization) that relies on the "book number".
This is perfectly fine for the Protestant Canon, but I imagine would make it error prone if trying to use Anglican, Catholic, or Orthodox sources.
While I as a protestant have my own opinions about biblical canon, I still believe these groups on a whole are Christians and I'd like the library and overall format to better handle deuterocanonical stuff.
The current Reference parser was written while I was mentally drained and its a mess.
There are much better implementations in other languages that inspiration can be drawn from.
A few quick examples I found that I'm documenting here for later reference:
Currently the data structure for footnotes and formatting look like this:
type Verse struct {
Number int `json:"number"`
Text string `json:"text"`
Footnotes []Footnote `json:"footnotes,omitempty"` // optional
Formatting []Formatting `json:"formatting,omitempty"` // optional
}
type Footnote struct {
Marker string `json:"number"`
Text string `json:"text"`
Start int `json:"start"`
End int `json:"end"`
}
type FormattingType string
// define valid FormattingType values
const (
FormatBold FormattingType = "bold"
FormatItalic FormattingType = "italic"
FormatUnderline FormattingType = "underline"
FormatRedLetter FormattingType = "red-letter"
FormatSmallCaps FormattingType = "small-caps"
)
type Formatting struct {
Type FormattingType `json:"type"`
Start int `json:"start"`
End int `json:"end"`
}
For the sake of this, lets assume we are trying to store Romans 1:17 from the Legacy Standard Bible
Screenshot from https://www.biblegateway.com/passage/?search=Romans+1%3A17&version=LSB
In the current structure, the JSON would look something like this:
{
"number": 17,
"text": "For in it the righteousness of God is revealed from faith to faith; as it is written, \"But the righteous will live by faith.\"",
"footnotes": [
{
"marker": "a",
"text": "Or _by_",
"start": 31,
"end": 35
},
{
"marker": "b",
"text": "Or _But he who is righteous by faith shall live_",
"start": 70,
"end": 106
}
],
"formatting": [
{
"type": "italic"
"start": 10,
"end": 13
},
{
"type": "small-caps",
"start": 70,
"end": 106
}
]
}
I think my first suggested change would be to add a type
to markers, (literal
, alternative
, commentary
and maybe other) to denote the type of footnote it is, and then add another section for cross-references.
I am also open to alternative theories on how to denote which text in the string needs formatting or references applied to it. Currently start and end is the char count start and end inside the string.
Assuming we stick with the current method of denoting where the formats exist, I would not be against a few methods on the Verse struct that could help render out in HTML and Markdown the footnoting and formatting as much as is possible.
Obviously red-letters and small-caps are not a native markdown feature, so Im not sure how we handle that (but honestly whatever app consumes the text can choose to use our methods or not)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.