1
0
Fork 0
mirror of https://github.com/Luzifer/repo-template.git synced 2024-11-10 00:20:03 +00:00
repo-template/template.go
Knut Ahlers a0b3b414c5
Migrate to pongo2 as template engine
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-02-07 22:20:28 +01:00

21 lines
498 B
Go

package main
import (
"strings"
"github.com/flosch/pongo2"
"github.com/gosimple/slug"
)
func init() {
pongo2.RegisterFilter("groovy_save", tplGroovyFileSave)
pongo2.RegisterFilter("slugify", tplSlugify)
}
func tplSlugify(in, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {
return pongo2.AsValue(slug.Make(in.String())), nil
}
func tplGroovyFileSave(in, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {
return pongo2.AsValue(strings.Replace(in.String(), "-", "_", -1)), nil
}