From f1f2005c05061030711b6cf3a9418d1e5223907a Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 16 Jan 2006 18:59:43 +0000 Subject: [PATCH] Fixed #1231 -- Added documentation for {% spaceless %} tag to the auto-generated template-tag docs in the admin git-svn-id: http://code.djangoproject.com/svn/django/trunk@2012 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/template/defaulttags.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/django/core/template/defaulttags.py b/django/core/template/defaulttags.py index daad1c2dfa..f9197dec92 100644 --- a/django/core/template/defaulttags.py +++ b/django/core/template/defaulttags.py @@ -735,6 +735,31 @@ def regroup(parser, token): regroup = register.tag(regroup) def spaceless(parser, token): + """ + Normalize whitespace between HTML tags to a single space. This includes tab + characters and newlines. + + Example usage:: + + {% spaceless %} +

+ Foo +

+ {% spaceless %} + + This example would return this HTML:: + +

Foo

+ + Only space between *tags* is normalized -- not space between tags and text. In + this example, the space around ``Hello`` won't be stripped:: + + {% spaceless %} + + Hello + + {% spaceless %} + """ nodelist = parser.parse(('endspaceless',)) parser.delete_first_token() return SpacelessNode(nodelist)