Add !!!figure tag to ggcode
This commit is contained in:
parent
3d7c095c87
commit
b5dac2f4d8
Binary file not shown.
|
@ -78,6 +78,27 @@ var ggcodeTags = map[string]ggcodeTag{
|
|||
return nil
|
||||
},
|
||||
},
|
||||
"figure": {
|
||||
Filter: ggcodeFilterEdu,
|
||||
Renderer: func(c ggcodeRendererContext, n *ggcodeNode, entering bool) error {
|
||||
if entering {
|
||||
c.W.WriteString(`<figure>`)
|
||||
var srcAttr, altAttr string
|
||||
if src := n.Args["src"]; src != "" {
|
||||
srcAttr = fmt.Sprintf(` src="%s"`, src)
|
||||
}
|
||||
if alt := n.Args["alt"]; alt != "" {
|
||||
altAttr = fmt.Sprintf(` alt="%s"`, alt)
|
||||
}
|
||||
c.W.WriteString(fmt.Sprintf(`<img%s%s>`, srcAttr, altAttr))
|
||||
c.W.WriteString(`<figcaption>`)
|
||||
} else {
|
||||
c.W.WriteString(`</figcaption>`)
|
||||
c.W.WriteString(`</figure>`)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// ----------------------
|
||||
|
|
Loading…
Reference in New Issue