2606 Commits

Author SHA1 Message Date
Dirkjan Ochtman
adda8de2cd Escape all strings with character entities by default (fixes #23) 2017-09-04 20:37:12 +02:00
Dirkjan Ochtman
fdbe45ec60 Move escaping algorithm into a separate module 2017-09-04 20:37:05 +02:00
Dirkjan Ochtman
23279c3bce Move filter list closer to the actual filters, add docs 2017-09-04 20:31:28 +02:00
Dirkjan Ochtman
32a9dd5f2e Moved precedence test into operators module 2017-09-04 20:31:28 +02:00
Dirkjan Ochtman
6145cb5a48 Clean up and tighten faster version of expr_prec_layer macro 2017-09-04 20:31:28 +02:00
Dirkjan Ochtman
9a21f5eaa3 Tighten up code for join filter handling 2017-09-04 20:31:28 +02:00
Lars Erik Rosengren
986535fc95 Changed implementation of precedence rules
This implementation resolves djc/askama#44 by changing the precedence
implementation.
The previous solution was very slow because it had to try to parse
all combinations of precedence layers leading to 2^9 iterations for each
expr_any. This is solved by reusing the left operand instead of reparsing
it when the operator isn't found.

This implementation also solves another related issue that expressions
with multiple operators couldn't be parsed, for example {{1 * 2 * 3}}.
This is handled by using expr_any for the right operand instead of only
using higher level precedence layers.
2017-09-03 19:08:53 +02:00
defyrlt
7d2d7718aa Add join filter & tests for it 2017-09-02 13:34:52 +02:00
defyrlt
b0ea82d87a Refactor visit_filter to allow easier customization 2017-09-02 13:34:52 +02:00
Anthony Nowell
2fe5cfa998 Export Error type 2017-08-29 09:28:56 +02:00
Dirkjan Ochtman
9f3b590206 Move most of the code into new askama_shared crate
This makes it possible to share code between askama and askama_derive.
2017-08-27 22:10:42 +02:00
Bastien Orivel
aeac47cee0 Add test for parent default block implementations 2017-08-25 13:29:34 +02:00
Dirkjan Ochtman
fc7be3c927 Use block implementations in parent as defaults in trait 2017-08-25 13:23:55 +02:00
defyrlt
42e854809a Add unwrap() to the hello world example in README 2017-08-25 07:01:09 +02:00
Dirkjan Ochtman
201a2cb2a2 Simplify Rocket test slightly 2017-08-24 20:47:24 +02:00
Bastien Orivel
5f0ff4726d Allow {% block name %} {% endblock name %}
This makes converting an app from tera to askama easier.
2017-08-24 20:25:35 +02:00
Dirkjan Ochtman
c8b14c6d0d Add test case for user-defined filters 2017-08-24 20:22:32 +02:00
Dirkjan Ochtman
1c9066f9b4 Add support for user-defined filters 2017-08-24 20:22:23 +02:00
Dirkjan Ochtman
e530ec879a Clean up order in Cargo manifests 2017-08-24 20:16:39 +02:00
Dirkjan Ochtman
e030066106 Add test for Rocket support 2017-08-23 20:55:45 +02:00
Dirkjan Ochtman
bf51e7264f Add optional support for Rocket 2017-08-23 20:50:52 +02:00
Dirkjan Ochtman
d8041c00fe Allow passing extra annotation parameters to impl headers 2017-08-23 20:46:59 +02:00
Dirkjan Ochtman
40775d8c88 Add test for Iron support 2017-08-23 20:43:11 +02:00
Dirkjan Ochtman
e9046c46b7 Optionally implement Iron's Modifier<Response> for templates 2017-08-23 20:42:46 +02:00
Dirkjan Ochtman
57a10a789e Forgot to remove debugging cruft, again 2017-08-23 12:43:53 +02:00
Anthony Nowell
2d6785b714 Adding optional json filter 2017-08-23 12:40:14 +02:00
Dirkjan Ochtman
d0a3d51dcd Add test for basic macro use 2017-08-22 20:22:33 +02:00
Dirkjan Ochtman
26a000cd9e Add support for calling macros 2017-08-22 20:22:33 +02:00
Dirkjan Ochtman
544f9b1192 Refactor parser handling of arguments 2017-08-22 20:22:33 +02:00
Dirkjan Ochtman
3652708020 Implement support for macro definition handling 2017-08-22 20:22:33 +02:00
Dirkjan Ochtman
770b12cc22 Rename method call internals for clarity 2017-08-22 20:22:33 +02:00
Dirkjan Ochtman
ec5a2ebbb3 Change filters to return Result 2017-08-21 20:59:25 +02:00
Dirkjan Ochtman
4f4b5a3a65 Change one test case to use source attribute 2017-08-16 21:04:52 +02:00
Dirkjan Ochtman
ddbed4d807 Support specifying template source as an attribute 2017-08-16 21:04:43 +02:00
Dirkjan Ochtman
ffcbcd9f19 Pass path to code generation as Path 2017-08-16 21:01:08 +02:00
Dirkjan Ochtman
f15da8ba3e Change find_template_from_path() to take Path as start_at argument 2017-08-16 20:51:49 +02:00
Dirkjan Ochtman
7efd70297d Simplify relative path handling in find_template_from_path() 2017-08-16 20:40:34 +02:00
Dirkjan Ochtman
39b9e6e491 Use reference into AST for template path instead of cloning 2017-08-16 20:38:58 +02:00
Dirkjan Ochtman
5548cb1f4a Use enum for print option value 2017-08-16 20:38:58 +02:00
Dirkjan Ochtman
d7ac0825e0 Add test for variable declaration 2017-08-16 12:51:11 +02:00
Dirkjan Ochtman
05597b61da Allow separation of variable declaration and defintion 2017-08-16 12:50:52 +02:00
Dirkjan Ochtman
fb11c175b2 Add test for let blocks 2017-08-15 07:47:02 +02:00
Dirkjan Ochtman
34fd0c07de Add support for simple variable definition statements 2017-08-14 22:01:53 +02:00
Dirkjan Ochtman
9552bd5040 Introduce and clean up scopes where necessary 2017-08-14 22:01:02 +02:00
Dirkjan Ochtman
d83959d976 Assert invariant for SetChain implementation 2017-08-14 20:40:48 +02:00
Dirkjan Ochtman
5f3e93da3f Use error-chain to create a crate-specific Error type 2017-08-14 12:57:01 +02:00
Dirkjan Ochtman
69c447f0c7 Remove Cargo.lock
Apparently library crates generally don't include this in their repositories.
2017-08-14 12:28:06 +02:00
Dirkjan Ochtman
9dcba34f0d Define type askama::Result to use for all rendering methods 2017-08-14 12:22:48 +02:00
Anthony Nowell
0b814fd0fa Generate with full path to Result 2017-08-13 10:43:34 +02:00
Dirkjan Ochtman
8bda0d64d5 Inline scope tracking abstraction again 2017-08-10 21:49:15 +02:00