Documentation
¶
Overview ¶
Package engine provides multiple template engine implementations
Index ¶
Constants ¶
const ( EngineGo = "go" EnginePongo2 = "pongo2" EngineMustache = "mustache" EngineHandlebars = "handlebars" )
Available engine types
Variables ¶
This section is empty.
Functions ¶
func AvailableEngines ¶
func AvailableEngines() []string
AvailableEngines returns list of available engine names
Types ¶
type Engine ¶
type Engine interface {
// Name returns the engine name
Name() string
// Parse parses template content and returns a compiled template
Parse(name, content string, funcs template.FuncMap) (Template, error)
// ParseFile parses a template file
ParseFile(path string, funcs template.FuncMap) (Template, error)
}
Engine represents a template engine interface
type GoEngine ¶
type GoEngine struct{}
GoEngine implements Engine using Go's html/template
type GoTemplate ¶
type GoTemplate struct {
// contains filtered or unexported fields
}
GoTemplate wraps Go's template.Template
type HandlebarsEngine ¶
type HandlebarsEngine struct{}
HandlebarsEngine implements Engine using Handlebars (raymond)
func NewHandlebarsEngine ¶
func NewHandlebarsEngine() *HandlebarsEngine
NewHandlebarsEngine creates a new Handlebars template engine
func (*HandlebarsEngine) Name ¶
func (e *HandlebarsEngine) Name() string
Name returns the engine name
type HandlebarsTemplate ¶
type HandlebarsTemplate struct {
// contains filtered or unexported fields
}
HandlebarsTemplate wraps raymond.Template
type MustacheEngine ¶
type MustacheEngine struct{}
MustacheEngine implements Engine using Mustache
func NewMustacheEngine ¶
func NewMustacheEngine() *MustacheEngine
NewMustacheEngine creates a new Mustache template engine
type MustacheTemplate ¶
type MustacheTemplate struct {
// contains filtered or unexported fields
}
MustacheTemplate wraps mustache.Template
type Pongo2Engine ¶
type Pongo2Engine struct{}
Pongo2Engine implements Engine using Pongo2 (Jinja2/Django-like)
func NewPongo2Engine ¶
func NewPongo2Engine() *Pongo2Engine
NewPongo2Engine creates a new Pongo2 template engine
type Pongo2Template ¶
type Pongo2Template struct {
// contains filtered or unexported fields
}
Pongo2Template wraps pongo2.Template