#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)
Change History (8)
by , 16 years ago
Attachment: | utils-spaceless.diff added |
---|
follow-up: 2 comment:1 by , 16 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
I'm betting there are more tags that this is an issue for than just strong, a, and em..
comment:2 by , 16 years ago
Status: | new → assigned |
---|
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 , 16 years ago
milestone: | 1.0 → 1.0 maybe |
---|---|
Triage Stage: | Accepted → Design 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.
follow-up: 5 comment:4 by , 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.
comment:5 by , 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 , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Since Malcolm's already given his -1 and I agree with him, I'm marking this wontfix.
First patch proposal