This commit is contained in:
Benjamin A. Shelton 2026-09-24 15:14:55 -06:00
commit 27efbb158b
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
2 changed files with 21 additions and 14 deletions

View file

@ -3,6 +3,7 @@ package bible
import (
"bytes"
"encoding/json"
"fmt"
"os"
)
@ -43,16 +44,13 @@ type ChapterDecl struct {
}
type Content struct {
Text string
IsHeading bool
IsLineBreak bool
IsNote bool
IsPoem bool
IsVerse bool
NoteId int
Number int
PoemOffset int
Content []Content
Text string
Type string `json:"type"`
Number int `json:"number"`
NoteId int `json:"noteId"`
LineBreak bool `json:"lineBreak"`
Poem int `json:"poem"`
Content []Content
}
func (c *Content) UnmarshalJSON(d []byte) error {
@ -61,7 +59,16 @@ func (c *Content) UnmarshalJSON(d []byte) error {
return nil
}
if d[0] == '"' {
var peek []json.RawMessage
if err := json.Unmarshal(d, &peek); err != nil {
return err
}
for _, p := range peek {
fmt.Printf("%v\n", p)
}
/*if d[0] == '"' {
json.Unmarshal(d, &c.Text)
}
@ -113,7 +120,7 @@ func (c *Content) UnmarshalJSON(d []byte) error {
json.Unmarshal(nd, &c.NoteId)
}
}
}*/
return nil
}

View file

@ -54,7 +54,7 @@ func Test_ChapterJSON(t *testing.T) {
t.Errorf("metadata should report chapter '1'; received: %d", ch.ChapterDecl.Number)
}
for _, c := range ch.ChapterDecl.Content {
/*for _, c := range ch.ChapterDecl.Content {
if c.IsVerse {
fmt.Print(c.Number, " ")
if len(c.Content) > 0 {
@ -72,7 +72,7 @@ func Test_ChapterJSON(t *testing.T) {
if c.IsLineBreak {
fmt.Print("\n")
}
}
}*/
t.Error(".")
}