Fix paragraphs: Empty lines separate paragraphs

Somehow i thought it was 2 empty lines rather than 1 - makes more sense this
way... :D
This commit is contained in:
Niklas Fasching 2018-12-03 01:42:31 +01:00
parent c759df1efe
commit ed8764940f
5 changed files with 41 additions and 25 deletions

19
org/util.go Normal file
View file

@ -0,0 +1,19 @@
package org
func isSecondBlankLine(d *Document, i int) bool {
if i-1 <= 0 {
return false
}
t1, t2 := d.tokens[i-1], d.tokens[i]
if t1.kind == "text" && t2.kind == "text" && t1.content == "" && t2.content == "" {
return true
}
return false
}
func isEmptyLineParagraph(n Node) bool {
if p, _ := n.(Paragraph); len(p.Children) == 1 {
return len(p.Children[0].(Line).Children) == 0
}
return false
}