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

package internal

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

Index

Package Files

templatefuncsRegistry.go

Variables

var TemplateFuncsNamespaceRegistry []func(d *deps.Deps) *TemplateFuncsNamespace

func AddTemplateFuncsNamespace Uses

func AddTemplateFuncsNamespace(ns func(d *deps.Deps) *TemplateFuncsNamespace)

type TemplateFuncMethodMapping Uses

type TemplateFuncMethodMapping struct {
    Method interface{}

    // Any template funcs aliases. This is mainly motivated by keeping
    // backwards compability, but some new template funcs may also make
    // sense to give short and snappy aliases.
    // Note that these aliases are global and will be merged, so the last
    // key will win.
    Aliases []string

    // A slice of input/expected examples.
    // We keep it a the namespace level for now, but may find a way to keep track
    // of the single template func, for documentation purposes.
    // Some of these, hopefully just a few, may depend on some test data to run.
    Examples [][2]string
}

type TemplateFuncsNamespace Uses

type TemplateFuncsNamespace struct {
    // The namespace name, "strings", "lang", etc.
    Name string

    // This is the method receiver.
    Context func(v ...interface{}) interface{}

    // Additional info, aliases and examples, per method name.
    MethodMappings map[string]TemplateFuncMethodMapping
}

func (*TemplateFuncsNamespace) AddMethodMapping Uses

func (t *TemplateFuncsNamespace) AddMethodMapping(m interface{}, aliases []string, examples [][2]string)

type TemplateFuncsNamespaces Uses

type TemplateFuncsNamespaces []*TemplateFuncsNamespace

func (TemplateFuncsNamespaces) MarshalJSON Uses

func (namespaces TemplateFuncsNamespaces) MarshalJSON() ([]byte, error)

Package internal imports 15 packages (graph) and is imported by 19 packages. Updated 2017-05-22. Refresh now. Tools for package owners.