From b6922682b006120b1636307201c02ecf15972c55 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 17 May 2012 00:21:17 +0300 Subject: [PATCH] removed leftover of 93c4406f8 and made some language improvements --- doc/templates.rst | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) 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
-- 1.7.2.5