Skip to content
Myr

Merge branch 'master' of github.com:mitsuhiko/jinja2

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

authored by Armin Ronacher · committed by Armin Ronacher · parents ee352ec, e37f697 · Browse files · 4 files+8 added−9 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+8 added−9 removed

  • other:+8 added−9 removed

4 files+8 added−9 removed

modified:docs/faq.rst+1 added-1 removed
8 unmodified lines
9-----------------------1011The name Jinja was chosen because it's the name of a Japanese temple and12temple and template share a similar pronunciation. It is not named after13the capital city of Uganda.13the city in Uganda.1415How fast is it?16---------------17
174 unmodified lines
modified:docs/templates.rst+4 added-3 removed
881 unmodified lines
882 {% for box in boxes %}883 {% include "render_box.html" %}884 {% endfor %}885886 The included template ``render_box.html`` is not able to access887 `box` in Jinja 2.0, but in Jinja 2.1.886 The included template ``render_box.html`` is *not* able to access887 `box` in Jinja 2.0. As of Jinja 2.1 ``render_box.html`` *is* able888 to do so.889890891.. _expressions:892
78 unmodified lines
971 ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``.972973//974 Divide two numbers and return the truncated integer result.974 ``{{ 20 / 7 }}`` is ``2``.975 ``{{ 20 // 7 }}`` is ``2``.976977%978 Calculate the remainder of an integer division. ``{{ 11 % 7 }}`` is ``4``.979
387 unmodified lines
modified:jinja2/filters.py+3 added-3 removed
441 unmodified lines
442 result.append(word)443 result.append(end)444 return u' '.join(result)445446447def do_wordwrap(s, width=79, break_long_words=True):446@environmentfilter447def do_wordwrap(environment, s, width=79, break_long_words=True):448 """449 Return a copy of the string passed to the filter wrapped after450 ``79`` characters. You can override this default using the first451 parameter. If you set the second parameter to `false` Jinja will not452 split words apart if they are longer than `width`.453 """454 import textwrap455 return u'\n'.join(textwrap.wrap(s, width=width, expand_tabs=False,455 return environment.newline_sequence.join(textwrap.wrap(s, width=width, expand_tabs=False,456 replace_whitespace=False,457 break_long_words=break_long_words))458459
342 unmodified lines
modified:jinja2/runtime.py-2 removed
73 unmodified lines
74 self.__context = context7576 def __getitem__(self, name):77 blocks = self.__context.blocks[name]78 wrap = self.__context.eval_ctx.autoescape and \79 Markup or (lambda x: x)78 return BlockReference(name, self.__context, blocks, 0)7980 def __repr__(self):81 return '<%s %r>' % (
467 unmodified lines