Version: v0.47.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 7 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Template

type Template interface {
	Execute(wr io.Writer, data interface{}) error
	Name() string

Template is the common interface between text/template and html/template.

type TemplateAdapter added in v0.20.1

type TemplateAdapter struct {
	Metrics metrics.Provider

TemplateAdapter implements the TemplateExecutor interface.

func (*TemplateAdapter) Execute added in v0.27.1

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 added in v0.20.1

func (t *TemplateAdapter) ExecuteToString(data interface{}) (string, error)

ExecuteToString executes the current template and returns the result as a string.

func (*TemplateAdapter) Tree added in v0.20.1

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 added in v0.22.1

type TemplateDebugger interface {

TemplateDebugger prints some debug info to stdoud.

type TemplateExecutor added in v0.20.1

type TemplateExecutor interface {
	ExecuteToString(data interface{}) (string, error)
	Tree() string

TemplateExecutor adds some extras to Template.

type TemplateFinder added in v0.20.1

type TemplateFinder interface {
	Lookup(name string) (Template, bool)

TemplateFinder finds templates.

type TemplateFuncsGetter added in v0.22.1

type TemplateFuncsGetter interface {
	GetFuncs() map[string]interface{}

TemplateFuncsGetter allows to get a map of functions.

type TemplateHandler added in v0.20.1

type TemplateHandler interface {
	AddTemplate(name, tpl string) error
	AddLateTemplate(name, tpl string) error
	LoadTemplates(prefix string)

	NewTextTemplate() TemplateParseFinder


TemplateHandler manages the collection of templates.

type TemplateParseFinder added in v0.45.1

type TemplateParseFinder interface {

TemplateParseFinder provides both parsing and finding.

type TemplateParser added in v0.45.1

type TemplateParser interface {
	Parse(name, tpl string) (Template, error)

TemplateParser is used to parse ad-hoc templates, e.g. in the Resource chain.

type TemplateTestMocker added in v0.20.1

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


Path Synopsis
Package embedded defines the internal templates that Hugo provides.
Package embedded defines the internal templates that Hugo provides.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL