Add support for ": example" elements
This commit is contained in:
parent
24ace5aa0e
commit
c012b0a533
8 changed files with 75 additions and 0 deletions
10
org/org.go
10
org/org.go
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue