590 Commits

Author SHA1 Message Date
Markus Ebner
59a982028e Fix #563: filesizeformat with proper accuracy 2025-08-13 12:26:25 +02:00
Guillaume Gomez
e8572f4580 Fix invalid handling of paths starting with :: 2025-08-13 11:20:49 +02:00
Guillaume Gomez
885e0f7de1 Fix wrong span context for askama variables 2025-08-12 14:54:51 +02:00
René Kijewski
1014b975cd Fix new clippy warnings 2025-08-07 20:55:28 +02:00
René Kijewski
98ad5d5b3f parser: better messages for (group) 2025-08-07 20:48:15 +02:00
René Kijewski
c0d6f0f0fc parser: a little better spans 2025-08-07 20:39:38 +02:00
René Kijewski
329771152d parser: use LocatingSlice<&str> instead of &str
This will enable better span getting in subsequent PRs.
2025-08-07 18:41:51 +02:00
René Kijewski
693f86d1c4 derive: don't use format_args! for code formatting
* No need to manually escape raw identifiers
* Allow a few warnings
2025-08-06 19:11:26 +02:00
Guillaume Gomez
80a4af7f2d Generate a TokenStream rather than a String 2025-08-06 19:11:26 +02:00
René Kijewski
1f3c926c58 parser: r#self is not a valid raw identifier in macro calls
It's not a valid raw identifier anywhere, actually, but the other cases
(in a path, as a field name, as a macro name) were already handled.

Resolves <https://issues.oss-fuzz.com/issues/435218013>.
2025-07-31 18:46:35 +02:00
René Kijewski
d670d9b91c parser: fail on unterminated byte literal
Resolves <https://issues.oss-fuzz.com/issues/433650278>.

Also, I noticed that an Unicode escape in a byte literal, e.g.
`b'\u{42}'`, was accepted when it should not have been.
2025-07-28 21:56:40 +02:00
dependabot[bot]
f0a1fa467d build(deps): update criterion requirement from 0.6 to 0.7
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.6.0...0.7.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.7.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-25 23:36:35 +02:00
Markus Ebner
48d5dba024
Fix #531: Allow named arguments in expr macro calls 2025-07-22 12:33:26 +02:00
Markus Ebner
0613a509b6
Add unit-test for #531 2025-07-22 00:58:36 +02:00
Markus Ebner
526ce78cf0
Add ui tests for named arguments in rust call expressions 2025-07-22 00:58:33 +02:00
René Kijewski
ba7b0a7967 Move DefaultFilterable into its own file 2025-07-21 22:31:05 +02:00
René Kijewski
b2b0d4cbba Add filters |default, |assigned_or and |defined_or
Also, `enum Pluralize<S, P>` is renamed into `enum Either<L, R>` and
exported.
2025-07-21 22:31:05 +02:00
Markus Ebner
1b1d604dbc Add unit-tests for #517 2025-07-21 16:55:31 +02:00
Guillaume Gomez
cf558be7e6 Add regression test for generics support in macro default value and call 2025-07-21 00:38:55 +02:00
Guillaume Gomez
fc2b0349ac Add ui test for generics on loop.cycle 2025-07-21 00:38:55 +02:00
Guillaume Gomez
6de8ff8042 Forbid string literal suffix 2025-07-21 00:35:48 +02:00
Guillaume Gomez
d8bf38978c Add fuzzing test 2025-07-20 16:27:23 +02:00
Guillaume Gomez
57554f3d42 Update tests 2025-07-20 16:27:23 +02:00
Guillaume Gomez
79d8f8886b Update to rust edition 2024 and to MSRV 1.88 2025-07-07 22:23:29 +02:00
Markus Ebner
2bd436417a
Add unit-tests for #505 2025-07-05 03:21:34 +02:00
Markus Ebner
19c685b51a
Add unit-test for #507 2025-07-05 03:21:33 +02:00
Markus Ebner
7a379df480 Add unit-tests for #508 2025-07-05 01:45:18 +02:00
René Kijewski
4f5272406f parser: replace manual i_before with .with_taken() 2025-06-24 15:02:41 +02:00
René Kijewski
edfa31f9cf parser: ensure valid paths in generics 2025-06-23 18:31:16 +02:00
René Kijewski
3f380721a2 parser: reject illegal raw identifiers in attribute access 2025-06-23 18:31:16 +02:00
René Kijewski
76b26cd5fa parser: str lit must not be followed by suffix#
Resolves <https://issues.oss-fuzz.com/issues/426509683>.
2025-06-21 19:43:28 +02:00
René Kijewski
2e510b0862 Remove normalize_identifier benchmark
The benchmark is overly specific.
2025-06-20 16:19:24 +02:00
Guillaume Gomez
1275b58ccb
Merge pull request #486 from Kijewski/pr-more-core
Filters `linebreaks`, `paragraphbreaks` and `linebreaksbr` only need `core`
2025-06-17 16:54:01 +02:00
René Kijewski
b6acf7b3a8 parser: simplify {# comment #} parsing
`winnow`'s `take_until` with feature `simd` enabled is implemented like
our "optimized" `skip_till`. There is no need to reinvent the wheel.
2025-06-16 23:49:58 +02:00
René Kijewski
568ced0c55 parser: recognize comments in macro calls
Fixes issue <https://issues.oss-fuzz.com/issues/425145246>
2025-06-16 23:49:47 +02:00
Guillaume Gomez
e329f98433
Merge pull request #484 from Kijewski/pr-u+10ffff
parser: U+10FFFF is the highest Unicode codepoint
2025-06-16 16:50:36 +02:00
René Kijewski
b9490c4b5d Filter paragraphbreaks only needs core 2025-06-14 14:57:55 +02:00
René Kijewski
00b640c93b parser: better error message for bare CRs 2025-06-13 22:19:17 +02:00
René Kijewski
9ffa6b954c parser: U+10FFFF is the highest Unicode codepoint
Fix a small typo: parsing '\u{123456}` should parse up to 6 characters,
inclusively.
2025-06-13 11:32:51 +02:00
René Kijewski
341b850351 parser: reject isolated CRs in string literals
According to <https://doc.rust-lang.org/reference/tokens.html#string-literals>.

Fixes <https://github.com/askama-rs/askama/issues/482>.
Fixes <https://issues.oss-fuzz.com/issues/424227903>.
2025-06-13 06:17:12 +02:00
René Kijewski
50e0a96481 Rename LoopItem::index to LoopItem::index0
That's what the element is called in the template syntax.

Also refactor `Generator::visit_attr()` at bit to make it more readable.
Also add `__askama` prefix to `_len`.
2025-06-11 18:53:42 +02:00
René Kijewski
532e343c40 parser: reject illegal string literals 2025-06-09 19:24:08 +02:00
René Kijewski
66ce299a4a parser: in macro calls reject cstrings with NULs 2025-06-09 19:24:07 +02:00
Michael Pollind
df54534ae6 bugfix: resolve with macro with call after caller
https://github.com/askama-rs/askama/issues/467

Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-06-01 21:05:06 +02:00
Guillaume Gomez
741ff53a88 Add regression tests for mutable variables 2025-06-01 16:26:57 +02:00
Guillaume Gomez
9ee2afecfa Add support for mutable variables 2025-06-01 16:26:57 +02:00
René Kijewski
377253945e crate! etc are invalid macro names 2025-05-23 21:01:00 +02:00
Guillaume Gomez
657dcea10f
Merge pull request #422 from pollend/feature/add-support-for-caller
feat: add caller pattern from jinja
2025-05-23 13:57:18 +02:00
René Kijewski
eaccbb02ae Comparison operators cannot be chained 2025-05-23 01:26:19 +02:00
Guillaume Gomez
1acbc33383 Improve error output 2025-05-22 23:11:46 +02:00