Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TemplateContext ¶
type TemplateContext struct { Data interface{} Functions map[string]TemplateFunc // contains filtered or unexported fields }
TemplateContext contains data and functions to be passed to templates
func NewTemplateContext ¶
func NewTemplateContext(opts ...TemplateContextOptions) *TemplateContext
NewTemplateContext creates a new TemplateContext with default functions
func (*TemplateContext) InstantiateTemplate ¶
InstantiateTemplate reads a template from the reader, executes it with the context, and writes the result to the writer
type TemplateContextOptions ¶
type TemplateContextOptions func(*TemplateContext)
func WithBaseDir ¶
func WithBaseDir(basedir string) TemplateContextOptions
func WithData ¶
func WithData(data interface{}) TemplateContextOptions
func WithFunction ¶
func WithFunction(name string, fn TemplateFunc) TemplateContextOptions
type TemplateFunc ¶
type TemplateFunc any
TemplateFunc represents a function that can be used in templates
Click to show internal directories.
Click to hide internal directories.