Housekeeping
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,5 @@
|
|||||||
Test.lua
|
Test.lua
|
||||||
|
*.lua
|
||||||
|
avorion-docparser.exe
|
||||||
|
sync
|
||||||
|
test
|
||||||
|
4
main.go
4
main.go
@@ -96,7 +96,7 @@ func ParseFile(filename string) (*Class, error) {
|
|||||||
if class.Length() == 0 {
|
if class.Length() == 0 {
|
||||||
return nil, fmt.Errorf("no class found")
|
return nil, fmt.Errorf("no class found")
|
||||||
}
|
}
|
||||||
res.ClassName = class.Text()
|
res.ClassName = strings.TrimSpace(class.Text())
|
||||||
|
|
||||||
codeblocks := doc.Find("div.floatright > div.codecontainer")
|
codeblocks := doc.Find("div.floatright > div.codecontainer")
|
||||||
if codeblocks.Length() == 0 {
|
if codeblocks.Length() == 0 {
|
||||||
@@ -156,7 +156,7 @@ func ParseFile(filename string) (*Class, error) {
|
|||||||
res.Methods = append(res.Methods, method)
|
res.Methods = append(res.Methods, method)
|
||||||
})
|
})
|
||||||
|
|
||||||
spew.Dump(res)
|
// spew.Dump(res)
|
||||||
|
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
3
types.go
3
types.go
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -43,6 +44,8 @@ func (c *Class) GetOutFile() (*os.File, error) {
|
|||||||
return nil, fmt.Errorf("ClassName is empty")
|
return nil, fmt.Errorf("ClassName is empty")
|
||||||
}
|
}
|
||||||
filename := fmt.Sprintf("%s.lua", c.ClassName)
|
filename := fmt.Sprintf("%s.lua", c.ClassName)
|
||||||
|
filename = strings.ReplaceAll(filename, " ", "")
|
||||||
|
filename = strings.ReplaceAll(filename, "-", "")
|
||||||
f, err := os.Create(filename)
|
f, err := os.Create(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user