diff --git a/internal/bible/types.go b/internal/bible/types.go index ec40973..1cfca21 100644 --- a/internal/bible/types.go +++ b/internal/bible/types.go @@ -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 } diff --git a/internal/bible/types_test.go b/internal/bible/types_test.go index f586091..3608718 100644 --- a/internal/bible/types_test.go +++ b/internal/bible/types_test.go @@ -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(".") }