Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecHelper ¶
type ExecTemplate ¶
type ExecTemplate struct {
// contains filtered or unexported fields
}
func (*ExecTemplate) Name ¶
func (et *ExecTemplate) Name() string
func (*ExecTemplate) Tree ¶
func (et *ExecTemplate) Tree() *parser.Document
type Executor ¶
type Executor struct {
Helper template.ExecHelper
}
type HtmlTemplate ¶
type HtmlTemplate struct { // We could embed the text/template field, but it's safer not to because // we need to keep our version of the name space and the underlying // template's in sync. Text *TextTemplate *NameSpace // common to all associated templates }
HtmlTemplate is a specialized ExecTemplate from "text/template" that produces a safe HTML document fragment.
func (*HtmlTemplate) Funcs ¶
func (t *HtmlTemplate) Funcs(funcMap template.FuncMap) *HtmlTemplate
Funcs adds the elements of the argument map to the template's function map. It must be called before the template is parsed. It panics if a value in the map is not a function with appropriate return type. However, it is legal to overwrite elements of the map. The return value is the template, so calls can be chained.
func (*HtmlTemplate) Name ¶
func (t *HtmlTemplate) Name() string
func (*HtmlTemplate) New ¶
func (t *HtmlTemplate) New(name string) *HtmlTemplate
New allocates a new, undefined template associated with the given one and with the same delimiters. The association, which is transitive, allows one template to invoke another with a {{template}} action.
Because associated templates share underlying data, template construction cannot be done safely in parallel. Once the templates are constructed, they can be executed in parallel.
func (*HtmlTemplate) Parse ¶
func (t *HtmlTemplate) Parse(text string) (*HtmlTemplate, error)
func (*HtmlTemplate) Prepare ¶
func (t *HtmlTemplate) Prepare() (template.ExecTemplate, error)
Prepare returns a template ready for execution.
type NameSpace ¶
type NameSpace struct {
Set map[string]*HtmlTemplate
}
NameSpace is the data structure shared by all templates in an association.
type ParseConfig ¶
type ParseConfig struct {
Version int
}
type ParseInfo ¶
type ParseInfo struct { // Set for shortcode Templates with any {{ .Inner }} IsInner bool // Set for partials with a return statement. HasReturn bool // Config extracted from template. Config ParseConfig }
type TemplateExec ¶
type TemplateHandler ¶
type TemplateHandler struct { Main *TemplateNamespace Deps deps.Deps }
func (*TemplateHandler) LoadTemplates ¶
func (t *TemplateHandler) LoadTemplates() error
func (*TemplateHandler) Lookup ¶
func (t *TemplateHandler) Lookup(name string) (template.Template, bool)
func (*TemplateHandler) LookupLayout ¶
type TemplateNamespace ¶
type TemplateNamespace struct { PrototypeText *TextTemplate PrototypeHTML *HtmlTemplate *TemplateStateMap }
type TemplateState ¶
type TemplateStateMap ¶
type TemplateStateMap struct { Templates map[string]*TemplateState // contains filtered or unexported fields }
type TextTemplate ¶
type TextTemplate struct { Name string Doc *parser.Document // contains filtered or unexported fields }
TextTemplate is the representation of a parsed template. The *parse.Tree field is exported only for use by html/template and should be treated as unexported by all other clients.
func (*TextTemplate) Funcs ¶
func (t *TextTemplate) Funcs(funcMap template.FuncMap) *TextTemplate
Funcs adds the elements of the argument map to the template's function map. It must be called before the template is parsed. It panics if a value in the map is not a function with appropriate return type or if the name cannot be used syntactically as a function in a template. It is legal to overwrite elements of the map. The return value is the template, so calls can be chained.
func (*TextTemplate) New ¶
func (t *TextTemplate) New(name string) *TextTemplate
New allocates a new, undefined template associated with the given one and with the same delimiters. The association, which is transitive, allows one template to invoke another with a {{template}} action.
Because associated templates share underlying data, template construction cannot be done safely in parallel. Once the templates are constructed, they can be executed in parallel.
func (*TextTemplate) Parse ¶
func (t *TextTemplate) Parse(text string) (*TextTemplate, error)