Skip to content
Myr

Corrected title filter behavior.

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

The title filter will now correctly lowercase the non first letter like the regular Python filter does. This fixes #251.

authored by Armin Ronacher · committed by Armin Ronacher · parent 563fd2e · Browse files · 3 files+5 added−1 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+5 added−1 removed

  • other:+5 added−1 removed

3 files+5 added−1 removed

modified:jinja2/testsuite/filters.py+2 added
206 unmodified lines
207 tmpl = env.from_string('''{{ "foo-bar"|title }}''')208 assert tmpl.render() == "Foo-Bar"209 tmpl = env.from_string('''{{ "foo\tbar"|title }}''')210 assert tmpl.render() == "Foo\tBar"211 tmpl = env.from_string('''{{ "FOO\tBAR"|title }}''')212 assert tmpl.render() == "Foo\tBar"213214 def test_truncate(self):215 tmpl = env.from_string(216 '{{ data|truncate(15, true, ">>>") }}|'
299 unmodified lines
modified:jinja2/filters.py+1 added-1 removed
184 unmodified lines
185 rv = []186 for item in re.compile(r'([-\s]+)(?u)').split(s):187 if not item:188 continue189 rv.append(item[0].upper() + item[1:])189 rv.append(item[0].upper() + item[1:].lower())190 return ''.join(rv)191192193def do_dictsort(value, case_sensitive=False, by='key'):
794 unmodified lines
modified:CHANGES+2 added
11 unmodified lines
12 broke existing templates for users.13- Fixed some warnings with hashing of undefineds and nodes if Python14 is run with warnings for Python 3.15- Added support for properly hashing undefined objects.16- Fixed a bug with the title filter not working on already uppercase17 strings.1819Version 2.720-----------21(codename Translation, released on May 20th 2013)
294 unmodified lines