I have seen this question up here and some are solving it by comment tags or breaking tags like this:
<i><!--
-->t does not work on the first level with tabspace = 2
beside it looks horrible.
<a
>nnoying<
/a> is it not?
I remember as if I have seen some trick like
<a>&dont_put_here_space_please;
tricky ampersand code.
Is there any such thing?
I am using now jinja2 python template engine. Does it have some space-preventing trick?
UPDATE:
With jinja2, thanks to dav1d, the shortest way I could come up with is:
<a>{% if true -%}
No space in the output before this text.
</a>{% endif -%}
Nor after.
Is there any shorter way of doing this?
The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces and line breaks.
The trim() method removes whitespace from both sides of a string.
Basic HTML Line Break Syntax You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard. Be aware that HTML will ignore any line break from a keyboard's return key.
The HTML <pre> tag defines preformatted text preserving both whitespace and line breaks in the HTML document. This tag is also commonly referred to as the <pre> element.
Jinja2 WhiteSpace Control is what you need (according to your reponse to my comment): http://jinja.pocoo.org/docs/templates/#whitespace-control
This should do what you want:
{# -#}
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