🚚 Reimported exists templateutils
This commit is contained in:
parent
675926e420
commit
e3362fcd9f
|
@ -5,9 +5,9 @@ import (
|
|||
"html/template"
|
||||
"io/fs"
|
||||
|
||||
"source.toby3d.me/toby3d/home/internal/templateutil/partial"
|
||||
"source.toby3d.me/toby3d/home/internal/templateutil/partials"
|
||||
"source.toby3d.me/toby3d/home/internal/templateutil/safe"
|
||||
strings "source.toby3d.me/toby3d/home/internal/templateutil/string"
|
||||
"source.toby3d.me/toby3d/home/internal/templateutil/strings"
|
||||
)
|
||||
|
||||
type Function struct {
|
||||
|
@ -17,7 +17,7 @@ type Function struct {
|
|||
}
|
||||
|
||||
func New(dir fs.FS) (template.FuncMap, error) {
|
||||
partials, err := fs.Sub(dir, "partials")
|
||||
partialDir, err := fs.Sub(dir, "partials")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot substitute into partials subdirectory: %w", err)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func New(dir fs.FS) (template.FuncMap, error) {
|
|||
"safeHTML": safeNamespace.HTML,
|
||||
},
|
||||
})
|
||||
partialNamespace := partial.New(partials, funcMap)
|
||||
partialNamespace := partials.New(partialDir, funcMap)
|
||||
funcs = append(funcs, Function{
|
||||
Name: "partials",
|
||||
Handler: func(v ...any) any { return partialNamespace },
|
||||
|
|
Loading…
Reference in New Issue