Implement method return comments
This commit is contained in:
49
class.go
49
class.go
@@ -11,7 +11,6 @@ import (
|
||||
"text/template"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
//go:embed class.tmpl
|
||||
@@ -385,8 +384,8 @@ func parseMethod(s *goquery.Selection) (Method, error) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if s.Is("div.indented") && state == 1 {
|
||||
log.Printf("%#v", state)
|
||||
if s.Is("div.indented") {
|
||||
if state == 1 {
|
||||
parameter := ""
|
||||
html, err := s.Html()
|
||||
if err != nil {
|
||||
@@ -414,43 +413,21 @@ func parseMethod(s *goquery.Selection) (Method, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if state == 2 {
|
||||
text := CleanUp(s.Text())
|
||||
if text == "" {
|
||||
return
|
||||
}
|
||||
// TODO: Figure out what to do when a function
|
||||
if res.Returns[0].Comment != "" {
|
||||
res.Returns[0].Comment += "\n"
|
||||
}
|
||||
res.Returns[0].Comment += text
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// <div id="addCargo" class="codecontainer">
|
||||
// <div id="addCargo" class="function">
|
||||
// <p>
|
||||
// <span class="keyword">function unsigned int</span> addCargo(<span
|
||||
// class="type">TradingGood</span>
|
||||
// <span class="parameter">good</span>, <span class="type">int</span> <span
|
||||
// class="parameter">amount</span>) <br />
|
||||
// </p>
|
||||
// </div>
|
||||
// <div id="addCargo" class="">
|
||||
// <p>
|
||||
// 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.
|
||||
// </p>
|
||||
// <p><span class="docheader">Parameters</span></p>
|
||||
// <div class="indented">
|
||||
// <span class="parameter">good</span>
|
||||
// TradingGood that is to be added. <br />
|
||||
// <span class="parameter">amount</span>
|
||||
// The amount of cargo that should be added. <br />
|
||||
// </div>
|
||||
// <p><span class="docheader">Returns</span></p>
|
||||
// <div class="indented">
|
||||
// <p>
|
||||
// How much was actually added (can be less than amount when cargo bay is full)
|
||||
// </p>
|
||||
// </div>
|
||||
// </p>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
spew.Dump(res)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user