From e0574d3092dc71336ef6a1b6ef2db242aa19732d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 23 Oct 2023 13:36:28 +0200 Subject: Extend documentation about using block/macro name when "ending" it --- book/src/template_syntax.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'book') 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 %}

Placeholder content

{% 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) %}

{{arg}}

{% endmacro heading %} +``` -- cgit