Skip to content
Myr

added support for implicit string literal concatenation

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

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 63fd798 · Browse files · 3 files+17 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+17 added−1 removed

  • tests:+5 added−0 removed
  • other:+12 added−1 removed

3 files+17 added−1 removed

modified:jinja2/parser.py+9 added-1 removed
459 unmodified lines
460 node = nodes.Const(None, lineno=token.lineno)461 else:462 node = nodes.Name(token.value, 'load', lineno=token.lineno)463 self.stream.next()464 elif token.type in ('integer', 'float', 'string'):464 elif token.type is 'string':465 self.stream.next()466 buf = [token.value]467 lineno = token.lineno468 while self.stream.current.type is 'string':469 buf.append(self.stream.current.value)470 self.stream.next()471 node = nodes.Const(''.join(buf), lineno=lineno)472 elif token.type in ('integer', 'float'):473 self.stream.next()474 node = nodes.Const(token.value, lineno=token.lineno)475 elif token.type is 'lparen':476 self.stream.next()477 node = self.parse_tuple()
294 unmodified lines
modified:tests/test_syntax.py+5 added
174 unmodified lines
175176def test_test_chaining(env):177 raises(TemplateSyntaxError, env.from_string, '{{ foo is string is sequence }}')178 env.from_string('{{ 42 is string or 42 is number }}').render() == 'True'179180181def test_string_concatenation(env):182 tmpl = env.from_string('{{ "foo" "bar" "baz" }}')183 assert tmpl.render() == 'foobarbaz'
modified:CHANGES+3 added
17 unmodified lines
18 data and something similar.1920- added :meth:`jinja2.environment.TemplateStream.dump`.2122- added support for implicit string literal concatenation.23 ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``2425Version 2.0rc126--------------27(no codename, released on July 9th 2008)28
1 unmodified line