From 40c7553a6906ef08cd5b1ffbf5e732e969860b91 Mon Sep 17 00:00:00 2001 From: Henry Bley-Vroman Date: Wed, 6 Mar 2019 14:37:54 -0500 Subject: [PATCH] document support for defining default argument values in the macro tag --- doc/tags/macro.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/tags/macro.rst b/doc/tags/macro.rst index a8aa76fd9..00b78c007 100644 --- a/doc/tags/macro.rst +++ b/doc/tags/macro.rst @@ -13,10 +13,16 @@ Here is a small example of a macro that renders a form element: {% endmacro %} -Macros differ from native PHP functions in a few ways: +Default argument values can be defined with the ``default`` filter in the +macro body, as above, or as in native PHP functions: -* Default argument values are defined by using the ``default`` filter in the - macro body; +.. code-block:: jinja + + {% macro input(name, value, type = 'text', size = 20) %} + + {% endmacro %} + +Macros differ from native PHP functions in a few ways: * Arguments of a macro are always optional.