🏗️ Connected transform namespace in templateutil

This commit is contained in:
Maxim Lebedev 2023-11-10 02:14:53 +06:00
parent 7cf9c53f8a
commit d60e4f41f6
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"source.toby3d.me/toby3d/home/internal/templateutil/partials"
"source.toby3d.me/toby3d/home/internal/templateutil/safe"
"source.toby3d.me/toby3d/home/internal/templateutil/strings"
"source.toby3d.me/toby3d/home/internal/templateutil/transform"
"source.toby3d.me/toby3d/home/internal/templateutil/urls"
)
@ -60,6 +61,14 @@ func New(dir fs.FS, siter site.UseCase) (template.FuncMap, error) {
"relURL": urlsNamespace.RelURL,
},
})
transformNamespace := transform.New()
funcs = append(funcs, Function{
Name: "transform",
Handler: func(v ...any) any { return transformNamespace },
Methods: template.FuncMap{
"markdownify": transformNamespace.Markdownify,
},
})
for _, f := range funcs {
funcMap[f.Name] = f.Handler