Skip to content

Commit

Permalink
fix #20: add embed card logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarone committed Mar 23, 2019
1 parent 10b5a2d commit 0e73400
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ func cardCode(payload interface{}) string {
return buf.String()
}

func cardEmbed(payload interface{}) string {
m, ok := payload.(map[string]interface{})
if !ok {
return ""
}

html, ok := m["html"]
if !ok {
log.Println("ERROR embed card missing html")
return ""
}

return html.(string)
}

func (p *post) populate(gi *ghostInfo, gth *GhostToHugo) {
p.Published = gth.parseTime(p.PublishedAt)
p.Created = gth.parseTime(p.CreatedAt)
Expand Down Expand Up @@ -144,7 +159,8 @@ func (p post) mobiledocMarkdown() string {
WithCard("markdown", cardMarkdown).
WithCard("hr", cardHR).
WithCard("image", cardImage).
WithCard("code", cardCode)
WithCard("code", cardCode).
WithCard("embed", cardEmbed)

err := md.Render(&buf)
if err != nil {
Expand Down

0 comments on commit 0e73400

Please sign in to comment.