From 71267bc88554c15caf4ee1e7c0d256556303e0e8 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 8 Jun 2022 17:56:35 -0400 Subject: Document macro import syntax. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was a source of some frustration working on a port of a toy app to askama. The tests do help, but having this called out in the docs would have saved me an hour or two. --- book/src/template_syntax.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'book/src/template_syntax.md') diff --git a/book/src/template_syntax.md b/book/src/template_syntax.md index 755d283..23b5dea 100644 --- a/book/src/template_syntax.md +++ b/book/src/template_syntax.md @@ -390,3 +390,11 @@ 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 %}` + +``` +{%- import "macro.html" as scope -%} + +{% call scope::heading(s) %} +``` -- cgit