Documentation ¶
Overview ¶
Package renderer implements data-driven templates for generating textual output
The renderer extends the standard golang text/template and sprig functions.
Templates are executed by applying them to a data structure (configuration). Values in the template refer to elements of the data structure (typically a field of a struct or a key in a map).
Actions can be combined using UNIX-like pipelines.
The input text for a template is UTF-8-encoded text in any format.
Detailed documentation on the syntax and available functions can be found here:
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithDelim ¶ added in v0.0.2
WithDelim mutates Renderer configuration with new left and right delimiters
func WithFunctions ¶ added in v0.0.2
WithFunctions mutates Renderer configuration with new template functions
func WithOptions ¶ added in v0.0.2
WithOptions mutates Renderer configuration with new template functions
func WithParameters ¶ added in v0.0.2
WithParameters mutates Renderer configuration with new template parameters
Types ¶
type Renderer ¶
type Renderer interface { Configuration() config.Config Reconfigure(configurators ...func(*config.Config)) Render(rawTemplate string) (string, error) NamedRender(templateName, rawTemplate string) (string, error) Validate() error Parse(templateName, rawTemplate string, extraFunctions template.FuncMap) (*template.Template, error) Execute(t *template.Template) (string, error) }
Renderer allows for parameterised text template rendering
func New ¶
New creates a new default renderer with the specified parameters and zero or more options
func NewWithConfig ¶ added in v0.0.3
NewWithConfig creates a new custom renderer with the specified configuration