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:
parent
c759df1efe
commit
ed8764940f
5 changed files with 41 additions and 25 deletions
19
org/util.go
Normal file
19
org/util.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue