Put all files and Path filters under a specific section (#64913)
Many of the filters in the "other useful filters" list manipulate filenames and paths; add a heading and put them together.
This commit is contained in:
parent
ba273c72d8
commit
e65be0beee
1 changed files with 21 additions and 18 deletions
|
@ -1195,24 +1195,8 @@ This can then be used to reference hashes in Pod specifications::
|
|||
|
||||
.. versionadded:: 2.8
|
||||
|
||||
Other Useful Filters
|
||||
````````````````````
|
||||
|
||||
To add quotes for shell usage::
|
||||
|
||||
- shell: echo {{ string_value | quote }}
|
||||
|
||||
To use one value on true and another on false (new in version 1.9)::
|
||||
|
||||
{{ (name == "John") | ternary('Mr','Ms') }}
|
||||
|
||||
To use one value on true, one value on false and a third value on null (new in version 2.8)::
|
||||
|
||||
{{ enabled | ternary('no shutdown', 'shutdown', omit) }}
|
||||
|
||||
To concatenate a list into a string::
|
||||
|
||||
{{ list | join(" ") }}
|
||||
File and Path manipulations
|
||||
```````````````````````````
|
||||
|
||||
To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'::
|
||||
|
||||
|
@ -1267,6 +1251,25 @@ 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 }}
|
||||
|
||||
Other Useful Filters
|
||||
````````````````````
|
||||
|
||||
To add quotes for shell usage::
|
||||
|
||||
- shell: echo {{ string_value | quote }}
|
||||
|
||||
To use one value on true and another on false (new in version 1.9)::
|
||||
|
||||
{{ (name == "John") | ternary('Mr','Ms') }}
|
||||
|
||||
To use one value on true, one value on false and a third value on null (new in version 2.8)::
|
||||
|
||||
{{ enabled | ternary('no shutdown', 'shutdown', omit) }}
|
||||
|
||||
To concatenate a list into a string::
|
||||
|
||||
{{ list | join(" ") }}
|
||||
|
||||
To work with Base64 encoded strings::
|
||||
|
||||
{{ encoded | b64decode }}
|
||||
|
|
Loading…
Reference in a new issue