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

@ -4,6 +4,7 @@ import (
"regexp"
"strconv"
"strings"
"unicode/utf8"
)
type Table struct {
@ -89,8 +90,8 @@ func getColumnInfos(rows [][]string) []ColumnInfo {
continue
}
if len(columns[i]) > columnInfos[i].Len {
columnInfos[i].Len = len(columns[i])
if n := utf8.RuneCountInString(columns[i]); n > columnInfos[i].Len {
columnInfos[i].Len = n
}
if m := columnAlignRegexp.FindStringSubmatch(columns[i]); m != nil && isSpecialRow(columns) {