I have a number of macros I'd like to render within a common container macro or template. With pseudo-code:
Macro1
Macro2
Macro3
Container
In a template:
"render macro1 inside of Container" e.g. {{ macro1 with Container }}
I don't want to go through rendering Container and then the macro inside it everytime, I just need to specify, when this macro, enclose with this other macro
I think 'call' (http://jinja.pocoo.org/docs/templates/#macros) is what I'm looking for but I don't quite understand it right now. Any input, and how I can clarify this if it is not clear appreciated.
This works for me:
{% macro _enclosure() %}
<div id="topenclosure">hello I'm on top</div>
{{ caller() }}
<div id="bottomenclosure">hello I'm on the bottom</div>
{% endmacro %}
{% macro account_user_profile_macro(i) %}
{% call _enclosure() %}
{{i.__dict__}}
{% endcall %}
{% endmacro %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With