Documentation ¶
Index ¶
- Constants
- func Add(left, right int) int
- func List(l *list.List) chan interface{}
- func Load(opt Options) (map[string]*template.Template, error)
- func LoadWithFuncMap(opt Options) (map[string]*template.Template, error)
- func Range(l int) []struct{}
- func RangeN(start, last int) map[int]struct{}
- func Sub(left, right int) int
- func Version() string
- type After
- type AfterBuf
- type Before
- type IRenderer
- type Options
- type Renderer
- func (r *Renderer) Render(name string, bindings ...interface{}) error
- func (r *Renderer) RenderBytes(name string, binding ...interface{}) ([]byte, error)
- func (r *Renderer) SetRenderer(renders *Renders, ctx *tango.Context, before, after func(string), ...)
- func (r *Renderer) StatusRender(status int, name string, bindings ...interface{}) error
- func (r *Renderer) Template(name string) *template.Template
- type Renders
- type T
Constants ¶
View Source
const ( ContentType = "Content-Type" ContentLength = "Content-Length" ContentHTML = "text/html" ContentXHTML = "application/xhtml+xml" )
Variables ¶
This section is empty.
Functions ¶
func LoadWithFuncMap ¶
LoadWithFuncMap prepares and parses all templates from the passed basePath and injects a custom template.FuncMap into each template
Types ¶
type Options ¶
type Options struct { // if reload templates Reload bool // Directory to load templates. Default is "templates" Directory string // Extensions to parse template files from. Defaults to [".tmpl"] Extensions []string // Funcs is a slice of FuncMaps to apply to the template upon compilation. This is useful for helper functions. Defaults to []. Funcs template.FuncMap // Vars is a data map for global Vars T // Appends the given charset to the Content-Type header. Default is "UTF-8". Charset string // Allows changing of output to XHTML instead of HTML. Default is "text/html" HTMLContentType string // default Delims DelimsLeft, DelimsRight string // where the file stored FileSystem http.FileSystem }
Options is a struct for specifying configuration options for the render.Renderer middleware
func (Options) IsExtMatch ¶
IsExtMatch is a file name match the ext
type Renderer ¶
type Renderer struct { Charset string HTMLContentType string // contains filtered or unexported fields }
func (*Renderer) Render ¶
Render a template
r.Render("index.html") r.Render("index.html", renders.T{ "name": value, })
func (*Renderer) RenderBytes ¶
RenderBytes Will not called before & after method.
func (*Renderer) SetRenderer ¶
func (*Renderer) StatusRender ¶
Click to show internal directories.
Click to hide internal directories.