mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-24 22:26:04 +03:00
27 lines
588 B
Go
27 lines
588 B
Go
package core
|
|
|
|
import (
|
|
"html/template"
|
|
|
|
"github.com/gin-contrib/multitemplate"
|
|
)
|
|
|
|
// Renderer wraps multitemplate.Renderer in order to make it easier to use
|
|
type Renderer struct {
|
|
multitemplate.Renderer
|
|
FuncMap template.FuncMap
|
|
}
|
|
|
|
// NewRenderer is a Renderer constructor
|
|
func NewRenderer(funcMap template.FuncMap) Renderer {
|
|
return Renderer{
|
|
Renderer: multitemplate.NewRenderer(),
|
|
FuncMap: funcMap,
|
|
}
|
|
}
|
|
|
|
// Push is an AddFromFilesFuncs wrapper
|
|
func (r *Renderer) Push(name string, files ...string) *template.Template {
|
|
return r.AddFromFilesFuncs(name, r.FuncMap, files...)
|
|
}
|