From: Tobias Schultze Date: Wed, 16 May 2012 21:21:17 +0000 (+0300) Subject: removed leftover of 93c4406f8 and made some language improvements X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=b6922682b006120b1636307201c02ecf15972c55;p=web%2Fkonrad%2Ftwig.git removed leftover of 93c4406f8 and made some language improvements --- diff --git a/doc/templates.rst b/doc/templates.rst index c327168..90211b9 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -414,11 +414,10 @@ Macros ------ Macros are comparable with functions in regular programming languages. They -are useful to put often used HTML idioms into reusable elements to not repeat -yourself. +are useful to reuse often used HTML fragments to not repeat yourself. -A macro is defined via the :doc:`macro` tag. Here is a small -example of a macro that renders a form element: +A macro is defined via the :doc:`macro` tag. Here is a small example +(subsequently called ``forms.html``) of a macro that renders a form element: .. code-block:: jinja @@ -426,8 +425,8 @@ example of a macro that renders a form element: {% endmacro %} -Macros can be defined in any template, and need to be "imported" before being -used via the :doc:`import` tag: +Macros can be defined in any template, and need to be "imported" via the +:doc:`import` tag before being used: .. code-block:: jinja @@ -435,12 +434,12 @@ used via the :doc:`import` tag:

{{ forms.input('username') }}

-Alternatively you can import names from the template into the current -namespace via the :doc:`from` tag: +Alternatively, you can import individual macro names from a template into the +current namespace via the :doc:`from` tag and optionally alias them: .. code-block:: jinja - {% from 'forms.html' import input as input_field, textarea %} + {% from 'forms.html' import input as input_field %}
Username