Documentation
¶
Index ¶
- type Helpers
- type Template
- func (t *Template) Body() string
- func (t *Template) Env(key string, defaults ...string) (string, error)
- func (t *Template) File(path string) (string, error)
- func (t *Template) HasEnv(key string) bool
- func (t *Template) HasFile(path string) bool
- func (t *Template) HasVar(key string) bool
- func (t *Template) Helpers() *Helpers
- func (t *Template) Name() string
- func (t *Template) Process(dst io.Writer) error
- func (t *Template) SetVar(key string, value interface{})
- func (t *Template) Var(key string, defaults ...interface{}) (interface{}, error)
- func (t *Template) ViewFuncs() texttemplate.FuncMap
- func (t *Template) WithBody(body string) *Template
- func (t *Template) WithDelims(left, right string) *Template
- func (t *Template) WithInclude(body string) *Template
- func (t *Template) WithName(name string) *Template
- func (t *Template) WithVar(key string, value interface{}) *Template
- func (t *Template) WithVars(vars Vars) *Template
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Helpers ¶
type Helpers struct{}
Helpers is a namespace for helper functions.
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template is a wrapper for html.Template.
func NewFromFile ¶
NewFromFile creates a new template from a file.
func (*Template) Name ¶
Name returns the template name if set, or if not set, just "template" as a constant.
func (*Template) ViewFuncs ¶
func (t *Template) ViewFuncs() texttemplate.FuncMap
ViewFuncs returns the view funcs.
func (*Template) WithBody ¶
WithBody sets the template body and returns a reference to the template object.
func (*Template) WithDelims ¶
WithDelims sets the template action delimiters, treating empty string as default delimiter.
func (*Template) WithInclude ¶
WithInclude includes a (sub) template into the rendering assets.
Click to show internal directories.
Click to hide internal directories.