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

package tpl

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

Index

Package Files

template.go template_info.go

Constants

const TemplateVersion = 2

Increments on breaking changes.

Variables

var DefaultParseConfig = ParseConfig{
    Version: TemplateVersion,
}
var DefaultParseInfo = ParseInfo{
    Config: DefaultParseConfig,
}

type Info Uses

type Info interface {
    ParseInfo() ParseInfo

    // Identifies this template and its dependencies.
    identity.Provider
}

func NewInfo Uses

func NewInfo(id identity.Manager, parseInfo ParseInfo) Info

type Info1 Uses

type Info1 struct {
}

Info holds some info extracted from a parsed template.

type InfoManager Uses

type InfoManager interface {
    ParseInfo() ParseInfo

    // Identifies and manages this template and its dependencies.
    identity.Manager
}

type ParseConfig Uses

type ParseConfig struct {
    Version int
}

type ParseInfo Uses

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
}

func (ParseInfo) IsZero Uses

func (info ParseInfo) IsZero() bool

type Template Uses

type Template interface {
    Name() string
    Prepare() (*texttemplate.Template, error)
}

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

func WithInfo Uses

func WithInfo(templ Template, info Info) Template

WithInfo wraps the info in a template.

type TemplateDebugger Uses

type TemplateDebugger interface {
    Debug()
}

TemplateDebugger prints some debug info to stdoud.

type TemplateFinder Uses

type TemplateFinder interface {
    TemplateLookup
    TemplateLookupVariant
}

TemplateFinder finds templates.

type TemplateFuncGetter Uses

type TemplateFuncGetter interface {
    GetFunc(name string) (reflect.Value, bool)
}

TemplateFuncGetter allows to find a template func by name.

type TemplateHandler Uses

type TemplateHandler interface {
    TemplateFinder
    Execute(t Template, wr io.Writer, data interface{}) error
    LookupLayout(d output.LayoutDescriptor, f output.Format) (Template, bool, error)
    HasTemplate(name string) bool
}

TemplateHandler finds and executes templates.

type TemplateLookup Uses

type TemplateLookup interface {
    Lookup(name string) (Template, bool)
}

type TemplateLookupVariant Uses

type TemplateLookupVariant interface {
    // TODO(bep) this currently only works for shortcodes.
    // We may unify and expand this variant pattern to the
    // other templates, but we need this now for the shortcodes to
    // quickly determine if a shortcode has a template for a given
    // output format.
    // It returns the template, if it was found or not and if there are
    // alternative representations (output format, language).
    // We are currently only interested in output formats, so we should improve
    // this for speed.
    LookupVariant(name string, variants TemplateVariants) (Template, bool, bool)
}

type TemplateManager Uses

type TemplateManager interface {
    TemplateHandler
    TemplateFuncGetter
    AddTemplate(name, tpl string) error
    MarkReady() error
}

TemplateManager manages the collection of templates.

type TemplateParseFinder Uses

type TemplateParseFinder interface {
    TemplateParser
    TemplateFinder
}

TemplateParseFinder provides both parsing and finding.

type TemplateParser Uses

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

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

type TemplateVariants Uses

type TemplateVariants struct {
    Language     string
    OutputFormat output.Format
}

TemplateVariants describes the possible variants of a template. All of these may be empty.

type TemplatesProvider Uses

type TemplatesProvider interface {
    Tmpl() TemplateHandler
    TextTmpl() TemplateParseFinder
}

TemplatesProvider as implemented by deps.Deps.

Directories

PathSynopsis
castPackage cast provides template functions for data type conversions.
collectionsPackage collections provides template functions for manipulating collections such as arrays, maps, and slices.
comparePackage compare provides template functions for comparing values.
cryptoPackage crypto provides template functions for cryptographic operations.
dataPackage data provides template functions for working with external data sources.
encodingPackage encoding provides template functions for encoding content.
fmtPackage fmt provides template functions for formatting strings.
hugoPackage hugo provides template functions for accessing the Site Hugo object.
imagesPackage images provides template functions for manipulating images.
inflectPackage inflect provides template functions for the inflection of words.
internal
internal/go_templates/fmtsortPackage fmtsort provides a general stable ordering mechanism for maps, on behalf of the fmt and text/template packages.
internal/go_templates/htmltemplatePackage template (html/template) implements data-driven templates for generating HTML output safe against code injection.
internal/go_templates/texttemplatePackage template implements data-driven templates for generating textual output.
internal/go_templates/texttemplate/parsePackage parse builds parse trees for templates as defined by text/template and html/template.
langPackage lang provides template functions for content internationalization.
mathPackage math provides template functions for mathmatical operations.
osPackage os provides template functions for interacting with the operating system.
partialsPackage partials provides template functions for working with reusable templates.
pathPackage path provides template functions for manipulating paths.
reflectPackage reflect provides template functions for run-time object reflection.
resourcesPackage resources provides template functions for working with resources.
safePackage safe provides template functions for escaping untrusted content or encapsulating trusted content.
sitePackage site provides template functions for accessing the Site object.
stringsPackage strings provides template functions for manipulating strings.
templatesPackage templates provides template functions for working with templates.
timePackage time provides template functions for measuring and displaying time.
tplimpl
tplimpl/embeddedPackage embedded defines the internal templates that Hugo provides.
tplimpl/embedded/generate
transformPackage transform provides template functions for transforming content.
urlsPackage urls provides template functions to deal with URLs.

Package tpl imports 6 packages (graph) and is imported by 268 packages. Updated 2020-03-21. Refresh now. Tools for package owners.