I am trying to be DRY with my Django templates, and have some code that I mix with CSS for a simple popup popup. I would like to reuse the code, but the contents of my popup will be HTML, which can span multiple lines. Is it possible to insert multi-line strings into a template variable?
I tried to do something funky with blocks and block.super, but this only works when expanding (not include)
Here is an example of what I would like to do. Is it possible?
index.html
<body>
<h2>My Popup</h2>
{% include "snippets/popup.html" with class="p" spantext="Hover me" popupdiv="""
<h2>This is a popup!</h2>
<ul>
<li>Something</li>
<li>Something else</li>
</ul>
"""
%}
</body>
snippets/popup.html
<div class="{{ class }}">
<span class='pointer'>{{ spantext }}</span>
<div class="popup">
{{ popupdiv }}
</div>
</div>
I know that in Django it is impossible to have multi-line template tags, but is there any way around this other than crushing my entire html div into one line and avoiding quotes?
Greetings