Opened 13 years ago

Closed 13 years ago

Last modified 13 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

Description

Take the following example:

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

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?

Cal

Change History (2)

comment:1 by Russell Keith-Magee, 13 years ago

Resolution: invalid
Status: newclosed

Is there something wrong with {% spaceless %}?

comment:2 by Cal Leeming, 13 years ago

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