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

@ -17,7 +17,7 @@ type Headline struct {
}
var headlineRegexp = regexp.MustCompile(`^([*]+)\s+(.*)`)
var tagRegexp = regexp.MustCompile(`(.*?)\s*(:[A-Za-z0-9@#%:]+:\s*$)`)
var tagRegexp = regexp.MustCompile(`(.*?)\s+(:[A-Za-z0-9_@#%:]+:\s*$)`)
func lexHeadline(line string) (token, bool) {
if m := headlineRegexp.FindStringSubmatch(line); m != nil {