summaryrefslogtreecommitdiff
path: root/docs-src/content/functions/tmpl.yml
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-04-09 16:36:58 -0400
committerDave Henderson <dhenderson@gmail.com>2022-04-10 15:27:15 -0400
commitae1620810cbd82eadd71abb51ba2fea97cf50a59 (patch)
treea907ef15a3959cf1ac7101ea1bc5becc038b6605 /docs-src/content/functions/tmpl.yml
parent6c66d16b7ccb32636688c644b670141b5e5341aa (diff)
New tmpl.Path/tmpl.PathDir functions
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src/content/functions/tmpl.yml')
-rw-r--r--docs-src/content/functions/tmpl.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/docs-src/content/functions/tmpl.yml b/docs-src/content/functions/tmpl.yml
index 3bf2f9fa..236ceb99 100644
--- a/docs-src/content/functions/tmpl.yml
+++ b/docs-src/content/functions/tmpl.yml
@@ -55,3 +55,42 @@ funcs:
'
hello world
goodbye world
+ - name: tmpl.Path
+ description: |
+ Output the path of the current template, if it came from a file. For
+ inline templates, this will be an empty string.
+
+ Note that if this function is called from a nested template, the path
+ of the main template will be returned instead.
+ pipeline: false
+ rawExamples:
+ - |
+ _`subdir/input.tpl`:_
+ ```
+ this template is in {{ tmpl.Path }}
+ ```
+
+ ```console
+ $ gomplate -f subdir/input.tpl
+ this template is in subdir/input.tpl
+ ```
+ ```
+ - name: tmpl.PathDir
+ description: |
+ Output the current template's directory. For inline templates, this will
+ be an empty string.
+
+ Note that if this function is called from a nested template, the path
+ of the main template will be used instead.
+ pipeline: false
+ rawExamples:
+ - |
+ _`subdir/input.tpl`:_
+ ```
+ this template is in {{ tmpl.Dir }}
+ ```
+
+ ```console
+ $ gomplate -f subdir/input.tpl
+ this template is in subdir
+ ```