Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#16415 closed New feature (invalid)

Template block function to strip whitespace from specific chunks

Reported by: Cal Leeming Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Take the following example:

<div class="PostBlock
     {% if forloop.last %}Last{% endif %}
     {% if forloop.first %}
     {% else %}
        {% if not forloop.counter|divisibleby:"2" %}
        {% endif %}
     {% endif %}

That would be outputted in a horrible format. Instead, it would be nice to wrap it in something like {% no_whitespace %} {% end_no_whitespace %}, which would in turn strip all whitespace from the beginning and the end.

Any thoughts?


Change History (2)

comment:1 Changed 8 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

Is there something wrong with {% spaceless %}?

comment:2 Changed 8 years ago by Cal Leeming

Omg, how the hell did I miss that, I spent a good 20 minutes looking around for a solution on djangodocs and google.

Really sorry :/

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