This commit is contained in:
Simon Martens
2025-03-05 16:41:39 +01:00
commit e19fd47c17
88 changed files with 9765 additions and 0 deletions

32
templating/helpers.go Normal file
View File

@@ -0,0 +1,32 @@
package templating
import "strings"
func PathToFSPath(p string) string {
if p == "/" {
return "."
}
p = strings.TrimPrefix(p, "/")
p = strings.TrimSuffix(p, "/")
return p
}
func FSPathToPath(p string) string {
if p == "." {
return "/"
}
p = strings.TrimPrefix(p, ".")
if !strings.HasPrefix(p, "/") {
p = "/" + p
}
if !strings.HasSuffix(p, "/") {
p = p + "/"
}
return p
}