123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package test
- import (
- "html/template"
- "time"
- "github.com/gofiber/fiber/v2"
- "github.com/gofiber/template/html"
- )
- const (
- testVersion = "1"
- testGA = false
- )
- func GetFiberConfig() fiber.Config {
- engine := html.New("./../../templates", ".html")
- // nolint:gocritic
- engine.AddFunc("now", func() time.Time {
- return time.Now()
- })
- // nolint:gosec
- engine.AddFunc("noescape", func(str string) template.HTML {
- return template.HTML(str)
- })
- engine.AddFunc("gridsep", func(i, l int) bool {
- i++
- return i%3 == 0 && i != l
- })
- engine.AddFunc("version", func() string {
- return testVersion
- })
- engine.AddFunc("ga", func() bool {
- return testGA
- })
- return fiber.Config{
- Views: engine,
- }
- }
|