diff --git a/django/utils/html.py b/django/utils/html.py index d89067106e590..9e239cad1f59c 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -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" diff --git a/docs/templates.txt b/docs/templates.txt index 0fbe1f6ae8fd5..3dafb068c3ec1 100644 --- a/docs/templates.txt +++ b/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:: -

Foo

+

Foo

-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 %}