Fix issue with recursively getting children instead of immediate children
This commit is contained in:
7
class.go
7
class.go
@@ -11,7 +11,6 @@ import (
|
||||
"text/template"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
//go:embed class.tmpl
|
||||
@@ -215,7 +214,7 @@ func getConstructor(dataContainer *goquery.Selection) (Constructor, error) {
|
||||
// 1 parameters
|
||||
// 2 returns
|
||||
state := 0
|
||||
children := descriptor.Children()
|
||||
children := descriptor.Eq(0).Children()
|
||||
childrenLength := children.Length()
|
||||
children.Each(func(i int, s *goquery.Selection) {
|
||||
if i == childrenLength-1 {
|
||||
@@ -251,11 +250,13 @@ func getConstructor(dataContainer *goquery.Selection) (Constructor, error) {
|
||||
cparam.Comment = CleanUp(cleanText)
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
log.Printf("%#v", s.Text())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
spew.Dump(resConstructor)
|
||||
// spew.Dump(resConstructor)
|
||||
return resConstructor, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user