330 Commits

Author SHA1 Message Date
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
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
dependabot[bot]
19a01de03f build(deps): update comrak requirement from 0.21 to 0.22
Updates the requirements on comrak to permit the latest version.

---
updated-dependencies:
- dependency-name: comrak
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 13:34:05 +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
Dirkjan Ochtman
6cd72ec54c Bump versions for semver-incompatible release 2024-03-05 11:34:09 +01:00
dependabot[bot]
c2c9bd8170 build(deps): update comrak requirement from 0.20 to 0.21
Updates the requirements on comrak to permit the latest version.

---
updated-dependencies:
- dependency-name: comrak
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-26 09:38:45 +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
René Kijewski
3cddb91889
Generator: make normalize_identifier faster (#946)
`normalize_identifier` is called quite often in the generator, once for
every variable name or path element that is written.

This PR aims to speed up the function by

* using a per-length input string length replacement map
* binary searching the replacement map instead of a linear search

Diffent, but functionally equivalent implementations were compared:

```text
* linear search in one big map:      348.44 µs
* binary search in one big map:      334.46 µs
* linear search in a per-length map: 178.84 µs
* binary search in a per-length map: 154.54 µs
* perfect hashing:                   170.87 µs
```

The winner of this competition is "binary search in a per-length map".
It does not introduce new dependencies, but has the slight disadvantage
that it uses one instance of `unsafe` code. I deem this disadvantage
acceptable, though.

Nb. It was also tested if a variant that only stores the replaced string
would be faster. This "optimization" proved to be slower for all
implementations except "binary search in a per-length map", for which it
has the same runtime. Without a clear advantage to use the "optimized
version", I chose to use the more easy to read slice of tuples variant.

Obviously, for all measurements: YMMV.
2024-01-12 20:41:46 +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
dependabot[bot]
736480c38b build(deps): update comrak requirement from 0.18 to 0.20
Updates the requirements on [comrak](https://github.com/kivikakk/comrak) to permit the latest version.
- [Release notes](https://github.com/kivikakk/comrak/releases)
- [Changelog](https://github.com/kivikakk/comrak/blob/main/changelog.txt)
- [Commits](https://github.com/kivikakk/comrak/compare/0.18.0...0.20.0)

---
updated-dependencies:
- dependency-name: comrak
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-30 13:55:46 +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