Guillaume Gomez
27e12f083b
Add UI tests for top level nodes
2024-07-02 22:15:02 +02:00
René Kijewski
145127e241
Merge pull request #40 from GuillaumeGomez/rename-as_ref
...
Rename `as_ref` filter into `ref`
2024-07-02 15:49:17 +02:00
Guillaume Gomez
6c46e4f7b8
Update tests about methods use
2024-07-02 13:44:27 +02:00
René Kijewski
79e747a28a
Merge pull request #39 from GuillaumeGomez/ref-deref-ops
...
Allow to use `*` and `&` in expressions
2024-07-02 02:03:25 +02:00
Guillaume Gomez
e5a3e1c763
Add regression test for *
and &
in expressions
2024-07-01 21:11:41 +02:00
Guillaume Gomez
b37e7d3703
Rename as_ref
filter into ref
2024-07-01 21:09:18 +02:00
Guillaume Gomez
62bbece0aa
Add regression test to prevent moving variables
2024-07-01 18:05:16 +02:00
René Kijewski
f4ccdb6585
Better information that ..
must come last in a named struct
2024-06-28 23:32:13 +02:00
René Kijewski
0d8373e3b2
Linted
2024-06-28 23:06:21 +02:00
René Kijewski
cf4f514d7e
Move passing tests
2024-06-28 23:03:22 +02:00
René Kijewski
6b8b97672a
Better error message on missing comma
2024-06-28 22:48:45 +02:00
Guillaume Gomez
6ee3765098
Add regression test for ..
pattern in structs
2024-06-28 05:25:21 +02:00
René Kijewski
e94525f483
Add support for ..
in let pattern matching for structs
2024-06-28 05:25:21 +02:00
René Kijewski
dcabf0cf1a
feature: serde-json → serde_json
2024-06-27 14:25:22 +02:00
René Kijewski
64a8094aaf
Split pretty and ugly JSON filter impl
2024-06-27 14:25:22 +02:00
René Kijewski
f7710a94d6
Add "json: too many args" ui test
2024-06-25 00:42:28 +02:00
René Kijewski
462c04c0a0
Make JSON prettifying optional
...
This PR adds an optional argument to the `|tojson` filter, which
controls if the serialized JSON data gets prettified or not. The
arguments works the same as flask's [`|tojson`][flask] filter, which
passes the argument to python's [`json.dumps()`][python]:
* Omitting the argument, providing a negative integer, or `None`, then
compact JSON data is generated.
* Providing a non-negative integer, then this amount of ASCII spaces is
used to indent the data. (Capped to 16 characters.)
* Providing a string, then this string is used as prefix. I attempts are
made to ensure that the prefix actually consists of whitespaces,
because chances are, that if you provide e.g. `&nsbp;`, then you are
doing it intentionally.
This is a breaking change, because it changes the default behavior to
not prettify the data. This is done intentionally, because this is how
it works in flask.
[flask]: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.tojson
[python]: https://docs.python.org/3/library/json.html#json.dump
2024-06-25 00:12:25 +02:00
Guillaume Gomez
fd1108c4bc
Merge pull request #18 from Kijewski/pr-iso646
...
Use ISO 646 alternative operators for bit ops + proper error messages for spaces around the `|filter` operator
2024-06-24 14:04:53 +02:00
Guillaume Gomez
1f1cff059d
Update ui tests
2024-06-23 20:55:23 +02:00
René Kijewski
50ac555684
Remove helper functions
2024-06-23 20:55:00 +02:00
René Kijewski
fb4d8a6073
Better error message for space + filter
2024-06-23 20:54:28 +02:00
René Kijewski
879d889bb2
Use ISO 646 alternative operators for bit ops
...
This change allows simplifying the use of filter expressions, because
you won't have to care about spaces around the `|` pipe operator.
2024-06-23 20:47:27 +02:00
manunio
4dee4e747f
Update recursion ui error
...
I think previous input for filter-recursion ui test was not right as it
was not triggering error for recursion itself, for example:
```rust
fn fuzzed_filter_recursion() {
const TEMPLATE: &str = include_str!("../tests/filter-recursion.txt");
if let Err(e) = Ast::from_str(TEMPLATE, None, &Syntax::default()) {
panic!("{e}");
}
}
```
```sh
---- tests::fuzzed_filter_recursion stdout ----
thread 'tests::fuzzed_filter_recursion' panicked at rinja_parser/src/tests.rs:1121:9:
failed to parse template source at row 1, column 255 near:
"|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A"...
```
2024-06-23 20:24:24 +05:30
Guillaume Gomez
ddc75d6d84
Merge pull request #21 from Kijewski/pr-explicit-features
...
Only use explicit features
2024-06-20 20:00:48 +02:00
René Kijewski
bf93f4a755
serde-json
is actually called serde_json
2024-06-20 19:03:04 +02:00
Guillaume Gomez
fc1d52d604
Add more tests for recursion errors
2024-06-20 18:53:14 +02:00
Guillaume Gomez
e2eb76b860
Fix block partial rendering
2024-06-17 18:33:34 +02:00
Guillaume Gomez
870565eb8e
Update ui tests
2024-06-17 17:18:55 +02:00
Guillaume Gomez
2d80cc3524
Rename everything to rinja
2024-06-17 15:58:52 +02:00
Guillaume Gomez
34f84dc10f
Add support for elif
( #1057 )
...
Co-authored-by: René Kijewski <rene.kijewski@fu-berlin.de>
2024-05-23 14:27:42 +02:00
René Kijewski
38a2a86e55
Better error messages for truncated files
2024-05-17 18:29:47 +02:00
René Kijewski
a03a06c338
Add unclosed node ui tests
2024-05-17 18:29:47 +02:00
René Kijewski
2b4f264d5a
Better error message for break/continue
2024-05-16 13:50:49 +02:00
René Kijewski
e605478076
Better error message for {% macro super %}
2024-05-16 13:50:49 +02:00
René Kijewski
33f823d582
Add {% macro super %}
test
2024-05-16 13:50:49 +02:00
Guillaume Gomez
4d237ab274
Fix new rustc lints
2024-05-16 13:47:02 +02:00
Guillaume Gomez
dd6b6be435
Fix wrong handling of nested templates with block
2024-05-16 13:47:02 +02:00
Guillaume Gomez
cefa443839
Remove "unused type" warnings in tests
2024-05-02 20:34:12 +02:00
Guillaume Gomez
ed512051cf
Add deref
builtin filter
2024-05-02 20:34:12 +02:00
René Kijewski
5955ba23c1
Remove obsolete trybuild outputs
...
The current main branch does not compile with rust 1.58 or earlier
anyway.
2024-04-29 08:33:32 +02:00
Guillaume Gomez
c6d0ba8dbc
Add checks for chars
2024-04-26 16:50:12 +02:00
Guillaume Gomez
bd0bfaa95c
Add test for block imports access
2024-04-25 11:09:02 +02:00
wrapperup
1347d36363
Add support for rendering a single block
2024-04-25 10:44:58 +02:00
Guillaume Gomez
3e5ccaeea5
Add more tests for floating parsing
2024-04-24 14:46:43 +02:00
René Kijewski
c48532fb17
Implement Render
even if parsing failed
...
This makes error messages much more readable.
2024-04-18 12:54:15 +02:00
René Kijewski
c9a2254e58
Fix expected error message in UI test
2024-04-17 13:40:41 +02:00
Guillaume Gomez
ad73f755e9
Correctly handle whitespace character(s) on filter blocks
2024-04-12 17:23:42 +02:00
Andreas
8e067322fe
Fix typo in regression test causing the wrong thing to be tested
2024-04-11 21:16:32 +02:00
Guillaume Gomez
7f6beca8a8
Add UI regression tests for cyclic dependencies
2024-04-11 20:39:29 +02:00
Guillaume Gomez
66b53eecaf
Remove markdown
filter and comrak
dependency
2024-04-06 23:07:30 +02:00