#3532 closed (fixed)
Give the template tag "spaceless" an option wether to leave a single space or none.
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Keywords: | spaceless template tag | |
Cc: | treborhudson@… | Triage Stage: | Design decision needed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As I am having CSS trouble with IE, I need to have absolutely no whitechars between list elements.
{% spaceless %} seems to be the way to go. And while it removes all the
whitespaces, it puts a single space back, for convenience i guess.
I think this means to either extend the spaceless tag to be able to choose
what to do or make a new one?
Attachments (2)
Change History (13)
comment:1 by , 18 years ago
Cc: | added |
---|
comment:2 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Sounds good, someone write up the patch.
comment:3 by , 18 years ago
I was about to code the patch to add spaces if none existed, but since this wasn't there before, I decided not to.
Would it be worth considering, that if the numeric value is > 0, to add spaces between tags if none existed prior? This would have the benefit that all spaces are uniform. It should be as simple as changing the \s+ to a \s*? in the regex, but I'm not convinced this is the best way to go.
comment:4 by , 18 years ago
Nice work! In my opinion {% spaceless %} should not add spaces, if there weren't any in the first place.
Btw. I think that the actual number of spaces added, is actually not that important, as multiple spaces will be shown as one by the browser anyway.
comment:5 by , 18 years ago
Has patch: | set |
---|
comment:6 by , 18 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Thanks Rob
If we worry about adding spaces to tags it's a slight change in current functionality. For now let's stick with this. Like ampaze says it probably doesn't really matter about how many spaces. So maybe having a numeric value is a wee bit overkill but it solves the problem so I'm marking as ready.
comment:7 by , 18 years ago
Personally, I think the default should be no spaces, with an option to add spaces. Would there be objections to that? Or does that break BC?
comment:8 by , 18 years ago
Triage Stage: | Ready for checkin → Design decision needed |
---|
I'm inclined to agree on the 'spaceless should mean spaceless' issue. I'm moving this discussion to the dev list so we can get an offical pronouncement on whether backwards compatibility is worth maintaining here.
comment:9 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:10 by , 17 years ago
This change broke my site, of course, as it undid the change described here: #1227 :-(
Guess I have to roll my own spaceless filter so I get something I can trust (it would be nice with one that understands PRE tags anyway).
by , 17 years ago
Attachment: | reintroduce_space.diff added |
---|
Reintroduce spaces for anchor tags that enclose text
comment:11 by , 17 years ago
For others who need to, this patch can help reintroduce spaces between anchor tags that enclose text (ilke the example in #1227).
I agree... when I first used this I expected no spaces (in other words: spaceless). I too would like a "no I really mean spaceless" templatetag.
Perhaps spaceless should be renamed to normalize or something?
Or change the templatetag to accept an optional numeric value for the number of spaces to put back with the default being 1? ie: {% spaceless 0 %}{% endspaceless %}