Add support for custom numbering of ordered list using [@\d+]
org mode supports [1] setting the value attribute [2] of ordered list items to change the numbering for the current and following items. Let's do the same. As the attribute has no meaning for other types of lists [2] we'll just not support it for those cases [3]. [1] https://orgmode.org/manual/Plain-Lists.html#Plain-Lists [2] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attributes [3] Org mode seems to instead set the id attribute for e.g. unordered lists starting with `[@\d+]\s` - but I don't really see the value in that and will skip that for now.
This commit is contained in:
parent
b3edd6c182
commit
21f1af7d48
6 changed files with 38 additions and 6 deletions
|
@ -412,11 +412,14 @@ func (w *HTMLWriter) WriteList(l List) {
|
|||
}
|
||||
|
||||
func (w *HTMLWriter) WriteListItem(li ListItem) {
|
||||
if li.Status != "" {
|
||||
w.WriteString(fmt.Sprintf("<li class=\"%s\">\n", listItemStatuses[li.Status]))
|
||||
} else {
|
||||
w.WriteString("<li>\n")
|
||||
attributes := ""
|
||||
if li.Value != "" {
|
||||
attributes += fmt.Sprintf(` value="%s"`, li.Value)
|
||||
}
|
||||
if li.Status != "" {
|
||||
attributes += fmt.Sprintf(` class="%s"`, listItemStatuses[li.Status])
|
||||
}
|
||||
w.WriteString(fmt.Sprintf("<li%s>\n", attributes))
|
||||
WriteNodes(w, li.Children...)
|
||||
w.WriteString("</li>\n")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue