Housekeeping

This commit is contained in:
2024-09-12 09:06:33 +02:00
parent 901232d293
commit 5cafdbf239
3 changed files with 9 additions and 2 deletions

4
.gitignore vendored
View File

@@ -1 +1,5 @@
Test.lua
*.lua
avorion-docparser.exe
sync
test

View File

@@ -96,7 +96,7 @@ func ParseFile(filename string) (*Class, error) {
if class.Length() == 0 {
return nil, fmt.Errorf("no class found")
}
res.ClassName = class.Text()
res.ClassName = strings.TrimSpace(class.Text())
codeblocks := doc.Find("div.floatright > div.codecontainer")
if codeblocks.Length() == 0 {
@@ -156,7 +156,7 @@ func ParseFile(filename string) (*Class, error) {
res.Methods = append(res.Methods, method)
})
spew.Dump(res)
// spew.Dump(res)
return &res, nil
}

View File

@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strings"
)
type (
@@ -43,6 +44,8 @@ func (c *Class) GetOutFile() (*os.File, error) {
return nil, fmt.Errorf("ClassName is empty")
}
filename := fmt.Sprintf("%s.lua", c.ClassName)
filename = strings.ReplaceAll(filename, " ", "")
filename = strings.ReplaceAll(filename, "-", "")
f, err := os.Create(filename)
if err != nil {
return nil, err