Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#8123 closed (wontfix)

Spaceless tag should pay attention to specific tags

Reported by: Julian Bez Owned by: Julian Bez
Component: Template system Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Currently, the spaceless tag erases all whitespace between HTML tags.

That gets you in trouble, because whitespace between some specific tags carries semantic meaning.

Example:

<div>
<h1>Hello</h1>
<p>That is an <strong>important</strong> <a href="">question</a>  </p> <p> <em>Bla</em> bla</p>
</div>

Currently produces:

<div><h1>Hello</h1><p>That is an <strong>important</strong><a href="">question</a></p><p><em>Bla</em> bla</p></div>

and gets you "...importantquestion..." when it really should be:

<div><h1>Hello</h1><p>That is an <strong>important</strong> <a href="">question</a></p><p><em>Bla</em> bla</p></div>

The difference here is that whitespace between strong and a would be preserved, but it still deletes space between p and em for example.

Attachments (1)

utils-spaceless.diff (658 bytes ) - added by Julian Bez 16 years ago.
First patch proposal

Download all attachments as: .zip

Change History (8)

by Julian Bez, 16 years ago

Attachment: utils-spaceless.diff added

First patch proposal

comment:1 by Matt McClanahan, 16 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

I'm betting there are more tags that this is an issue for than just strong, a, and em..

in reply to:  1 comment:2 by Julian Bez, 16 years ago

Status: newassigned

Replying to mattmcc:

I'm betting there are more tags that this is an issue for than just strong, a, and em..

Sure, should I update the patch with all HTML inline elements and other stuff I can think of? I thought I better get some feedback first, if the regex is okay and not ineffective, before stuffing dozens of tags in there.

comment:3 by Malcolm Tredinnick, 16 years ago

milestone: 1.01.0 maybe
Triage Stage: AcceptedDesign decision needed

-1 from me, but I'll get another opinion before nuking this. I think this is a case of "don't do that". If it's not going to be safe to remove spaces like that, then don't use the spaceless tag. It's primarily a costmetic thing, after all.

comment:4 by Julien Phalip, 16 years ago

Maybe a trade-off would be to remove all but one space character, for those tags. It's only the first space character that carries meaning, all the others can be stripped out.

in reply to:  4 comment:5 by Julian Bez, 16 years ago

Replying to julien:

Maybe a trade-off would be to remove all but one space character, for those tags. It's only the first space character that carries meaning, all the others can be stripped out.

That is what the patch does at the moment.

comment:6 by Jacob, 16 years ago

Resolution: wontfix
Status: assignedclosed

Since Malcolm's already given his -1 and I agree with him, I'm marking this wontfix.

comment:7 by (none), 16 years ago

milestone: 1.0 maybe

Milestone 1.0 maybe deleted

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