Add basic support for drawers
This commit is contained in:
parent
c012b0a533
commit
0186545123
8 changed files with 102 additions and 8 deletions
11
org/org.go
11
org/org.go
|
@ -62,6 +62,8 @@ func (w *OrgWriter) writeNodes(ns ...Node) {
|
|||
w.writeHeadline(n)
|
||||
case Block:
|
||||
w.writeBlock(n)
|
||||
case Drawer:
|
||||
w.writeDrawer(n)
|
||||
|
||||
case FootnoteDefinition:
|
||||
w.writeFootnoteDefinition(n)
|
||||
|
@ -127,6 +129,9 @@ func (w *OrgWriter) writeHeadline(h Headline) {
|
|||
if len(h.Children) != 0 {
|
||||
w.WriteString(w.indent)
|
||||
}
|
||||
if h.Properties != nil {
|
||||
w.writeNodes(h.Properties)
|
||||
}
|
||||
w.writeNodes(h.Children...)
|
||||
}
|
||||
|
||||
|
@ -147,6 +152,12 @@ func (w *OrgWriter) writeBlock(b Block) {
|
|||
w.WriteString(w.indent + "#+END_" + b.Name + "\n")
|
||||
}
|
||||
|
||||
func (w *OrgWriter) writeDrawer(d Drawer) {
|
||||
w.WriteString(w.indent + ":" + d.Name + ":\n")
|
||||
w.writeNodes(d.Children...)
|
||||
w.WriteString(w.indent + ":END:\n")
|
||||
}
|
||||
|
||||
func (w *OrgWriter) writeFootnotes(d *Document) {
|
||||
fs := d.Footnotes
|
||||
if len(fs.Definitions) == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue