Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
e91fbdde77
Merge branch 'master' into parser-fixes 2026-10-30 14:31:54 -06:00
886cbd7b32
Attempt to fix parser issues with Pss 51.
Changes are being committed on this branch partially because I need to
implement announcements.
2026-10-30 10:45:22 -06:00
2 changed files with 33 additions and 7 deletions

View file

@ -518,10 +518,18 @@ func (v *VerseSet) String() string {
sb.WriteByte('\n') sb.WriteByte('\n')
sb.WriteString(strings.Repeat(" ", 4*verse.PoemOffset)) sb.WriteString(strings.Repeat(" ", 4*verse.PoemOffset))
} }
sb.WriteString(verse.Text)
if lastOffset != verse.PoemOffset { if lastOffset != verse.PoemOffset {
if lastOffset > 0 && verse.PoemOffset == 0 {
if v.SkipLineBreaks {
sb.WriteByte(' ')
} else {
sb.WriteByte('\n')
}
}
lastOffset = verse.PoemOffset lastOffset = verse.PoemOffset
} }
sb.WriteString(verse.Text)
if i == 0 && len(v.Verses) > 1 { if i == 0 && len(v.Verses) > 1 {
sb.WriteByte(' ') sb.WriteByte(' ')
continue continue

View file

@ -13,12 +13,13 @@ import (
) )
const ( const (
Gen1_1_2 string = `In the beginning God created the heavens and the earth. Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.` Gen1_1_2 string = `In the beginning God created the heavens and the earth. Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.`
Jude5 string = `Although you are fully aware of this, I want to remind you that after Jesus had delivered His people out of the land of Egypt, He destroyed those who did not believe.` Jude5 string = `Although you are fully aware of this, I want to remind you that after Jesus had delivered His people out of the land of Egypt, He destroyed those who did not believe.`
Jude6 string = `And the angels who did not stay within their own domain but abandoned their proper dwelling—these He has kept in eternal chains under darkness, bound for judgment on that great day.` Jude6 string = `And the angels who did not stay within their own domain but abandoned their proper dwelling—these He has kept in eternal chains under darkness, bound for judgment on that great day.`
Obadiah5 string = `“If thieves came to you, if robbers by night—oh, how you will be ruined—would they not steal only what they wanted? If grape gatherers came to you, would they not leave some gleanings?` Obadiah5 string = `“If thieves came to you, if robbers by night—oh, how you will be ruined—would they not steal only what they wanted? If grape gatherers came to you, would they not leave some gleanings?`
Psa32_4 string = `For day and night Your hand was heavy upon me; my strength was drained as in the summer heat. Selah` Psa32_4 string = `For day and night Your hand was heavy upon me; my strength was drained as in the summer heat. Selah`
John1_4_6 string = `In Him was life, and that life was the light of men. The Light shines in the darkness, and the darkness has not overcome it. There came a man who was sent from God. His name was John.` Psa51_10_12 string = `Create in me a clean heart, O God, and renew a right spirit within me. Cast me not away from Your presence; take not your Holy Spirit from me. Restore to me the joy of Your salvation, and sustain me with a willing spirit.`
John1_4_6 string = `In Him was life, and that life was the light of men. The Light shines in the darkness, and the darkness has not overcome it. There came a man who was sent from God. His name was John.`
) )
func loadScripture(s string) (*bible.Chapter, error) { func loadScripture(s string) (*bible.Chapter, error) {
@ -124,6 +125,23 @@ func Test_ChapterJSON(t *testing.T) {
t.Error(" should be ->", John1_4_6) t.Error(" should be ->", John1_4_6)
} }
testJSON = &bytes.Buffer{}
testJSON.WriteString(`{"numberOfVerses": 19, "chapter": {"number": 51, "content": [{"type": "verse", "number": 10, "content": [{"text": "Create in me a clean heart, O God,", "poem": 1}, {"text": "and renew a right spirit within me.", "poem": 2}]}, {"type": "verse", "number": 11, "content": [{"text": "Cast me not away from Your presence;", "poem": 1}, {"text": "take not Your Holy Spirit from me.", "poem": 2}]}, {"type": "verse", "number": 12, "content": [{"text": "Restore to me the joy of Your salvation,", "poem": 1}, {"text": "and sustain me with a willing spirit.", "poem": 2}]}]}}`)
c = &bible.Chapter{}
if err := json.Unmarshal(testJSON.Bytes(), c); err != nil {
t.Fatal(err)
}
vv = c.FilterVerses(10, 12)
vv.SkipLineBreaks = true
if vv.String() != Psa51_10_12 {
t.Error("Psalm 51:10-12 did not match as expected:")
t.Error(vv.String())
t.Error("Should be ->")
t.Error(Psa51_10_12)
}
} }
func Test_VerseFilter(t *testing.T) { func Test_VerseFilter(t *testing.T) {