tpl

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 {
	Template
}

TemplateAdapter implements the TemplateExecutor interface.

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 {
	Debug()
}

TemplateDebugger prints some debug info to stdoud.

type TemplateExecutor added in v0.20.1

type TemplateExecutor interface {
	Template
	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) *TemplateAdapter
}

TemplateFinder finds templates.

type TemplateFuncsGetter added in v0.22.1

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

type TemplateHandler added in v0.20.1

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

	MarkReady()
	RebuildClone()
}

TemplateHandler manages the collection of templates.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL