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 f3acf0b, 604752b · Browse files · 3 files+11 added−6 removed
This commit

State

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

Diff stats

3 files+11 added−6 removed

  • other:+11 added−6 removed

3 files+11 added−6 removed

modified:docs/faq.rst+1 added-1 removed
137 unmodified lines
138Jinja2 no longer ships with a C implementation of it but only the pure139Python implementation. It will however check if MarkupSafe is available140and installed, and if it is, use the Markup class from MarkupSafe.141142So if you want the speedups, just import MarkupSafe.142So if you want the speedups, just install MarkupSafe.143144.. _MarkupSafe: http://pypi.python.org/pypi/MarkupSafe145146My tracebacks look weird. What's happening?
57 unmodified lines
modified:docs/templates.rst+4 added
588 unmodified lines
589 {%- endif %}</li>590 {%- endfor %}591 </ul>592593The `loop` variable always refers to the closest (innermost) loop. If we594have more than one levels of loops, we can rebind the variable `loop` by595writing `{% set outer_loop = loop %}` after the loop that we want to596use recursively. Then, we can call it using `{{ outer_loop(...) }}`597598If599~~600
787 unmodified lines
modified:jinja2/filters.py+6 added-5 removed
443 unmodified lines
444def do_truncate(s, length=255, killwords=False, end='...'):445 """Return a truncated copy of the string. The length is specified446 with the first parameter which defaults to ``255``. If the second447 parameter is ``true`` the filter will cut the text at length. Otherwise448 it will try to save the last word. If the text was in fact448 it will discard the last word. If the text was in fact449 truncated it will append an ellipsis sign (``"..."``). If you want a450 different ellipsis sign than ``"..."`` you can specify it using the451 third parameter.452453 .. sourcecode jinja::453 .. sourcecode:: jinja454455 {{ mytext|truncate(300, false, '&raquo;') }}456 truncate mytext to 300 chars, don't split up words, use a457 right pointing double arrow as ellipsis sign.455 {{ "foo bar"|truncate(5) }}456 -> "foo ..."457 {{ "foo bar"|truncate(5, True) }}458 -> "foo b..."459 """460 if len(s) <= length:461 return s462 elif killwords:
378 unmodified lines