Improve ATTR_HTML keyword parsing
Org mode separates kvs not as initially assumed by whitespace (~ csv) but rather at keywords (~ :\w+). This is still not replicating Org mode behaviour though as I decided against attributes ignoring multi-definitions. Instead we stack their values (and those existing on the element) for certain attributes (class, style for now). e.g. [[foo]] would become <foo class="a"> in Org mode but becomes <foo class="a b"> with go-org.
This commit is contained in:
parent
0e64f9df7f
commit
dce67eaddf
7 changed files with 25 additions and 22 deletions
|
@ -184,11 +184,6 @@ func (w *OrgWriter) writeNodeWithMeta(n NodeWithMeta) {
|
|||
}
|
||||
for _, attributes := range n.Meta.HTMLAttributes {
|
||||
w.WriteString("#+ATTR_HTML: ")
|
||||
for i := 0; i < len(attributes)-1; i += 2 {
|
||||
if strings.ContainsAny(attributes[i+1], "\t ") {
|
||||
attributes[i+1] = fmt.Sprintf(`"%s"`, attributes[i+1])
|
||||
}
|
||||
}
|
||||
w.WriteString(strings.Join(attributes, " ") + "\n")
|
||||
}
|
||||
w.writeNodes(n.Node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue