My main.html
template contains the following code:
<p>{% include "pouac.html" %}{% include "pouac.html" %}</p>
The pouac.html
file contains a single line:
<span>pouac</span>
The main.html
template produces the following two lines of html code:
<span>pouac</span>
<span>pouac</span>
The nasty side effect is that this code produces some white space between the two "pouac" words (e.g: "word1" and "word2" are separated by a whitespace in http://jsfiddle.net/regisb/CBtaz/)
In order to get rid of this whitespace, I would like to render a Django template without adding an extranuous line break. How can I do that?
You can use the spaceless [1] template tag.
{% spaceless %}{% include "pouac.html" %}{% include "pouac.html" %}{% endspaceless %}
[1] https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#spaceless
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