[09/22] AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c3ea59f/ambari-common/src/main/python/jinja2/docs/templates.rst -- diff --git a/ambari-common/src/main/python/jinja2/docs/templates.rst b/ambari-common/src/main/python/jinja2/docs/templates.rst deleted file mode 100644 index 4a1f6ff..000 --- a/ambari-common/src/main/python/jinja2/docs/templates.rst +++ /dev/null @@ -1,1365 +0,0 @@ -Template Designer Documentation -=== - -.. highlight:: html+jinja - -This document describes the syntax and semantics of the template engine and -will be most useful as reference to those creating Jinja templates. As the -template engine is very flexible the configuration from the application might -be slightly different from here in terms of delimiters and behavior of -undefined values. - - -Synopsis - - -A template is simply a text file. It can generate any text-based format -(HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, -``.html`` or ``.xml`` are just fine. - -A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and tags, which control the logic of -the template. The template syntax is heavily inspired by Django and Python. - -Below is a minimal template that illustrates a few basics. We will cover -the details later in that document:: - - - - -My Webpage - - - -{% for item in navigation %} -{{ item.caption }} -{% endfor %} - - -My Webpage -{{ a_variable }} - - - -This covers the default settings. The application developer might have -changed the syntax from ``{% foo %}`` to ``<% foo %>`` or something similar. - -There are two kinds of delimiers. ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops or assign values, the -latter prints the result of the expression to the template. - -.. _variables: - -Variables -- - -The application passes variables to the templates you can mess around in the -template. Variables may have attributes or elements on them you can access -too. How a variable looks like, heavily depends on the application providing -those. - -You can use a dot (``.``) to access attributes of a variable, alternative the -so-called "subscript" syntax (``[]``) can be used. The following lines do -the same:: - -{{ foo.bar }} -{{ foo['bar'] }} - -It's important to know that the curly braces are *not* part of the variable -but the print statement. If you access variables inside tags don't put the -braces around. - -If a variable or attribute does not exist you will get back an undefined -value. What you can do with that kind of value depends on the application -configuration, the default behavior is that it evaluates to an empty string -if printed and that you can iterate over it, but every other operation fails. - -.. _notes-on-subscriptions: - -.. admonition:: Implementation - -For convenience sake ``foo.bar`` in Jinja2 does the following things on -the Python layer: - -- check if there is an attribute called `bar` on `foo`. -- if there is not, check if there is an item ``'bar'`` in `foo`. -- if there is not, return an undefined object. - -``foo['bar']`` on the other hand works mostly the same with the a small -difference in the order: - -- check if there is an item ``'bar'`` in `foo`. -- if there is not, check if there is an attribute called `bar` on `foo`. -- if there is not, return an undefined object. - -This is important if an object has an item or attribute with the same -name. Additionally there is the :func:`attr` filter that just looks up -attributes. - -.. _filters: - -Filters - -Variables can by modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``) and may have optional arguments in -parentheses. Multiple filters can be chained. The output of one filter is -applied to the next. - -``{{ name|striptags|title }}`` for example will remove all HTML Tags from the -`name` and title-cases it. Filters that accept arguments have parentheses -around the arguments, like a function call. This example will join a list -by commas: ``{{ list|join(', ') }}``. - -The :ref:`builtin-filters` below describes all the builtin filters. - -.. _tests: - -Tests -- - -Beside filters there are also so called "tests" available. Tests can be used -to test a variable against a common expression. To test a variable or -expression you add `is` plus the name of the test after the variable. For -example to find out if a variable is defined you can do ``name is defined`` -which will then return true or false depending on if `name` is defined. - -Tests can accept arguments too. If the test only takes one argument you can -leave out the parentheses to group them. F
[09/22] AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/658360a5/ambari-common/src/main/python/jinja2/docs/templates.rst -- diff --git a/ambari-common/src/main/python/jinja2/docs/templates.rst b/ambari-common/src/main/python/jinja2/docs/templates.rst deleted file mode 100644 index 4a1f6ff..000 --- a/ambari-common/src/main/python/jinja2/docs/templates.rst +++ /dev/null @@ -1,1365 +0,0 @@ -Template Designer Documentation -=== - -.. highlight:: html+jinja - -This document describes the syntax and semantics of the template engine and -will be most useful as reference to those creating Jinja templates. As the -template engine is very flexible the configuration from the application might -be slightly different from here in terms of delimiters and behavior of -undefined values. - - -Synopsis - - -A template is simply a text file. It can generate any text-based format -(HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, -``.html`` or ``.xml`` are just fine. - -A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and tags, which control the logic of -the template. The template syntax is heavily inspired by Django and Python. - -Below is a minimal template that illustrates a few basics. We will cover -the details later in that document:: - - - - -My Webpage - - - -{% for item in navigation %} -{{ item.caption }} -{% endfor %} - - -My Webpage -{{ a_variable }} - - - -This covers the default settings. The application developer might have -changed the syntax from ``{% foo %}`` to ``<% foo %>`` or something similar. - -There are two kinds of delimiers. ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops or assign values, the -latter prints the result of the expression to the template. - -.. _variables: - -Variables -- - -The application passes variables to the templates you can mess around in the -template. Variables may have attributes or elements on them you can access -too. How a variable looks like, heavily depends on the application providing -those. - -You can use a dot (``.``) to access attributes of a variable, alternative the -so-called "subscript" syntax (``[]``) can be used. The following lines do -the same:: - -{{ foo.bar }} -{{ foo['bar'] }} - -It's important to know that the curly braces are *not* part of the variable -but the print statement. If you access variables inside tags don't put the -braces around. - -If a variable or attribute does not exist you will get back an undefined -value. What you can do with that kind of value depends on the application -configuration, the default behavior is that it evaluates to an empty string -if printed and that you can iterate over it, but every other operation fails. - -.. _notes-on-subscriptions: - -.. admonition:: Implementation - -For convenience sake ``foo.bar`` in Jinja2 does the following things on -the Python layer: - -- check if there is an attribute called `bar` on `foo`. -- if there is not, check if there is an item ``'bar'`` in `foo`. -- if there is not, return an undefined object. - -``foo['bar']`` on the other hand works mostly the same with the a small -difference in the order: - -- check if there is an item ``'bar'`` in `foo`. -- if there is not, check if there is an attribute called `bar` on `foo`. -- if there is not, return an undefined object. - -This is important if an object has an item or attribute with the same -name. Additionally there is the :func:`attr` filter that just looks up -attributes. - -.. _filters: - -Filters - -Variables can by modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``) and may have optional arguments in -parentheses. Multiple filters can be chained. The output of one filter is -applied to the next. - -``{{ name|striptags|title }}`` for example will remove all HTML Tags from the -`name` and title-cases it. Filters that accept arguments have parentheses -around the arguments, like a function call. This example will join a list -by commas: ``{{ list|join(', ') }}``. - -The :ref:`builtin-filters` below describes all the builtin filters. - -.. _tests: - -Tests -- - -Beside filters there are also so called "tests" available. Tests can be used -to test a variable against a common expression. To test a variable or -expression you add `is` plus the name of the test after the variable. For -example to find out if a variable is defined you can do ``name is defined`` -which will then return true or false depending on if `name` is defined. - -Tests can accept arguments too. If the test only takes one argument you can -leave out the parentheses to group them. F