Skip to content

Footnotes, Formatting, and References #6

@applehat

Description

@applehat

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
image


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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgobible formatRelated to the core GoBible JSON representation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions