From c3332c857ffd3ade5f9c18f50705f46c1773cc67 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 13 Dec 2017 14:56:48 -0600 Subject: [PATCH] Clarify jinja filter documentation --- doc/topics/jinja/index.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/topics/jinja/index.rst b/doc/topics/jinja/index.rst index a5185b6a3e..3df3c69c55 100644 --- a/doc/topics/jinja/index.rst +++ b/doc/topics/jinja/index.rst @@ -883,12 +883,13 @@ Example: .. versionadded:: 2017.7.0 .. versionadded:: Oxygen - Renamed from ``json_decode_list`` to ``json_encode_list``. Encoding results - in bytes, decoding results in Unicode. This filter was incorrectly-named + Renamed from ``json_decode_list`` to ``json_encode_list``. When you encode + something you get bytes, and when you decode, you get your locale's + encoding (usually a ``unicode`` type). This filter was incorrectly-named when it was added. ``json_decode_list`` will be supported until the Neon release. -Recursively encodes all elements of list to bytes. +Recursively encodes all string elements of the list to bytes. Example: @@ -911,16 +912,18 @@ Returns: .. versionadded:: 2017.7.0 .. versionadded:: Oxygen - Renamed from ``json_decode_dict`` to ``json_encode_dict``. Encoding results - in bytes, decoding results in Unicode. This filter was incorrectly-named + Renamed from ``json_decode_dict`` to ``json_encode_dict``. When you encode + something you get bytes, and when you decode, you get your locale's + encoding (usually a ``unicode`` type). This filter was incorrectly-named when it was added. ``json_decode_dict`` will be supported until the Neon release. -Recursively encodes all items in dictionary to bytes. +Recursively encodes all string items in the dictionary to bytes. Example: -Assuming that ``pillar['foo']`` contains ``{u'a': u'\u0414'}``: +Assuming that ``pillar['foo']`` contains ``{u'a': u'\u0414'}``, and your locale +is ``en_US.UTF-8``: .. code-block:: jinja