diff --git a/class.go b/class.go index fd148d9..db4442c 100644 --- a/class.go +++ b/class.go @@ -330,7 +330,8 @@ func parseMethod(s *goquery.Selection) (Method, error) { } res.Name = id - returns := s.Find("span.keyword") + signatureData := s.Children().Eq(0) + returns := signatureData.Find("span.keyword") if returns.Length() != 0 { returnsText := CleanUp(returns.Text()) returnsText = strings.ReplaceAll(returnsText, "function", "") @@ -342,8 +343,8 @@ func parseMethod(s *goquery.Selection) (Method, error) { }) } - types := s.Find("span.type") - parameters := s.Find("span.parameter") + types := signatureData.Find("span.type") + parameters := signatureData.Find("span.parameter") types.Each(func(i int, s *goquery.Selection) { res.Params = append(res.Params, Param{ Name: MapName(CleanUp(parameters.Eq(i).Text())), @@ -352,18 +353,68 @@ func parseMethod(s *goquery.Selection) (Method, error) { }) }) - //
+ // I assume this is a bug with their documentation generator + // So we just ignore it + return + } + text := CleanUp(s.Text()) + if text == "" { + return + } + if s.Is("p") { + switch text { + case "Parameters": + state = 1 + case "Returns": + state = 2 + return + } + } else { + log.Printf("%#v", state) + } + }) + + //
- // function var add(CargoBay other)
+ // function unsigned int addCargo(TradingGood
+ // good, int amount)
//
+ // Adds cargo to the entity. If the amount specified exceeds the maximum capacity of the cargo + // bay, as + // much cargo as still fits in will be added. + //
+ //Parameters
+ //Returns
//- // nothing + // How much was actually added (can be less than amount when cargo bay is full) //
//