From 43896e21b9b325d43e5b06610d7c2e291777cea9 Mon Sep 17 00:00:00 2001 From: Herbert Buurman Date: Wed, 10 Apr 2019 10:18:13 +0200 Subject: [PATCH] Add documentation for the newly introduced Jinja filters. --- doc/topics/jinja/index.rst | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/doc/topics/jinja/index.rst b/doc/topics/jinja/index.rst index cd197acd1f75..bd4a1e79c4a9 100644 --- a/doc/topics/jinja/index.rst +++ b/doc/topics/jinja/index.rst @@ -1309,6 +1309,49 @@ Returns: .. _`JMESPath language`: http://jmespath.org/ .. _`jmespath`: https://github.com/jmespath/jmespath.py + +.. jinja_ref:: to_snake_case + +``to_snake_case`` +----------------- + +.. versionadded:: Neon + +Converts a string from camelCase (or CamelCase) to snake_case. + +.. code-block:: jinja + + Example: {{ camelsWillLoveThis | to_snake_case }} + +Returns: + +.. code-block:: text + + Example: camels_will_love_this + + +.. jinja_ref:: to_camelcase + +``to_camelcase`` +---------------- + +.. versionadded:: Neon + +Converts a string from snake_case to camelCase (or UpperCamelCase if so indicated). + +.. code-block:: jinja + + Example 1: {{ snake_case_for_the_win | to_camelcase }} + + Example 2: {{ snake_case_for_the_win | to_camelcase(uppercamel=True) }} + +Returns: + +.. code-block:: text + + Example 1: snakeCaseForTheWin + Example 2: SnakeCaseForTheWin + Networking Filters ------------------