diff --git a/cli/htmgo/tasks/astgen/entry.go b/cli/htmgo/tasks/astgen/entry.go index a199204..e229c3b 100644 --- a/cli/htmgo/tasks/astgen/entry.go +++ b/cli/htmgo/tasks/astgen/entry.go @@ -292,12 +292,12 @@ func formatRoute(path string) string { return "/" } if !strings.HasPrefix(path, "/") { - path = "/" + path + path = filepath.Join("/", path) } if strings.HasSuffix(path, "/") { - return path[:len(path)-1] + return strings.ReplaceAll(path[:len(path)-1], `\`, "/") } - return path + return strings.ReplaceAll(filepath.Clean(path), `\`, "/") } func writePagesFile() { diff --git a/cli/htmgo/tasks/astgen/writer.go b/cli/htmgo/tasks/astgen/writer.go index c19cb25..578f3eb 100644 --- a/cli/htmgo/tasks/astgen/writer.go +++ b/cli/htmgo/tasks/astgen/writer.go @@ -49,7 +49,7 @@ func WriteFile(path string, cb func(content *ast.File) string) { slog.Debug("astgen.WriteFile", slog.String("path", path), slog.String("content", string(bytes))) - formatEnabled := false + formatEnabled := true if formatEnabled { bytes, err = format.Source(bytes)