diff options
Diffstat (limited to '')
-rw-r--r-- | book/src/template_syntax.md | 9 |
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 %} |