Opened 8 years ago

Closed 8 years ago

#4446 closed (worksforme)

spaceless fails under specific condition of subtemplate

Reported by: shwag < > Owned by: nobody
Component: Template system Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by mtredinnick)

The {% spaceless %} filter is not filtering out carriage returns in sub-templates under certain conditions.

{% spaceless %}
{% include "something.html" %}
{% endspaceless %}

and in something.html

{% if test  %}
{% load humanize %}
<a name="thing"></a>

will leave one carriage return for each block tag.
A valid work around is.

<a name="thing"></a>
{% if test  %}
{% load humanize %}

Once valid html is before the tags, the carriage returns are no longer generated.

Change History (3)

comment:1 Changed 8 years ago by shwag < >

  • Component changed from Uncategorized to Template system
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from jacob to adrian
  • Patch needs improvement unset

comment:2 Changed 8 years ago by mtredinnick

  • Description modified (diff)

Fixed description formatting so that non-code sentences wrap.

comment:3 Changed 8 years ago by semenov

  • Resolution set to worksforme
  • Status changed from new to closed

With the latest trunk - [6364] - the provided example (with {% endif %} added, of course) works as expected/documented: no unnecessary newlines.

Note: See TracTickets for help on using tickets.
Back to Top