Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSharedFunc ¶
func RegisterSharedFunc(name string, fn interface{})
RegisterSharedFunc registers a functionality that should be inherited from all supported template engines
func RegisterSharedFuncs ¶
func RegisterSharedFuncs(theFuncs map[string]interface{})
RegisterSharedFuncs registers functionalities that should be inherited from all supported template engines
Types ¶
type Engine ¶
type Engine interface {
// BuildTemplates builds the templates for a directory
BuildTemplates() error
// ExecuteWriter finds and execute a template and write its result to the out writer
ExecuteWriter(out io.Writer, name string, binding interface{}, layout string) error
}
Engine the interface that all template engines must inheritance
type Template ¶
type Template struct {
// Engine the type of the Engine
Engine Engine
// Gzip enable gzip compression
// default is false
Gzip bool
// IsDevelopment re-builds the templates on each request
// default is false
IsDevelopment bool
// Directory the system path which the templates live
// default is ./templates
Directory string
// Extensions the allowed file extension
// default is []string{".html"}
Extensions []string
// ContentType is the Content-Type response header
// default is text/html but you can change if if needed
ContentType string
// Layout the template file ( with its extension) which is the mother of all
// use it to have it as a root file, and include others with {{ yield }}, refer the docs
Layout string
// contains filtered or unexported fields
}
Template the internal configs for the common configs for the template engines
func New ¶
New creates and returns a Template instance which keeps the Template Engine and helps with render
Click to show internal directories.
Click to hide internal directories.