Add support for ": example" elements

This commit is contained in:
Niklas Fasching 2018-12-16 23:21:26 +01:00
parent 24ace5aa0e
commit c012b0a533
8 changed files with 75 additions and 0 deletions

View file

@ -76,6 +76,8 @@ func (w *OrgWriter) writeNodes(ns ...Node) {
case Paragraph:
w.writeParagraph(n)
case Example:
w.writeExample(n)
case HorizontalRule:
w.writeHorizontalRule(n)
case Text:
@ -171,6 +173,14 @@ func (w *OrgWriter) writeParagraph(p Paragraph) {
w.WriteString("\n")
}
func (w *OrgWriter) writeExample(e Example) {
for _, n := range e.Children {
w.WriteString(w.indent + ":" + " ")
w.writeNodes(n)
w.WriteString("\n")
}
}
func (w *OrgWriter) writeKeyword(k Keyword) {
w.WriteString(w.indent + fmt.Sprintf("#+%s: %s\n", k.Key, k.Value))
}