aboutsummaryrefslogtreecommitdiffstats
path: root/book
diff options
context:
space:
mode:
authorLibravatar Mo <76752051+mo8it@users.noreply.github.com>2023-10-29 16:28:53 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-10-30 10:16:04 +0100
commit94d3bc1dc039f26fb157e50215dcf139078ab231 (patch)
tree1faf58884360fcd7c64c4eb03e6cf7d60217d727 /book
parent40bb3382b0c98e97f484c81659207b6b950c5cb0 (diff)
downloadaskama-94d3bc1dc039f26fb157e50215dcf139078ab231.tar.gz
askama-94d3bc1dc039f26fb157e50215dcf139078ab231.tar.bz2
askama-94d3bc1dc039f26fb157e50215dcf139078ab231.zip
Improve the macros section
Diffstat (limited to 'book')
-rw-r--r--book/src/template_syntax.md9
1 files changed, 4 insertions, 5 deletions
diff --git a/book/src/template_syntax.md b/book/src/template_syntax.md
index 0b76b22..9716369 100644
--- a/book/src/template_syntax.md
+++ b/book/src/template_syntax.md
@@ -444,9 +444,9 @@ struct Item<'a> {
## Macros
-You can define macros within your template by using `{% macro name(args) %}`, ending with `{% endmacro %}`
+You can define macros within your template by using `{% macro name(args) %}`, ending with `{% endmacro %}`.
-You can then call it later with `{% call name(args) %}`
+You can then call it with `{% call name(args) %}`:
```
{% macro heading(arg) %}
@@ -458,7 +458,7 @@ You can then call it later with `{% call name(args) %}`
{% call heading(s) %}
```
-You can place templates in a separate file and use it in your templates by using `{% import %}`
+You can place macros in a separate file and use them in your templates by using `{% import %}`:
```
{%- import "macro.html" as scope -%}
@@ -466,8 +466,7 @@ You can place templates in a separate file and use it in your templates by using
{% call scope::heading(s) %}
```
-It is also possible to use the name of the `macro` in `endmacro` in the
-declaration:
+You can optionally specify the name of the macro in `endmacro`:
```html
{% macro heading(arg) %}<p>{{arg}}</p>{% endmacro heading %}