Permalink
Browse files

It's now possible to use ``{{ foo.0.0 }}``

--HG--
branch : trunk
  • Loading branch information...
1 parent f7e405d commit cb1b97f088f93967b912e6bfb968cb9cfd88f538 @mitsuhiko mitsuhiko committed Sep 10, 2008
Showing with 5 additions and 3 deletions.
  1. +2 −0 CHANGES
  2. +1 −1 jinja2/lexer.py
  3. +2 −2 tests/test_syntax.py
View
@@ -12,6 +12,8 @@ Version 2.1
- fixed a bug with the i18n extension that caused the explicit pluralization
block to look up the wrong variable.
+- fixed a limitation in the lexer that made ``{{ foo.0.0 }}`` impossible.
+
Version 2.0
-----------
(codename jinjavitus, released on July 17th 2008)
View
@@ -31,7 +31,7 @@
r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)
integer_re = re.compile(r'\d+')
name_re = re.compile(r'\b[a-zA-Z_][a-zA-Z0-9_]*\b')
-float_re = re.compile(r'\d+\.\d+')
+float_re = re.compile(r'(?<!\.)\d+\.\d+')
newline_re = re.compile(r'(\r\n|\r|\n)')
# bind operators to token types
@@ -26,7 +26,7 @@
BOOL = '''{{ true and false }}|{{ false or true }}|{{ not false }}'''
GROUPING = '''{{ (true and false) or (false and true) and not false }}'''
CONDEXPR = '''{{ 0 if true else 1 }}'''
-DJANGOATTR = '''{{ [1, 2, 3].0 }}'''
+DJANGOATTR = '''{{ [1, 2, 3].0 }}|{{ [[1]].0.0 }}'''
FILTERPRIORITY = '''{{ "foo"|upper + "bar"|upper }}'''
TUPLETEMPLATES = [
'{{ () }}',
@@ -116,7 +116,7 @@ def test_grouping(env):
def test_django_attr(env):
tmpl = env.from_string(DJANGOATTR)
- assert tmpl.render() == '1'
+ assert tmpl.render() == '1|1'
def test_conditional_expression(env):

0 comments on commit cb1b97f

Please sign in to comment.