Add minimal affiliated keyword support. Just captions for now

This commit is contained in:
Niklas Fasching 2018-12-03 19:18:25 +01:00
parent 2399fec2eb
commit 043095e672
7 changed files with 138 additions and 8 deletions

View file

@ -48,6 +48,8 @@ func (w *OrgWriter) writeNodes(ns ...Node) {
w.writeComment(n)
case Keyword:
w.writeKeyword(n)
case NodeWithMeta:
w.writeNodeWithMeta(n)
case Headline:
w.writeHeadline(n)
case Block:
@ -164,6 +166,13 @@ func (w *OrgWriter) writeKeyword(k Keyword) {
w.WriteString(w.indent + fmt.Sprintf("#+%s: %s\n", k.Key, k.Value))
}
func (w *OrgWriter) writeNodeWithMeta(m NodeWithMeta) {
for k, v := range m.Meta {
w.writeNodes(Keyword{k, v})
}
w.writeNodes(m.Node)
}
func (w *OrgWriter) writeComment(c Comment) {
w.WriteString(w.indent + "#" + c.Content)
}