mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
474 B
Go
24 lines
474 B
Go
package ast
|
|
|
|
func FindPrevSiblingExceptLineBreak(node Node) Node {
|
|
if node == nil {
|
|
return nil
|
|
}
|
|
prev := node.PrevSibling()
|
|
if prev != nil && prev.Type() == LineBreakNode {
|
|
return FindPrevSiblingExceptLineBreak(prev)
|
|
}
|
|
return prev
|
|
}
|
|
|
|
func FindNextSiblingExceptLineBreak(node Node) Node {
|
|
if node == nil {
|
|
return nil
|
|
}
|
|
next := node.NextSibling()
|
|
if next != nil && next.Type() == LineBreakNode {
|
|
return FindNextSiblingExceptLineBreak(next)
|
|
}
|
|
return next
|
|
}
|