mirror of https://github.com/django/django.git
Small formatting tweaks to named-end-blocks change from [4489]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4492 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
38f9d8dac6
commit
b9677848f5
|
@ -129,7 +129,7 @@ def do_block(parser, token):
|
||||||
parser.__loaded_blocks.append(block_name)
|
parser.__loaded_blocks.append(block_name)
|
||||||
except AttributeError: # parser.__loaded_blocks isn't a list yet
|
except AttributeError: # parser.__loaded_blocks isn't a list yet
|
||||||
parser.__loaded_blocks = [block_name]
|
parser.__loaded_blocks = [block_name]
|
||||||
nodelist = parser.parse(('endblock','endblock %s' % block_name))
|
nodelist = parser.parse(('endblock', 'endblock %s' % block_name))
|
||||||
parser.delete_first_token()
|
parser.delete_first_token()
|
||||||
return BlockNode(block_name, nodelist)
|
return BlockNode(block_name, nodelist)
|
||||||
|
|
||||||
|
|
|
@ -253,10 +253,15 @@ Here are some tips for working with inheritance:
|
||||||
if you want to add to the contents of a parent block instead of
|
if you want to add to the contents of a parent block instead of
|
||||||
completely overriding it.
|
completely overriding it.
|
||||||
|
|
||||||
* You can optionally name your ``{{ endblock }}`` tag with the same name
|
* **New in Django development version:** For extra readability, you can
|
||||||
you gave the ``{{ block }}`` tag (for example, ``{{ endblock content }}``).
|
optionally give a *name* to your ``{% endblock %}`` tag. For example::
|
||||||
In larger templates this helps you see which ``{{ block }}`` tags are
|
|
||||||
being closed.
|
{% block content %}
|
||||||
|
...
|
||||||
|
{% endblock content %}
|
||||||
|
|
||||||
|
In larger templates, this technique helps you see which ``{% block %}``
|
||||||
|
tags are being closed.
|
||||||
|
|
||||||
Finally, note that you can't define multiple ``{% block %}`` tags with the same
|
Finally, note that you can't define multiple ``{% block %}`` tags with the same
|
||||||
name in the same template. This limitation exists because a block tag works in
|
name in the same template. This limitation exists because a block tag works in
|
||||||
|
|
Loading…
Reference in New Issue