Documentation ¶
Overview ¶
Package template defines a generic interface for template parsers and implementations of that interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdentityParser ¶
type IdentityParser struct{}
IdentityParser is an Parser that does no parsing and returns template string unchanged.
func (IdentityParser) Cacheable ¶
func (IdentityParser) Cacheable() bool
func (IdentityParser) Parse ¶
func (IdentityParser) Parse(src, leftDelim, rightDelim string) (ParsedTemplate, error)
type ParsedTemplate ¶
type ParsedTemplate interface { // Execute applies a parsed template to the specified data. Execute(data any) (string, error) }
ParsedTemplate is an executable template.
type Parser ¶
type Parser interface { // Parse parses src and returns a ParsedTemplate. Parse(src, leftDelim, rightDelim string) (ParsedTemplate, error) // Cacheable returns true if Parse returns ParsedTemplates that are always safe to cache. Cacheable() bool }
Parser parses strings into executable templates.
type TextParser ¶
TextParser is a Parser that uses text/template.
func (*TextParser) Cacheable ¶
func (te *TextParser) Cacheable() bool
func (*TextParser) Parse ¶
func (te *TextParser) Parse(src, leftDelim, rightDelim string) (ParsedTemplate, error)
Click to show internal directories.
Click to hide internal directories.