diff --git a/.gitignore b/.gitignore index 046dbb7..df340ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ Test.lua +*.lua +avorion-docparser.exe +sync +test diff --git a/main.go b/main.go index 8e6a46f..559c14e 100644 --- a/main.go +++ b/main.go @@ -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 } diff --git a/types.go b/types.go index bf43a5e..df65976 100644 --- a/types.go +++ b/types.go @@ -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