Migrated issue, originally created by Michael Bayer (@zzzeek)
pretty intuitive, the block is essentially just like a def except it invokes immediately.
is equivalent to:
where "_anon_1" is generated, except that there is no "_anon_1" def which is "exported". Blocks are more private than top-level defs.
The block can of course have a name, which is generally for when inheritance is used. The rules then change a bit:
is equivalent to, minus the top level def export:
i.e. named blocks exec off of self and only if the parent doesn't have such a block. That way, the bottommost template in an inheritance chain determines when a block of a certain name occurs, giving us the jinja2 system of inheritance:
The text was updated successfully, but these errors were encountered: