Skip to content
Myr

clarify blocks docs (#2060)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents a12789e, 786d12b · Browse files · 4 files+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+5 added−5 removed

  • other:+5 added−5 removed

4 files+5 added−5 removed

modified:docs/templates.rst+2 added-2 removed
526 unmodified lines
527528Block Nesting and Scope529~~~~~~~~~~~~~~~~~~~~~~~530531Blocks can be nested for more complex layouts. However, per default blocks532may not access variables from outer scopes::531Blocks can be nested for more complex layouts. By default, a block may not532access variables from outside the block (outer scopes)::533534 {% for item in seq %}535 <li>{% block loop_item %}{{ item }}{% endblock %}</li>536 {% endfor %}
1426 unmodified lines
modified:docs/tricks.rst+1 added-1 removed
19 unmodified lines
2021Usually child templates extend from one template that adds a basic HTML22skeleton. However it's possible to put the `extends` tag into an `if` tag to23only extend from the layout template if the `standalone` variable evaluates24to false which it does per default if it's not defined. Additionally a very24to false, which it does by default if it's not defined. Additionally a very25basic skeleton is added to the file so that if it's indeed rendered with26`standalone` set to `True` a very basic HTML skeleton is added::2728 {% if not standalone %}{% extends 'default.html' %}{% endif -%}
72 unmodified lines
modified:src/jinja2/loaders.py+1 added-1 removed
428 unmodified lines
429 template source. This loader is useful for unittesting:430431 >>> loader = DictLoader({'index.html': 'source here'})432433 Because auto reloading is rarely useful this is disabled per default.433 Because auto reloading is rarely useful this is disabled by default.434 """435436 def __init__(self, mapping: t.Mapping[str, str]) -> None:437 self.mapping = mapping
250 unmodified lines
modified:CHANGES.rst+1 added-1 removed
999 unmodified lines
1000- ``else`` is optional for conditional expressions. If not given it1001 evaluates to ``false``.1002- Improved error reporting for undefined values by providing a1003 position.1004- ``filesizeformat`` filter uses decimal prefixes now per default and1004- ``filesizeformat`` filter uses decimal prefixes now by default and1005 can be set to binary mode with the second parameter.1006- Fixed bug in finalizer10071008
6 unmodified lines