diff options
author | Owen Jacobson <owen@grimoire.ca> | 2022-06-08 17:56:35 -0400 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2022-06-09 10:02:35 +0200 |
commit | 71267bc88554c15caf4ee1e7c0d256556303e0e8 (patch) | |
tree | 657b8262a4a007bd7a4855b6f99ca37c49f661ad /book/src/template_syntax.md | |
parent | 6cce13f076bdd3e8d9b0bf888c0464a1af9df25f (diff) | |
download | askama-71267bc88554c15caf4ee1e7c0d256556303e0e8.tar.gz askama-71267bc88554c15caf4ee1e7c0d256556303e0e8.tar.bz2 askama-71267bc88554c15caf4ee1e7c0d256556303e0e8.zip |
Document macro import syntax.
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.
Diffstat (limited to 'book/src/template_syntax.md')
-rw-r--r-- | book/src/template_syntax.md | 8 |
1 files changed, 8 insertions, 0 deletions
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) %} +``` |