Fix headline tags, table pretty printing and multiline links

- we can't just look at the len of the string (~ #bytes) - that breaks down for
  tables containing characters consisting of multiple bytes. This handles
  more (still not all) cases and is good enough for now
- add _ to allowed tag chars - also require space between headline and tags
- links (link itself, not the description) spanning multiple lines are not
  supported - otherwise we would have to take care of splitting link and adding
  indentation for org pretty printing - and that sounds like such an edge case
  that it seems cleaner to forbid them
This commit is contained in:
Niklas Fasching 2018-12-19 12:58:07 +01:00
parent fb837e04af
commit ec895cbe83
7 changed files with 61 additions and 4 deletions

View file

@ -3,6 +3,7 @@ package org
import (
"fmt"
"strings"
"unicode/utf8"
)
type stringBuilder = strings.Builder
@ -268,7 +269,7 @@ func (w *OrgWriter) writeTable(t Table) {
if content == "" {
content = " "
}
n := column.Len - len(content)
n := column.Len - utf8.RuneCountInString(content)
if n < 0 {
n = 0
}