Fix HTML_ATTR rendering (naive)
- was missing spaces between attributes when rendering to org - was duplicating attributes when rendering to html - now we join / replace attributes depending on the name - for now only class & style are appended
This commit is contained in:
parent
08ff3ac22e
commit
0a905ca172
6 changed files with 28 additions and 12 deletions
|
@ -182,14 +182,11 @@ 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 {
|
||||
w.WriteString(attributes[i] + " ")
|
||||
if strings.ContainsAny(attributes[i+1], "\t ") {
|
||||
w.WriteString(`"` + attributes[i+1] + `"`)
|
||||
} else {
|
||||
w.WriteString(attributes[i+1])
|
||||
attributes[i+1] = fmt.Sprintf(`"%s"`, attributes[i+1])
|
||||
}
|
||||
}
|
||||
w.WriteString("\n")
|
||||
w.WriteString(strings.Join(attributes, " ") + "\n")
|
||||
}
|
||||
w.writeNodes(n.Node)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue