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:
Cedric Pimenta 2018-01-09 00:07:32 +01:00 committed by scottb
parent 80fb81414b
commit cd1b144c0a

View file

@ -450,7 +450,7 @@ The ``parse_xml`` filter will load the spec file and pass the command output
through formatted as JSON.
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
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.
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``
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::
{{ 'secretpassword'|password_hash('sha256', 'mysecretsalt') }}
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) }}
@ -666,6 +666,17 @@ Similar way can be applied style for C (``//...``), C block
{{ "Erlang style" | comment('erlang') }}
{{ "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::
{{ "Custom style" | comment('plain', prefix='#######\n#', postfix='#\n#######\n ###\n #') }}