mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Improve documentation about Comment filter (#34539)
Include a mention to the decoration option, which allows someone to specify the character comment to be used.
This commit is contained in:
parent
80fb81414b
commit
cd1b144c0a
1 changed files with 14 additions and 3 deletions
|
@ -450,7 +450,7 @@ The ``parse_xml`` filter will load the spec file and pass the command output
|
||||||
through formatted as JSON.
|
through formatted as JSON.
|
||||||
|
|
||||||
The spec file should be valid formatted YAML. It defines how to parse the XML
|
The spec file should be valid formatted YAML. It defines how to parse the XML
|
||||||
output and return JSON data.
|
output and return JSON data.
|
||||||
|
|
||||||
Below is an example of a valid spec file that
|
Below is an example of a valid spec file that
|
||||||
will parse the output from the ``show vlan | display xml`` command.::
|
will parse the output from the ``show vlan | display xml`` command.::
|
||||||
|
@ -505,7 +505,7 @@ value using the same ``show vlan | display xml`` command.::
|
||||||
|
|
||||||
The value of ``top`` is the XPath relative to the XML root node.
|
The value of ``top`` is the XPath relative to the XML root node.
|
||||||
In the example XML output given below, the value of ``top`` is ``configuration/vlans/vlan``,
|
In the example XML output given below, the value of ``top`` is ``configuration/vlans/vlan``,
|
||||||
which is an XPath expression relative to the root node (<rpc-reply>).
|
which is an XPath expression relative to the root node (<rpc-reply>).
|
||||||
``configuration`` in the value of ``top`` is the outer most container node, and ``vlan``
|
``configuration`` in the value of ``top`` is the outer most container node, and ``vlan``
|
||||||
is the inner-most container node.
|
is the inner-most container node.
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ To get a sha512 password hash (random salt)::
|
||||||
To get a sha256 password hash with a specific salt::
|
To get a sha256 password hash with a specific salt::
|
||||||
|
|
||||||
{{ 'secretpassword'|password_hash('sha256', 'mysecretsalt') }}
|
{{ 'secretpassword'|password_hash('sha256', 'mysecretsalt') }}
|
||||||
|
|
||||||
An idempotent method to generate unique hashes per system is to use a salt that is consistent between runs::
|
An idempotent method to generate unique hashes per system is to use a salt that is consistent between runs::
|
||||||
|
|
||||||
{{ 'secretpassword'|password_hash('sha512', 65534|random(seed=inventory_hostname)|string) }}
|
{{ 'secretpassword'|password_hash('sha512', 65534|random(seed=inventory_hostname)|string) }}
|
||||||
|
@ -666,6 +666,17 @@ Similar way can be applied style for C (``//...``), C block
|
||||||
{{ "Erlang style" | comment('erlang') }}
|
{{ "Erlang style" | comment('erlang') }}
|
||||||
{{ "XML style" | comment('xml') }}
|
{{ "XML style" | comment('xml') }}
|
||||||
|
|
||||||
|
If you need a specific comment character that is not included by any of the
|
||||||
|
above, you can customize it with::
|
||||||
|
|
||||||
|
{{ "My Special Case" | comment(decoration="! ") }}
|
||||||
|
|
||||||
|
producing::
|
||||||
|
|
||||||
|
!
|
||||||
|
! My Special Case
|
||||||
|
!
|
||||||
|
|
||||||
It is also possible to fully customize the comment style::
|
It is also possible to fully customize the comment style::
|
||||||
|
|
||||||
{{ "Custom style" | comment('plain', prefix='#######\n#', postfix='#\n#######\n ###\n #') }}
|
{{ "Custom style" | comment('plain', prefix='#######\n#', postfix='#\n#######\n ###\n #') }}
|
||||||
|
|
Loading…
Reference in a new issue