djhtml
djhtml copied to clipboard
formatting sometimes destroys hyperlinks
I have encountered a problem where djhtml sometimes does a non-safe reformatting that can break functionality on the page.
I had a line in a template that looked like this (indentation removed for clarity):
<a href="{{ request.scheme }}://{{ request.get_host }}{% url 'accept-organizer-invite' ei.code %}">{{ request.scheme }}://{{ request.get_host }}{% url 'accept-organizer-invite' ei.code %}</a>
And running djhtml (version 3.0.6) on the file resulted in this change
<a href="{{ request.scheme }}://
{{ request.get_host }}{% url 'accept-organizer-invite' ei.code %}">{{ request.scheme }}://{{ request.get_host }}{% url 'accept-organizer-invite' ei.code %}</a>
And when the template gets rendered this changes the link from
<a href="https://mysite.example/organizer/accept/17">https://mysite.example/organizer/accept/17</a>
to
<a href="https://
mysite.example/organizer/accept/17">https://mysite.example/organizer/accept/17</a>
and this results in an unclickable link.
It's would probably be best if djhtml never inserted line breaks inside any html attribute.