1
0
Fork 0
forked from forgejo/forgejo

goldmark v1.1.19 -> v1.1.23 (#10519)

vendor update
This commit is contained in:
6543 2020-02-28 14:06:11 +01:00 committed by GitHub
parent 74433c91bf
commit 15c7738b3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1902 additions and 120 deletions

View file

@ -236,10 +236,12 @@ func (n *BaseNode) RemoveChild(self, v Node) {
// RemoveChildren implements Node.RemoveChildren .
func (n *BaseNode) RemoveChildren(self Node) {
for c := n.firstChild; c != nil; c = c.NextSibling() {
for c := n.firstChild; c != nil; {
c.SetParent(nil)
c.SetPreviousSibling(nil)
next := c.NextSibling()
c.SetNextSibling(nil)
c = next
}
n.firstChild = nil
n.lastChild = nil
@ -466,20 +468,25 @@ type Walker func(n Node, entering bool) (WalkStatus, error)
// Walk walks a AST tree by the depth first search algorithm.
func Walk(n Node, walker Walker) error {
_, err := walkHelper(n, walker)
return err
}
func walkHelper(n Node, walker Walker) (WalkStatus, error) {
status, err := walker(n, true)
if err != nil || status == WalkStop {
return err
return status, err
}
if status != WalkSkipChildren {
for c := n.FirstChild(); c != nil; c = c.NextSibling() {
if err = Walk(c, walker); err != nil {
return err
if st, err := walkHelper(c, walker); err != nil || st == WalkStop {
return WalkStop, err
}
}
}
status, err = walker(n, false)
if err != nil || status == WalkStop {
return err
return WalkStop, err
}
return nil
return WalkContinue, nil
}

View file

@ -303,11 +303,11 @@ func NewBlockquote() *Blockquote {
}
}
// A List structr represents a list of Markdown text.
// A List struct represents a list of Markdown text.
type List struct {
BaseBlock
// Marker is a markar character like '-', '+', ')' and '.'.
// Marker is a marker character like '-', '+', ')' and '.'.
Marker byte
// IsTight is a true if this list is a 'tight' list.
@ -364,7 +364,7 @@ func NewList(marker byte) *List {
type ListItem struct {
BaseBlock
// Offset is an offset potision of this item.
// Offset is an offset position of this item.
Offset int
}

View file

@ -170,7 +170,7 @@ func NewText() *Text {
}
}
// NewTextSegment returns a new Text node with the given source potision.
// NewTextSegment returns a new Text node with the given source position.
func NewTextSegment(v textm.Segment) *Text {
return &Text{
BaseInline: BaseInline{},
@ -467,7 +467,7 @@ type AutoLink struct {
// Inline implements Inline.Inline.
func (n *AutoLink) Inline() {}
// Dump implenets Node.Dump
// Dump implements Node.Dump
func (n *AutoLink) Dump(source []byte, level int) {
segment := n.value.Segment
m := map[string]string{