summaryrefslogtreecommitdiff
path: root/jinja2/parser.py
Commit message (Collapse)AuthorAgeFilesLines
* use "Jinja" instead of "Jinja2"David Lord2019-10-231-2/+2
|
* BUGFIX #930 - Template parse if with when referencing with dictionary ↵eplata312019-05-131-1/+3
| | | | subproperty
* parser: Fix typo `self.lineno` -> `token.lineno`Tornike Gogniashvili2018-10-291-1/+1
|
* More closely match python splatting for callsToshio Kuratomi2018-01-291-2/+4
| | | | | | | | | | | | | | | | | | In Python, it's legal to use splats in function calls like this: call_function('123', *b, c=5, **d) Prior to this change, jinja2 did not allow that. It mandated that all splatting had to take place at the end of the call: call_function('123', c=5, *b, **d) This commit allows both orders. Additionally, this commit adds tests for more things that are illegal: namely giving a function a positional argument after using a splat to unpack positional arguments or giving a function a named argument after using a double splat to unpack keyword arguments.
* Support filters in set blockThiefMaster2017-10-311-1/+2
| | | | | - e.g {% set foo | trim %}...{% endset %} - closes #486
* Merge branch '2.9-maintenance'Adrian Moennich2017-08-221-7/+6
|\
| * Compile `elif` tag to `elif` instead of `else: if`2.9-maintenanceAdrian Moennich2017-08-221-7/+6
| | | | | | | | | | | | | | | | This avoids deep nesting in case of many `{% elif .. %}` blocks (which would fail during execution) and also deep recursion (which may fail during compilation) fixes #759
* | Don't skip an erroneous comma when parsing fromJack Wilsdon2017-07-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we skip an extra comma when "with context" is not provided to the "from" statement. This allows invalid code such as this: {% from "functions.html" import my_function,, %} The primary issue with this is that it is not consistent when providing "with context". The following code throws an error, contrary to the previous example: {% from "functions.html" import my_function,, with context %} It seems that the comma skipping was originally found in 0611e49 and was accidentally put inside the "with context" check in ea847c5. It was then updated to use "skip_if" in fdf9530. There doesn't seem to be any reason for this check existing, as double commas should never be allowed and serve no purpose in the statement.
* | Add stricter checking to "from ... import ..."Jack Wilsdon2017-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently token parsing on "from ... import ..." is rather "loose" — it sees the following "invalid" code as perfectly valid: {% from "functions" import my_function, %} {% from "functions" import, %} {% from "functions" import %} This is caused by the parser ignoring non-name values where there should be names, either as the first value or after commas. This commit ensures only name values are allowed as the first value and any values after commas in the import section.
* | Add support for namespace attribute assignmentAdrian Moennich2017-06-241-4/+10
|/
* Implement with-tag with a custom nodeArmin Ronacher2017-01-081-8/+11
|
* Bump up the copyright to 2017Armin Ronacher2017-01-071-1/+1
|
* Move the autoescape extension and with statement to be built-inArmin Ronacher2017-01-071-1/+26
|
* Change grouping behavior of tests. This fixes #401Armin Ronacher2017-01-071-1/+1
|
* Fixed long standing wrong operator precedenceArmin Ronacher2016-12-281-52/+23
|
* Disallow f(x, y=1, z) and similar nonsenseThiefMaster2015-02-061-0/+2
| | | | | | | | | | | | | | | | | | Python rejects such function definitions because it doesn't make much sense to have arguments with no default values after arguments with default values. Jinja did allow them, but handled them improperly (associating the default value with the wrong argument). Due to how broken the current behavior is, it makes more sense to reject templates containing such defintions instead of trying to handle them properly. Both cases are going to break existing code containing such definitions, but besides the fact that possibly no such code exists it is better to fail with a clear error than to silently change the values of arguments. This fixes #364
* Implemented a block set tag.Armin Ronacher2014-06-071-3/+6
|
* Flake 8 fixesArmin Ronacher2014-06-061-9/+8
|
* Since we no longer support 2.5 we can use the builtin next() functionArmin Ronacher2013-05-201-1/+1
|
* six.advance_iterator -> nextArmin Ronacher2013-05-191-50/+49
|
* Remove unused importsDaniel Neuhäuser2013-05-181-1/+1
|
* python 3 port: manual fixes, remove 2to3 from setup.py, remove fixersThomas Waldmann2013-05-181-50/+49
|
* python 3 port: automated changes by a slightly modified python-modernizeThomas Waldmann2013-05-171-0/+2
| | | | (replacing unicode with six.text_type, but not replacing u"" by six.u(""))
* unused codeDmitry Jemerov2011-09-261-1/+0
|
* couple of typos in commentsDmitry Jemerov2011-09-261-1/+1
|
* fixed an operator precedence error introduced in 2.5.2.2.5.3Armin Ronacher2010-10-171-4/+18
| | | | | | Statements like "-foo.bar" had their implicit parentheses applied around the first part of the expression ("(-foo).bar") instead of the more correct "-(foo.bar)".
* fixed an issue with unary operators having the wrong precendence.2.5.1Armin Ronacher2010-08-171-12/+12
| | | | | --HG-- branch : trunk
* Added extension ordering, this fixes #376.Armin Ronacher2010-04-121-1/+1
| | | | | --HG-- branch : trunk
* This fixes #368.Armin Ronacher2010-02-111-9/+14
| | | | | --HG-- branch : trunk
* Further error message improvement, this time for #341.Armin Ronacher2010-02-071-0/+9
| | | | | --HG-- branch : trunk
* implicit tuple expressions can no longer be totally empty.Armin Ronacher2010-02-061-4/+19
| | | | | | | | This change makes ``{% if %}...{% endif %}`` a syntax error now. (#364) --HG-- branch : trunk
* greatly improved error message reporting. This fixes #339Armin Ronacher2010-02-061-36/+105
| | | | | | --HG-- branch : trunk extra : rebase_source : d8f677273490fa73d5603b68478fa3b54f60ccb9
* It's a new yearArmin Ronacher2010-01-221-1/+1
| | | | | --HG-- branch : trunk
* More Python 3 support.Armin Ronacher2009-08-051-47/+48
| | | | | --HG-- branch : trunk
* Added support for optional `scoped` modifier to blocks.Armin Ronacher2009-02-191-0/+1
| | | | | --HG-- branch : trunk
* Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.Armin Ronacher2009-02-051-1/+1
| | | | | --HG-- branch : trunk
* Priority of `not` raised. It's now possible to write `not foo in bar`Armin Ronacher2009-02-041-6/+8
| | | | | | | | as an alias to `foo not in bar` like in python. Previously the grammar required parentheses (`not (foo in bar)`) which was odd. --HG-- branch : trunk
* This commit makes the parser and lexer use regular string comparison to ↵Ali Afshar2009-01-051-52/+52
| | | | | | | support jython --HG-- branch : trunk
* Copyright switch to "The Jinja Team".Armin Ronacher2009-01-041-1/+1
| | | | | --HG-- branch : trunk
* Include statements can now be marked with ``ignore missing`` to skipArmin Ronacher2008-12-271-0/+6
| | | | | | | non existing templates. --HG-- branch : trunk
* Added support for `Environment.compile_expression`.Armin Ronacher2008-11-021-2/+3
| | | | | --HG-- branch : trunk
* Fixed a bug with the loop context of a for loop if the iterator passed has a ↵Armin Ronacher2008-07-041-2/+4
| | | | | | | volatile `__len__` like the listreverseiterator. `else` in inline if-expressions is optional now. --HG-- branch : trunk
* added support for implicit string literal concatenationArmin Ronacher2008-06-221-1/+9
| | | | | --HG-- branch : trunk
* added support for token stream filtering and preprocessing.Armin Ronacher2008-06-131-2/+1
| | | | | --HG-- branch : trunk
* Fixed a broken unittest and fixed a bug that required multiple tests to be ↵Armin Ronacher2008-06-121-1/+5
| | | | | | | put into parentheses for chaning. --HG-- branch : trunk
* Improved attribute and item lookup by allowing template designers to express ↵Armin Ronacher2008-06-121-6/+10
| | | | | | | the priority. foo.bar checks foo.bar first and then foo['bar'] and the other way round. --HG-- branch : trunk
* some more documentation updates and minor code cleanups. Additionally True ↵Armin Ronacher2008-05-281-3/+4
| | | | | | | and true in the template are the same now, same for false/False and none/None. --HG-- branch : trunk
* fixed a bug in error reporting and some small documentation updatesArmin Ronacher2008-05-261-2/+2
| | | | | --HG-- branch : trunk
* even more tests, fixed severe bug with autoescaping.Armin Ronacher2008-05-251-1/+2
| | | | | --HG-- branch : trunk
* all calls are proxied by context.call now so that we can inject environment ↵Armin Ronacher2008-05-251-0/+1
| | | | | | | and context as first arguments. This slows calls down a bit but is a lot more user friendly. Added first draft of FAQ --HG-- branch : trunk