Documentation ¶
Overview ¶
Package interpolate provides a generic mechanism to interpolate variables into strings.
Variables are specified in the form "${foo}". Values for the different variables are supplied by a VariableResolver function provided at render-time. Variable names can also be in the form "${foo:bar}" where everything after the ":" is the default value for that variable if the VariableResolver did not have a value for that variable.
Example ¶
Output: My name is Inigo Montoya
Example (Default) ¶
Output: My name is what
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type String ¶
type String []term
String is a string that supports interpolation given some source of variable values.
A String can be obtained by calling Parse on a string.
func Parse ¶
Parse parses a string for interpolation.
Variables may be specified anywhere in the string in the format ${foo} or ${foo:default} where 'default' will be used if the variable foo was unset.
type VariableResolver ¶
VariableResolver resolves the value of a variable specified in the string.
The boolean value indicates whether this variable had a value defined. If a variable does not have a value and no default is specified, rendering will fail.