Documentation
¶
Index ¶
- Constants
- type ChainLoader
- func (l *ChainLoader) Add(loader Loader) *ChainLoader
- func (l *ChainLoader) Exists(ctx context.Context, name string) (bool, error)
- func (l *ChainLoader) Get(ctx context.Context, name string) (*Source, error)
- func (l *ChainLoader) IsFresh(ctx context.Context, name string, t int64) (bool, error)
- func (l *ChainLoader) Loaders() (loaders []Loader)
- type Environment
- func (e *Environment) Debug(debug bool) *Environment
- func (e *Environment) Delims(left, right string) *Environment
- func (e *Environment) Funcs(funcMap template.FuncMap) *Environment
- func (e *Environment) Global(global ...string) *Environment
- func (e *Environment) Load(ctx context.Context, name string) (*TemplateWrapper, error)
- func (e *Environment) NewHTMLTemplate(name string) *template.Template
- func (e *Environment) NewTemplateWrapper(name string) *TemplateWrapper
- type FileSystemLoader
- func (l *FileSystemLoader) Append(namespace, p string) error
- func (l *FileSystemLoader) BaseAppend(path string) error
- func (l *FileSystemLoader) BasePrepend(path string) error
- func (l *FileSystemLoader) Exists(_ context.Context, name string) (bool, error)
- func (l *FileSystemLoader) Get(_ context.Context, name string) (*Source, error)
- func (l *FileSystemLoader) IsFresh(_ context.Context, name string, t int64) (bool, error)
- func (l *FileSystemLoader) Namespaces() (namespaces []string)
- func (l *FileSystemLoader) Paths(namespace string) (paths []string)
- func (l *FileSystemLoader) Prepend(namespace, p string) (err error)
- func (l *FileSystemLoader) SetPaths(namespace string, paths ...string) error
- type Handler
- type Loader
- type MemoryLoader
- func (l *MemoryLoader) Add(name string, code []byte) *MemoryLoader
- func (l *MemoryLoader) Exists(_ context.Context, name string) (bool, error)
- func (l *MemoryLoader) Get(_ context.Context, name string) (*Source, error)
- func (l *MemoryLoader) IsFresh(ctx context.Context, name string, _ int64) (bool, error)
- type Node
- type Source
- type TemplateWrapper
Constants ¶
View Source
const ( ErrNotDefinedFormat = "template \"%s\" is not defined" ErrDirNotExistsFormat = "the \"%s\" directory does not exist" )
View Source
const BaseNamespace = "base"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainLoader ¶
type ChainLoader struct {
// contains filtered or unexported fields
}
func NewChainLoader ¶
func NewChainLoader(loaders ...Loader) *ChainLoader
func (*ChainLoader) Add ¶
func (l *ChainLoader) Add(loader Loader) *ChainLoader
func (*ChainLoader) Loaders ¶
func (l *ChainLoader) Loaders() (loaders []Loader)
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnvironment ¶
func NewEnvironment(loader Loader, handlers ...Handler) *Environment
func (*Environment) Debug ¶
func (e *Environment) Debug(debug bool) *Environment
func (*Environment) Delims ¶
func (e *Environment) Delims(left, right string) *Environment
func (*Environment) Funcs ¶
func (e *Environment) Funcs(funcMap template.FuncMap) *Environment
func (*Environment) Global ¶
func (e *Environment) Global(global ...string) *Environment
func (*Environment) Load ¶
func (e *Environment) Load(ctx context.Context, name string) (*TemplateWrapper, error)
func (*Environment) NewHTMLTemplate ¶
func (e *Environment) NewHTMLTemplate(name string) *template.Template
func (*Environment) NewTemplateWrapper ¶
func (e *Environment) NewTemplateWrapper(name string) *TemplateWrapper
type FileSystemLoader ¶
type FileSystemLoader struct {
// contains filtered or unexported fields
}
func NewFSLoaderWithNS ¶
func NewFSLoaderWithNS(fsys fs.FS) (*FileSystemLoader, error)
func NewFileSystemLoader ¶
func NewFileSystemLoader(fsys fs.FS) *FileSystemLoader
func (*FileSystemLoader) Append ¶
func (l *FileSystemLoader) Append(namespace, p string) error
func (*FileSystemLoader) BaseAppend ¶
func (l *FileSystemLoader) BaseAppend(path string) error
func (*FileSystemLoader) BasePrepend ¶
func (l *FileSystemLoader) BasePrepend(path string) error
func (*FileSystemLoader) Namespaces ¶
func (l *FileSystemLoader) Namespaces() (namespaces []string)
func (*FileSystemLoader) Paths ¶
func (l *FileSystemLoader) Paths(namespace string) (paths []string)
func (*FileSystemLoader) Prepend ¶
func (l *FileSystemLoader) Prepend(namespace, p string) (err error)
type Loader ¶
type Loader interface { // Get returns a Source for a given template name Get(ctx context.Context, name string) (*Source, error) // IsFresh check if template is fresh IsFresh(ctx context.Context, name string, t int64) (bool, error) // Exists check if template exists Exists(ctx context.Context, name string) (bool, error) }
type MemoryLoader ¶
type MemoryLoader struct {
// contains filtered or unexported fields
}
func NewMemoryLoader ¶
func NewMemoryLoader(templates map[string][]byte) *MemoryLoader
func (*MemoryLoader) Add ¶
func (l *MemoryLoader) Add(name string, code []byte) *MemoryLoader
type Node ¶
type Node struct { Source *Source Extends *Node Successor *Node Includes []*Node // contains filtered or unexported fields }
func (*Node) SelfParent ¶
type TemplateWrapper ¶
func NewTemplateWrapper ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.