mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
add named macro end-tag documentation
This commit is contained in:
@@ -31,6 +31,9 @@ variables.
|
||||
You can pass the whole context as an argument by using the special
|
||||
``_context`` variable.
|
||||
|
||||
Import
|
||||
------
|
||||
|
||||
Macros can be defined in any template, and need to be "imported" before being
|
||||
used (see the documentation for the :doc:`import<../tags/import>` tag for more
|
||||
information):
|
||||
@@ -83,4 +86,18 @@ import it locally:
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
Named Macro End-Tags
|
||||
--------------------
|
||||
|
||||
Twig allows you to put the name of the macro after the end tag for better
|
||||
readability:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{% macro input() %}
|
||||
...
|
||||
{% endmacro input %}
|
||||
|
||||
Of course, the name after the ``endmacro`` word must match the macro name.
|
||||
|
||||
.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>`
|
||||
|
||||
Reference in New Issue
Block a user