Add basic support for statistic tokens (e.g. [100%] [1/1])

Org mode does not care where those tokens are when it comes to the
export (afaict). We'll do the same.

(They should only be in the first line of a list item or a headline)
This commit is contained in:
Niklas Fasching 2018-12-18 14:14:08 +01:00
parent dce67eaddf
commit a60f844e38
6 changed files with 59 additions and 6 deletions

View file

@ -103,6 +103,8 @@ func (w *HTMLWriter) writeNodes(ns ...Node) {
w.writeText(n)
case Emphasis:
w.writeEmphasis(n)
case StatisticToken:
w.writeStatisticToken(n)
case ExplicitLineBreak:
w.writeExplicitLineBreak(n)
case LineBreak:
@ -234,6 +236,10 @@ func (w *HTMLWriter) writeEmphasis(e Emphasis) {
w.WriteString(tags[1])
}
func (w *HTMLWriter) writeStatisticToken(s StatisticToken) {
w.WriteString(fmt.Sprintf(`<code class="statistic">[%s]</code>`, s.Content))
}
func (w *HTMLWriter) writeLineBreak(l LineBreak) {
w.WriteString(strings.Repeat("\n", l.Count))
}