From 216457386451b25e0500ef01a5065ad83231ccc8 Mon Sep 17 00:00:00 2001 From: Maykel Moya Date: Mon, 17 Feb 2014 11:46:05 +0100 Subject: [PATCH 1/5] Filter name is singular --- docsite/rst/playbooks_variables.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst index bca0d0f1b1b..cfa53f2cdac 100644 --- a/docsite/rst/playbooks_variables.rst +++ b/docsite/rst/playbooks_variables.rst @@ -172,7 +172,7 @@ The variable value will be used as is, but the template evaluation will raise an Defaulting Undefined Variables ------------------------------ -Jinja2 provides a useful 'defaults' filter, that is often a better approach to failing if a variable is not defined. +Jinja2 provides a useful 'default' filter, that is often a better approach to failing if a variable is not defined. {{ some_variable | default(5) }} From 95761ea920aa0becb97bbe256676f5751a400b78 Mon Sep 17 00:00:00 2001 From: Maykel Moya Date: Mon, 17 Feb 2014 11:51:37 +0100 Subject: [PATCH 2/5] Uniform spacing across all filter examples --- docsite/rst/playbooks_variables.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst index cfa53f2cdac..608b214bbe3 100644 --- a/docsite/rst/playbooks_variables.rst +++ b/docsite/rst/playbooks_variables.rst @@ -189,7 +189,7 @@ All these functions return a unique set from sets or lists. To get a unique set from a list:: - {{ list1 |unique }} + {{ list1 | unique }} To get a union of two lists:: @@ -197,15 +197,15 @@ To get a union of two lists:: To get the intersection of 2 lists (unique list of all items in both):: - {{ list1 |intersect(list2)}} + {{ list1 | intersect(list2) }} To get the difference of 2 lists (items in 1 that don't exist in 2):: - {{ list1 |difference(list2)}} + {{ list1 | difference(list2) }} To get the symmetric difference of 2 lists (items exclusive to each list):: - {{ list1 |symmetric_difference(list2)}} + {{ list1 | symmetric_difference(list2) }} .. _other_useful_filters: From 5ba0e7477e8177fbfd6e755f6736d243481c7384 Mon Sep 17 00:00:00 2001 From: Maykel Moya Date: Mon, 17 Feb 2014 12:00:41 +0100 Subject: [PATCH 3/5] Fix path to index.html when launching browser --- docsite/build-site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docsite/build-site.py b/docsite/build-site.py index 05ed4aa135b..70755b8a282 100755 --- a/docsite/build-site.py +++ b/docsite/build-site.py @@ -99,5 +99,5 @@ if __name__ == '__main__': if "view" in sys.argv: import webbrowser - if not webbrowser.open('index.html'): + if not webbrowser.open('htmlout/index.html'): print >> sys.stderr, "Could not open on your webbrowser." From cb8f4b806270ad1cf4b168ca0c045bb4220e0dac Mon Sep 17 00:00:00 2001 From: Maykel Moya Date: Mon, 17 Feb 2014 12:05:53 +0100 Subject: [PATCH 4/5] Add link to ansible-examples repo --- docsite/rst/playbooks_variables.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst index 608b214bbe3..82262538fd5 100644 --- a/docsite/rst/playbooks_variables.rst +++ b/docsite/rst/playbooks_variables.rst @@ -925,9 +925,11 @@ So, that's precedence, explained in a more direct way. Don't worry about preced variable that is a default, or a "live" variable you definitely want to use. Inventory lies in precedence right in the middle, and if you want to forcibly override something, use -e. -If you found that a little hard to understand, take a look at the "ansible-examples" repo on our github for a bit more about +If you found that a little hard to understand, take a look at the `ansible-examples`_ repo on our github for a bit more about how all of these things can work together. +.. _ansible-examples: https://github.com/ansible/ansible-examples + .. seealso:: :doc:`playbooks` From a281643505602b25b8e9c95005b4d8bbfde0c1af Mon Sep 17 00:00:00 2001 From: Maykel Moya Date: Mon, 17 Feb 2014 12:15:42 +0100 Subject: [PATCH 5/5] Add link (with minor rewording) to jinja2 builtin filters --- docsite/rst/playbooks_variables.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docsite/rst/playbooks_variables.rst b/docsite/rst/playbooks_variables.rst index 82262538fd5..7bbac66cb39 100644 --- a/docsite/rst/playbooks_variables.rst +++ b/docsite/rst/playbooks_variables.rst @@ -113,9 +113,9 @@ Jinja2 Filters .. note:: These are infrequently utilized features. Use them if they fit a use case you have, but this is optional knowledge. Filters in Jinja2 are a way of transforming template expressions from one kind of data into another. Jinja2 -ships with many of these as documented on the official Jinja2 template documentation. +ships with many of these. See `builtin filters`_ in the official Jinja2 template documentation. -In addition to these, Ansible supplies many more. +In addition to those, Ansible supplies many more. .. _filters_for_formatting_data: @@ -929,6 +929,7 @@ If you found that a little hard to understand, take a look at the `ansible-examp how all of these things can work together. .. _ansible-examples: https://github.com/ansible/ansible-examples +.. _builtin filters: http://jinja.pocoo.org/docs/templates/#builtin-filters .. seealso::