464 Commits

Author SHA1 Message Date
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
Guillaume Gomez
45ae8daba4 Move cfg(not(windows)) at the top of tests/ui.rs 2024-04-05 12:13:54 +02:00
Guillaume Gomez
0b4b7d6345 Improve error message by providing the file where the error occurred if it is not an inlined source 2024-04-05 12:13:54 +02:00
Guillaume Gomez
353304ca34 Fix tests warnings 2024-03-12 16:28:20 +01:00
Guillaume Gomez
ad97dc1d2a Add test for filter block chaining 2024-03-11 14:25:46 +01:00
René Kijewski
5149cd9307 Implement Template for &Template
`Template` does not have methods that alter `self` is any way, so a
reference to a `Template` can implement `Template`, too.
2024-03-07 16:35:56 +01:00
Guillaume Gomez
1810047b1e Add test for filter block 2024-03-07 11:33:34 +01:00
Guillaume Gomez
585a992246 Add ui test for extends error 2024-01-22 17:13:01 +01:00
Dirkjan Ochtman
79738ff238 Fix support for mixed case variables 2024-01-18 11:23:18 +01:00
max
5cad82f38e Allow included templates to extend, import, and macro
Signed-off-by: max <gmx.sht@gmail.com>
2024-01-17 17:58:53 +01:00
Guillaume Gomez
12e178ce40 Add test for as_ref builtin filter 2024-01-12 10:38:15 +01:00
Guillaume Gomez
1ee067f2b6 Revert "Add automatic borrowing to let statement"
This reverts commit 3d52283b74573af509deb3c47cbabf7b7b58b1dd.
2024-01-10 10:42:31 +01:00
Jakub Stachurski
50c64bc865 Make the markdown filter compatible with String
This commit solves issue #719.

This is done by making the markdown filter borrow the string and
simplifying the filter to accept `&str` instead of `AsRef<str>`

Add test for the markdown filter using  as input

Revert markdown filter changes

Revert unnecessary changes

Improve test_markdown_owned_string test

Use cargo fmt
2024-01-09 21:23:47 +01:00
max
3d52283b74 Add automatic borrowing to let statement
Signed-off-by: max <gmx.sht@gmail.com>
2023-12-13 16:47:02 +01:00
max
28182a1549 Bugfix in is_attr_self()
Signed-off-by: max <gmx.sht@gmail.com>
2023-12-13 16:47:02 +01:00
Guillaume Gomez
e4b8ca3c44 Allow trailing comma in macro definition and call 2023-12-07 11:03:26 +01:00
Guillaume Gomez
b5797cba88 Add macro test with only argument being passed as named 2023-12-07 09:10:32 +01:00
Dirkjan Ochtman
69e2db6efa Upgrade to comrak 0.19 2023-11-30 13:33:06 +01:00
Guillaume Gomez
28e26751ce Add tests for named arguments in macro calls 2023-11-28 11:36:09 +01:00
PizzasBear
696561003d
Add better support for rust-like number literals (#908)
Signed-off-by: max <gmx.sht@gmail.com>
2023-11-22 16:09:33 +01:00
PizzasBear
48c6cd327d
Enhance match to include multiple targets (#911)
Signed-off-by: max <gmx.sht@gmail.com>
2023-11-22 14:56:14 +01:00
Guillaume Gomez
ea7267dfc2 Add UI tests for macros error message 2023-11-20 10:34:26 +01:00
Guillaume Gomez
77d5d28b20 Add UI test for elif error message 2023-10-25 14:54:14 +02:00
Guillaume Gomez
c056d6287b Improve error for invalid name used in endmacro 2023-10-25 14:30:35 +02:00
Guillaume Gomez
c3281e353d Improve error for invalid name used in endblock 2023-10-25 14:30:35 +02:00
Guillaume Gomez
a7f5186bf4 Add test specifically for named blocks, and named macros 2023-10-23 15:13:27 +02:00
max
5ee2dfbe6b Add test for macro self argument
Signed-off-by: max <gmx.sht@gmail.com>
2023-10-12 13:57:48 +02:00
René Kijewski
eef38cea67 Pass Node parsing level to expressions 2023-09-28 17:28:26 +02:00
René Kijewski
238e4bbad7 Limit nesting in parser nodes, too 2023-09-28 17:28:26 +02:00
René Kijewski
985eb8955f Fix parsing arrays
This change

* allows using empty arrays `[]` in expessions,
* adds a cut when the leading `[` was encountered, and
* fixes the interaction between arrays and boolean OR.

IMO the restriction that you couldn't use empty arrays is not needed.
The missing cut made error messages slictly worse if you forget to add
the closing `]`.

Filter expressions must not have white spaces before the pipe `|`. The
white space is used to tell a filter expressions, and `std::ops::Or`
apart.
2023-07-31 21:29:35 +02:00
René Kijewski
107bdfdd76 Fix parsing calls
This change:

* adds a cut when the leading `(` was encountered, and
* fixed the interaction between call expressions and boolean OR.
2023-07-31 21:29:35 +02:00
Matthew Taylor
ac8de6260e
Fix Rust macro invocations not accepting a path (#837) 2023-07-24 11:39:14 +02:00
mataha
cba1fb8e50 Allow macros to be defined and called without arguments
This commit introduces a shorthand for defining and calling macros when
using them as a reusable substitute for variables assigned complex values
(e.g. string literals with or without newline escapes). The use-case is
formatting - from my experience it's easier to visually parse a `macro`
`endmacro` block than a multiline variable assignment.

Signed-off-by: mataha <mataha@users.noreply.github.com>
2023-06-12 10:35:40 +02:00
Guillaume Gomez
40be079d5d Add tests for whitespace argument in template derive proc-macro 2023-03-13 14:41:05 +01:00
Guillaume Gomez
4233b3114f Update tests for whitespace characters handling 2023-03-09 13:35:00 +01:00
Andrew Dona-Couch -- GitHub drop ICE
dc864486ec
Propogate size_hint from sub-blocks (#788)
Closes #786
2023-03-06 22:18:45 +01:00
Dirkjan Ochtman
3003d86264
Apply clippy suggestions for 1.67 (#769) 2023-01-30 09:51:23 +01:00
René Kijewski
23326b4765 Update ui test for trybuild 1.0.76
In <https://github.com/dtolnay/trybuild/pull/219> the output of error
messages was subtly changed, because they introduced a subdirectoy in
their temp path.

This PR fixes the mismatch between the expected and the actual output.
2023-01-24 09:55:54 +01:00
Dirkjan Ochtman
6f52d0eef5 chore: remove allow(clippy::disallowed_names) 2022-11-07 11:14:43 +01:00
Dirkjan Ochtman
ee4dbf0d8d chore: apply clippy suggestions for 1.65 2022-11-07 11:14:43 +01:00
René Kijewski
16a37f4097 Remove support for deprecated _parent field
The support for the magic `_parent` field is deprecated since v0.8.0
or issue #180. It's bothersome to keep this feature alive, when no-one
should be using it for 3 years.
2022-07-25 11:41:04 +02:00
Bastien Orivel
ea66be1925 Allow {% endmacro name %}
Just migrated a repo from tera to askama and this was one of the only
things that was different. This is also coherent with `{% block %}` for
which I added the same feature years ago.
2022-04-29 13:35:20 +02:00
Guillaume Gomez
07cee10876 Add test for "minimize" config 2022-04-26 10:15:34 +02:00