From 8d9ab1cffb4d0e5b0a7c70a01ad6c142952362a0 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Fri, 15 Feb 2019 23:38:37 -0500 Subject: New tmpl.Exec function Signed-off-by: Dave Henderson --- docs-src/content/functions/tmpl.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'docs-src') 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: | -- cgit v1.2.3