package tpl
import "github.com/gohugoio/hugo/tpl"
Index ¶
- type Template
- type TemplateAdapter
- func (t *TemplateAdapter) Execute(w io.Writer, data interface{}) error
- func (t *TemplateAdapter) ExecuteToString(data interface{}) (string, error)
- func (t *TemplateAdapter) Tree() string
- type TemplateDebugger
- type TemplateExecutor
- type TemplateFinder
- type TemplateFuncsGetter
- type TemplateHandler
- type TemplateParseFinder
- type TemplateParser
- type TemplateTestMocker
Types ¶
type Template ¶
Template is the common interface between text/template and html/template.
type TemplateAdapter ¶
TemplateAdapter implements the TemplateExecutor interface.
func (*TemplateAdapter) Execute ¶
func (t *TemplateAdapter) Execute(w io.Writer, data interface{}) error
Execute executes the current template. The actual execution is performed by the embedded text or html template, but we add an implementation here so we can add a timer for some metrics.
func (*TemplateAdapter) ExecuteToString ¶
func (t *TemplateAdapter) ExecuteToString(data interface{}) (string, error)
ExecuteToString executes the current template and returns the result as a string.
func (*TemplateAdapter) Tree ¶
func (t *TemplateAdapter) Tree() string
Tree returns the template Parse tree as a string. Note: this isn't safe for parallel execution on the same template vs Lookup and Execute.
type TemplateDebugger ¶
type TemplateDebugger interface {
Debug()
}
TemplateDebugger prints some debug info to stdoud.
type TemplateExecutor ¶
type TemplateExecutor interface { Template ExecuteToString(data interface{}) (string, error) Tree() string }
TemplateExecutor adds some extras to Template.
type TemplateFinder ¶
TemplateFinder finds templates.
type TemplateFuncsGetter ¶
type TemplateFuncsGetter interface { GetFuncs() map[string]interface{} }
TemplateFuncsGetter allows to get a map of functions.
type TemplateHandler ¶
type TemplateHandler interface { TemplateFinder AddTemplate(name, tpl string) error AddLateTemplate(name, tpl string) error LoadTemplates(prefix string) PrintErrors() NewTextTemplate() TemplateParseFinder MarkReady() RebuildClone() }
TemplateHandler manages the collection of templates.
type TemplateParseFinder ¶
type TemplateParseFinder interface { TemplateParser TemplateFinder }
TemplateParseFinder provides both parsing and finding.
type TemplateParser ¶
TemplateParser is used to parse ad-hoc templates, e.g. in the Resource chain.
type TemplateTestMocker ¶
type TemplateTestMocker interface { SetFuncs(funcMap map[string]interface{}) }
TemplateTestMocker adds a way to override some template funcs during tests. The interface is named so it's not used in regular application code.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
tpl/cast | |
tpl/collections | |
tpl/compare | |
tpl/crypto | |
tpl/data | |
tpl/encoding | |
tpl/fmt | |
tpl/images | |
tpl/inflect | |
tpl/internal | |
tpl/lang | |
tpl/math | |
tpl/os | |
tpl/partials | |
tpl/path | |
tpl/resources | |
tpl/safe | |
tpl/strings | |
tpl/templates | |
tpl/time | |
tpl/tplimpl | |
tpl/tplimpl/embedded | Package embedded defines the internal templates that Hugo provides. |
tpl/tplimpl/embedded/generate | |
tpl/transform | |
tpl/urls |
- Version
- v0.47.1
- Published
- Aug 20, 2018
- Platform
- js/wasm
- Imports
- 7 packages
- Last checked
- 6 minutes ago –
Tools for package owners.