hugo: github.com/spf13/hugo/tpl Index | Files | Directories

package tpl

import "github.com/spf13/hugo/tpl"

Index

Package Files

template.go

type Template Uses

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 Uses

type TemplateAdapter struct {
    Template
}

TemplateAdapter implements the TemplateExecutor interface.

func (*TemplateAdapter) ExecuteToString Uses

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

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

func (*TemplateAdapter) Tree Uses

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 Uses

type TemplateDebugger interface {
    Debug()
}

TemplateDebugger prints some debug info to stdoud.

type TemplateExecutor Uses

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

TemplateExecutor adds some extras to Template.

type TemplateFinder Uses

type TemplateFinder interface {
    Lookup(name string) *TemplateAdapter
}

TemplateFinder finds templates.

type TemplateFuncsGetter Uses

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

type TemplateHandler Uses

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 Uses

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.

Directories

PathSynopsis
cast
collections
compare
crypto
data
encoding
fmt
images
inflect
internal
lang
math
os
partials
safe
strings
time
tplimpl
transform
urls

Package tpl imports 5 packages (graph) and is imported by 81 packages. Updated 2017-05-22. Refresh now. Tools for package owners.