0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

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
This commit is contained in:
Adrian Holovaty 2006-01-16 18:59:43 +00:00
parent d5a5f0f790
commit f1f2005c05

View File

@ -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 %}
<p>
<a href="foo/">Foo</a>
</p>
{% spaceless %}
This example would return this HTML::
<p> <a href="foo/">Foo</a> </p>
Only space between *tags* is normalized -- not space between tags and text. In
this example, the space around ``Hello`` won't be stripped::
{% spaceless %}
<strong>
Hello
</strong>
{% spaceless %}
"""
nodelist = parser.parse(('endspaceless',))
parser.delete_first_token()
return SpacelessNode(nodelist)