From 2f886a474dc3fac7a5caf84be4d192620f846842 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 15 Sep 2024 14:24:20 +0200 Subject: [PATCH] Implement parameter comment parsing --- class.go | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/class.go b/class.go index db4442c..d068ab2 100644 --- a/class.go +++ b/class.go @@ -385,7 +385,36 @@ func parseMethod(s *goquery.Selection) (Method, error) { return } } else { - log.Printf("%#v", state) + if s.Is("div.indented") && state == 1 { + log.Printf("%#v", state) + parameter := "" + html, err := s.Html() + if err != nil { + Error.Printf("Error parsing html: %v", err) + return + } + html = strings.ReplaceAll(html, "\t", "") + htmlLines := strings.Split(html, "\n") + for _, line := range htmlLines { + if strings.Contains(line, "") { + line = strings.TrimSpace(line) + line = strings.ReplaceAll(line, "", "") + line = strings.ReplaceAll(line, "", "") + parameter = line + continue + } + if strings.Contains(line, "
") { + comment := strings.TrimSpace(line) + comment = strings.ReplaceAll(comment, "
", "") + for i := range res.Params { + if res.Params[i].Name == parameter { + res.Params[i].Comment = comment + break + } + } + } + } + } } })