summaryrefslogtreecommitdiff
path: root/docs-src/content
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2018-11-10 11:16:28 -0500
committerDave Henderson <dhenderson@gmail.com>2018-11-10 20:56:24 -0500
commitb8797404d01fc222cf22535ff57ab925aed4d88d (patch)
treec8c6c40f0d803b0e7b852c43340e55b57a15b717 /docs-src/content
parent40b95a7537904926783bea001c0d45fd3c30a798 (diff)
New tpl function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src/content')
-rw-r--r--docs-src/content/functions/other.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs-src/content/functions/other.yml b/docs-src/content/functions/other.yml
new file mode 100644
index 00000000..d26e9243
--- /dev/null
+++ b/docs-src/content/functions/other.yml
@@ -0,0 +1,36 @@
+ns: _
+title: Other functions
+preamble: |
+ Miscellaneous functions that aren't part of a specific namespace. Most of these are fairly special-purpose.
+funcs:
+ - name: tpl
+ description: |
+ Render the given string as a template, just like a nested template.
+
+ If the template is given a name (see `name` argument below), it can be re-used later with the `template` keyword.
+
+ A context can be provided, otherwise the default gomplate context will be used.
+ pipeline: false
+ arguments:
+ - name: name
+ required: false
+ description: The template's name.
+ - name: in
+ required: true
+ description: The template to render, as a string
+ - name: context
+ required: false
+ description: The context to use when rendering - this becomes `.` inside the template.
+ examples:
+ - |
+ $ gomplate -i '{{ tpl "{{print `hello world`}}" }}'
+ hello world
+ - |
+ $ gomplate -i '
+ {{ $tstring := "{{ print .value ` world` }}" }}
+ {{ $context := dict "value" "hello" }}
+ {{ tpl "T1" $tstring $context }}
+ {{ template "T1" (dict "value" "goodbye") }}
+ '
+ hello world
+ goodbye world