Opened 8 years ago

Closed 8 years ago

Last modified 8 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: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

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 8 years ago.
First patch proposal

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by Julian Bez

Attachment: utils-spaceless.diff added

First patch proposal

comment:1 Changed 8 years ago by Matt McClanahan

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..

comment:2 in reply to:  1 Changed 8 years ago by Julian Bez

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 Changed 8 years ago by Malcolm Tredinnick

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 Changed 8 years ago by Julien Phalip

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.

comment:5 in reply to:  4 Changed 8 years ago by Julian Bez

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 Changed 8 years ago by Jacob

Resolution: wontfix
Status: assignedclosed

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

comment:7 Changed 8 years ago by (none)

milestone: 1.0 maybe

Milestone 1.0 maybe deleted

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