mark2web/pkg/filter/init.go

30 lines
589 B
Go
Raw Normal View History

2019-03-18 13:34:52 +01:00
package filter
import (
"github.com/flosch/pongo2"
_ "github.com/flosch/pongo2-addons"
)
func init() {
err := pongo2.ReplaceFilter("markdown", MarkdownFilter)
if err != nil {
2022-02-28 10:51:20 +01:00
err = pongo2.RegisterFilter("markdown", MarkdownFilter)
if err != nil {
panic(err)
}
2019-03-18 13:34:52 +01:00
}
newFilters := map[string]pongo2.FilterFunction{
"image_process": ImageProcessFilter,
"relative_path": RelativePathFilter,
"json": JSONFilter,
"dump": DumpFilter,
}
for name, fn := range newFilters {
err := pongo2.RegisterFilter(name, fn)
if err != nil {
panic(err)
}
}
}