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

@ -86,6 +86,8 @@ func (w *OrgWriter) writeNodes(ns ...Node) {
w.writeText(n)
case Emphasis:
w.writeEmphasis(n)
case StatisticToken:
w.writeStatisticToken(n)
case LineBreak:
w.writeLineBreak(n)
case ExplicitLineBreak:
@ -285,6 +287,10 @@ func (w *OrgWriter) writeEmphasis(e Emphasis) {
w.WriteString(borders[1])
}
func (w *OrgWriter) writeStatisticToken(s StatisticToken) {
w.WriteString(fmt.Sprintf("[%s]", s.Content))
}
func (w *OrgWriter) writeLineBreak(l LineBreak) {
w.WriteString(strings.Repeat("\n"+w.indent, l.Count))
}