diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2019-02-15 23:38:37 -0500 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2019-02-15 23:57:29 -0500 |
| commit | 8d9ab1cffb4d0e5b0a7c70a01ad6c142952362a0 (patch) | |
| tree | 7408c5892fad19dd0b09ce63c8481254ab22873e /docs-src | |
| parent | 4a88a3ed4c2880994975cd7ae5323c066507983a (diff) | |
New tmpl.Exec function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src')
| -rw-r--r-- | docs-src/content/functions/tmpl.yml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs-src/content/functions/tmpl.yml b/docs-src/content/functions/tmpl.yml index 962fefaf..3bf2f9fa 100644 --- a/docs-src/content/functions/tmpl.yml +++ b/docs-src/content/functions/tmpl.yml @@ -3,6 +3,26 @@ title: template functions preamble: | Functions for defining or executing templates. funcs: + - name: tmpl.Exec + description: | + Execute (render) the named template. This is equivalent to using the [`template`](https://golang.org/pkg/text/template/#hdr-Actions) action, except the result is returned as a string. + + This allows for post-processing of templates. + pipeline: true + arguments: + - name: name + required: true + description: The template's name. + - name: context + required: false + description: The context to use. + examples: + - | + $ gomplate -i '{{define "T1"}}hello, world!{{end}}{{ tmpl.Exec "T1" | strings.ToUpper }}' + HELLO, WORLD! + - | + $ gomplate -i '{{define "T1"}}hello, {{.}}{{end}}{{ tmpl.Exec "T1" "world!" | strings.Title }}' + Hello, World! - name: tmpl.Inline alias: tpl description: | |
