Merge pull request #11432 from sivel/splitext-filter
Add splitext filter
This commit is contained in:
commit
71f72b655e
2 changed files with 6 additions and 0 deletions
|
@ -350,6 +350,11 @@ To get the relative path of a link, from a start point (new in version 1.7)::
|
||||||
|
|
||||||
{{ path | relpath('/etc') }}
|
{{ path | relpath('/etc') }}
|
||||||
|
|
||||||
|
To get the root and extension of a path or filename (new in version 2.0)::
|
||||||
|
|
||||||
|
# with path == 'nginx.conf' the return would be ('nginx', '.conf')
|
||||||
|
{{ path | splitext }}
|
||||||
|
|
||||||
To work with Base64 encoded strings::
|
To work with Base64 encoded strings::
|
||||||
|
|
||||||
{{ encoded | b64decode }}
|
{{ encoded | b64decode }}
|
||||||
|
|
|
@ -316,6 +316,7 @@ class FilterModule(object):
|
||||||
'expanduser': partial(unicode_wrap, os.path.expanduser),
|
'expanduser': partial(unicode_wrap, os.path.expanduser),
|
||||||
'realpath': partial(unicode_wrap, os.path.realpath),
|
'realpath': partial(unicode_wrap, os.path.realpath),
|
||||||
'relpath': partial(unicode_wrap, os.path.relpath),
|
'relpath': partial(unicode_wrap, os.path.relpath),
|
||||||
|
'splitext': partial(unicode_wrap, os.path.splitext),
|
||||||
|
|
||||||
# failure testing
|
# failure testing
|
||||||
'failed' : failed,
|
'failed' : failed,
|
||||||
|
|
Loading…
Reference in a new issue