Skip to content

Commit c1390b0

Browse files
committed
rename LastChild() => GetLastChild() etc.
1 parent 11d0786 commit c1390b0

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

ast/node.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,29 +344,29 @@ func IsContainer(n Node) bool {
344344
return n.AsContainer() != nil
345345
}
346346

347-
// LastChild returns last child of this node
347+
// GetLastChild returns last child of this node
348348
// It's implemented as stand-alone function to keep Node interface small
349-
func LastChild(n Node) Node {
349+
func GetLastChild(n Node) Node {
350350
a := n.GetChildren()
351351
if len(a) > 0 {
352352
return a[len(a)-1]
353353
}
354354
return nil
355355
}
356356

357-
// FirstChild returns first child of this node
357+
// GetFirstChild returns first child of this node
358358
// It's implemented as stand-alone function to keep Node interface small
359-
func FirstChild(n Node) Node {
359+
func GetFirstChild(n Node) Node {
360360
a := n.GetChildren()
361361
if len(a) > 0 {
362362
return a[0]
363363
}
364364
return nil
365365
}
366366

367-
// NextNode returns next sibling of this node
367+
// GetNextNode returns next sibling of this node
368368
// We can't make it part of Container or Leaf because we loose Node identity
369-
func NextNode(n Node) Node {
369+
func GetNextNode(n Node) Node {
370370
parent := n.GetParent()
371371
if parent == nil {
372372
return nil
@@ -381,9 +381,9 @@ func NextNode(n Node) Node {
381381
return nil
382382
}
383383

384-
// PrevNode returns sibling node before n
384+
// GetPrevNode returns sibling node before n
385385
// We can't make it part of Container or Leaf because we loose Node identity
386-
func PrevNode(n Node) Node {
386+
func GetPrevNode(n Node) Node {
387387
parent := n.GetParent()
388388
if parent == nil {
389389
return nil

html/renderer.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func footnoteReturnLink(prefix, returnLink string, slug []byte) string {
336336
}
337337

338338
func listItemOpenCR(listItem *ast.ListItem) bool {
339-
if ast.PrevNode(listItem) == nil {
339+
if ast.GetPrevNode(listItem) == nil {
340340
return false
341341
}
342342
ld := listItem.Parent.(*ast.List)
@@ -532,7 +532,7 @@ func (r *Renderer) imageExit(w io.Writer, image *ast.Image) {
532532
func (r *Renderer) paragraphEnter(w io.Writer, para *ast.Paragraph) {
533533
// TODO: untangle this clusterfuck about when the newlines need
534534
// to be added and when not.
535-
prev := ast.PrevNode(para)
535+
prev := ast.GetPrevNode(para)
536536
if prev != nil {
537537
switch prev.(type) {
538538
case *ast.HTMLBlock, *ast.List, *ast.Paragraph, *ast.Heading, *ast.CodeBlock, *ast.BlockQuote, *ast.HorizontalRule:
@@ -551,7 +551,7 @@ func (r *Renderer) paragraphEnter(w io.Writer, para *ast.Paragraph) {
551551

552552
func (r *Renderer) paragraphExit(w io.Writer, para *ast.Paragraph) {
553553
r.outs(w, "</p>")
554-
if !(isListItem(para.Parent) && ast.NextNode(para) == nil) {
554+
if !(isListItem(para.Parent) && ast.GetNextNode(para) == nil) {
555555
r.cr(w)
556556
}
557557
}
@@ -611,7 +611,7 @@ func (r *Renderer) headingEnter(w io.Writer, nodeData *ast.Heading) {
611611

612612
func (r *Renderer) headingExit(w io.Writer, heading *ast.Heading) {
613613
r.outs(w, headingCloseTagFromLevel(heading.Level))
614-
if !(isListItem(heading.Parent) && ast.NextNode(heading) == nil) {
614+
if !(isListItem(heading.Parent) && ast.GetNextNode(heading) == nil) {
615615
r.cr(w)
616616
}
617617
}
@@ -675,7 +675,7 @@ func (r *Renderer) listExit(w io.Writer, list *ast.List) {
675675
parent := list.Parent
676676
switch parent.(type) {
677677
case *ast.ListItem:
678-
if ast.NextNode(list) != nil {
678+
if ast.GetNextNode(list) != nil {
679679
r.cr(w)
680680
}
681681
case *ast.Document, *ast.BlockQuote:
@@ -774,7 +774,7 @@ func (r *Renderer) tableCell(w io.Writer, tableCell *ast.TableCell, entering boo
774774
if align != "" {
775775
attrs = append(attrs, fmt.Sprintf(`align="%s"`, align))
776776
}
777-
if ast.PrevNode(tableCell) == nil {
777+
if ast.GetPrevNode(tableCell) == nil {
778778
r.cr(w)
779779
}
780780
r.outTag(w, openTag, attrs)
@@ -785,7 +785,7 @@ func (r *Renderer) tableBody(w io.Writer, node *ast.TableBody, entering bool) {
785785
r.cr(w)
786786
r.outs(w, "<tbody>")
787787
// XXX: this is to adhere to a rather silly test. Should fix test.
788-
if ast.FirstChild(node) == nil {
788+
if ast.GetFirstChild(node) == nil {
789789
r.cr(w)
790790
}
791791
} else {

parser/block.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ func endsWithBlankLine(block ast.Node) bool {
12001200
//}
12011201
switch block.(type) {
12021202
case *ast.List, *ast.ListItem:
1203-
block = ast.LastChild(block)
1203+
block = ast.GetLastChild(block)
12041204
default:
12051205
return false
12061206
}

0 commit comments

Comments
 (0)