Documentation ¶
Overview ¶
Package view provides thread-safe caching of HTML templates.
Index ¶
- type Info
- func (v *Info) Base(base string) *Info
- func (v *Info) New(templateList ...string) *Info
- func (v *Info) Render(w http.ResponseWriter, r *http.Request) error
- func (c *Info) SetFuncMaps(fms ...template.FuncMap)
- func (c *Info) SetModifiers(fn ...ModifyFunc)
- func (c *Info) SetTemplates(rootTemp string, childTemps []string)
- type ModifyFunc
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { BaseURI string Extension string Folder string Caching bool Vars map[string]interface{} // contains filtered or unexported fields }
Info holds view attributes.
func (*Info) Base ¶
Base sets the new base template instead of reading from Template.Root of the config file.
func (*Info) Render ¶
Render parses one or more templates and outputs to the screen. Also returns an error if anything is wrong.
func (*Info) SetFuncMaps ¶
SetFuncMaps will combine all template.FuncMaps into one map and then set the them for each template. If a func already exists, it is rewritten without a warning.
func (*Info) SetModifiers ¶
func (c *Info) SetModifiers(fn ...ModifyFunc)
SetModifiers will set the modifiers for the View that run before rendering.
func (*Info) SetTemplates ¶
SetTemplates will set the root and child templates.
type ModifyFunc ¶
type ModifyFunc func(http.ResponseWriter, *http.Request, *Info)
ModifyFunc can modify the view before rendering.
Click to show internal directories.
Click to hide internal directories.