diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-10-23 13:36:28 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-10-23 15:13:27 +0200 |
commit | e0574d3092dc71336ef6a1b6ef2db242aa19732d (patch) | |
tree | 0d97cb3abff384eb5959ffe46c8ee257234b9f36 /book/src | |
parent | a7f5186bf49ef20010c2eae7717b3a738a3b548e (diff) | |
download | askama-e0574d3092dc71336ef6a1b6ef2db242aa19732d.tar.gz askama-e0574d3092dc71336ef6a1b6ef2db242aa19732d.tar.bz2 askama-e0574d3092dc71336ef6a1b6ef2db242aa19732d.zip |
Extend documentation about using block/macro name when "ending" it
Diffstat (limited to '')
-rw-r--r-- | book/src/template_syntax.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/book/src/template_syntax.md b/book/src/template_syntax.md index 4483562..0b76b22 100644 --- a/book/src/template_syntax.md +++ b/book/src/template_syntax.md @@ -176,6 +176,13 @@ inheritance. Blocks can only be specified at the top level of a template or inside other blocks, not inside `if`/`else` branches or in `for`-loop bodies. +It is also possible to use the name of the `block` in `endblock` (both in +declaration and use): + +```html +{% block content %}<p>Placeholder content</p>{% endblock content %} +``` + ### Child template Here's an example child template: @@ -458,3 +465,10 @@ 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: + +```html +{% macro heading(arg) %}<p>{{arg}}</p>{% endmacro heading %} +``` |