Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #1227 -- Fixed problem with new {% spaceless %} tag. It now nor…

…malizes spaces to a single space rather than no spaces

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 0eaee6f commit e449e5c805841c35590feee1a661dffa9bbe5b4b @adrianholovaty adrianholovaty committed
Showing with 6 additions and 5 deletions.
  1. +2 −2 django/utils/
  2. +4 −3 docs/templates.txt
4 django/utils/
@@ -38,8 +38,8 @@ def strip_tags(value):
return re.sub(r'<[^>]*?>', '', value)
def strip_spaces_between_tags(value):
- "Returns the given HTML with spaces between tags stripped"
- return re.sub(r'>\s+<', '><', value)
+ "Returns the given HTML with spaces between tags normalized to a single space"
+ return re.sub(r'>\s+<', '> <', value)
def strip_entities(value):
"Returns the given HTML with all entities (&something;) stripped"
7 docs/templates.txt
@@ -668,7 +668,8 @@ spaceless
**New in Django development version.**
-Strips whitespace between HTML tags. This includes tab characters and newlines.
+Normalizes whitespace between HTML tags to a single space. This includes tab
+characters and newlines.
Example usage::
@@ -680,9 +681,9 @@ Example usage::
This example would return this HTML::
- <p><a href="foo/">Foo</a></p>
+ <p> <a href="foo/">Foo</a> </p>
-Only space between *tags* is stripped -- not space between tags and text. In
+Only space between *tags* is normalized -- not space between tags and text. In
this example, the space around ``Hello`` won't be stripped::
{% spaceless %}

0 comments on commit e449e5c

Please sign in to comment.
Something went wrong with that request. Please try again.