Add expandvars jinja2 filter (#38805)

* Add expandvars jinja2 filter

* Add docs

* Minor edit
pull/38944/head
Martin Krizek 6 years ago committed by GitHub
parent 1cc2aeb40a
commit 8173602a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -895,6 +895,14 @@ To expand a path containing a tilde (`~`) character (new in version 1.5)::
{{ path | expanduser }}
To expand a path containing environment variables::
{{ path | expandvars }}
.. note:: `expandvars` expands local variables; using it on remote paths can lead to errors.
.. versionadded:: 2.6
To get the real path of a link (new in version 1.8)::
{{ path | realpath }}

@ -530,6 +530,7 @@ class FilterModule(object):
'basename': partial(unicode_wrap, os.path.basename),
'dirname': partial(unicode_wrap, os.path.dirname),
'expanduser': partial(unicode_wrap, os.path.expanduser),
'expandvars': partial(unicode_wrap, os.path.expandvars),
'realpath': partial(unicode_wrap, os.path.realpath),
'relpath': partial(unicode_wrap, os.path.relpath),
'splitext': partial(unicode_wrap, os.path.splitext),

Loading…
Cancel
Save