2445 Commits

Author SHA1 Message Date
René Kijewski
66ce299a4a parser: in macro calls reject cstrings with NULs 2025-06-09 19:24:07 +02:00
René Kijewski
478d72614e filter reject is not HTML safe 2025-06-06 15:48:04 +02:00
René Kijewski
72b9005cb5 filter: modify reject a bit
* Re-use iterator getting from `{% for %}`'s implementation
* Don't use edition 2024 features
2025-06-06 15:48:04 +02:00
Guillaume Gomez
36fd13d3b2 Apply suggestions 2025-06-06 15:48:04 +02:00
Guillaume Gomez
c6aa9b2e83 Add new reject filter 2025-06-06 15:48:04 +02:00
Guillaume Gomez
c8acf8b270
Merge pull request #476 from Kijewski/issue-475
parser: recognize/reject prefixed ids and lits in macro calls
2025-06-05 21:23:09 +02:00
René Kijewski
d181493084 Fix clippy warning 2025-06-05 18:45:51 +02:00
René Kijewski
d531c96d13 parser: recognize/reject prefixed ids and lits in macro calls 2025-06-05 18:44:02 +02:00
René Kijewski
9bf41656a4 ci: some fixes
* forgot to update source folder in [#473]
* documentation creation was not checked for `askama_escape`
* cluster-fuzz could not [upload sarif file] that contained its outcome
* let all fuzzers run for the same amount of time

[#473]: <https://redirect.github.com/askama-rs/askama/pull/473>
[upload sarif file]: <https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github>
2025-06-03 14:48:37 +02:00
René Kijewski
3a52a2a1c7 book: document all crates on readthedocs 2025-06-03 14:10:26 +02:00
Guillaume Gomez
47c04fca0b
Merge pull request #470 from Kijewski/pr-dedup-filter-with-path
derive: dedupe visit custom filters code
2025-06-02 21:31:14 +02:00
Guillaume Gomez
c2f73a2de1
ci: don't collect filter output into String (#471)
We don't have to care if the output is big. If the user calls a filter
with a big input, then they should know that the output will probably be
even bigger.
2025-06-02 21:30:44 +02:00
René Kijewski
96796cb1aa ci: don't collect filter output into String
We don't have to care if the output is big. If the user calls a filter
with a big input, then they should know that the output will probably be
even bigger.
2025-06-02 00:40:43 +02:00
René Kijewski
988b643c20 derive: dedupe visit custom filters code 2025-06-01 23:56:10 +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
René Kijewski
0e30499f59 ci: update fuzzing corpus to include derive 2025-06-01 19:14:28 +02:00
René Kijewski
ca50787f92 parser: macro calls need proper tokens
With this PR invalid tokens inside a macro call `macro_name!(..)` are
rejected. Otherwise we might emit invalid code that cannot be parsed by
rust.
2025-06-01 19:14:28 +02:00
Guillaume Gomez
6010cd390f Add documentation for mutable variables 2025-06-01 16:26:57 +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
strickczq
c40e828f03 fix fmt and clippy 2025-05-29 19:00:50 +02:00
strickczq
77b0763679 Track first line across calls and add tests
Fix logic issue where `self.first` was not tracked across calls, causing incorrect indentation.

Replaced `idx` with `is_first_line` flag.

Added `test_indent_chunked` to verify correct behavior.
2025-05-29 19:00:50 +02:00
strickczq
6653662d9e book: remove alloc feature mention for indent filter
Updated the "filters" chapter in the book to remove the mention of the alloc feature requirement for the indent filter, as it no longer relies on memory allocation.
2025-05-29 19:00:50 +02:00
strickczq
6d5473f801 fix alloc imports by indent.rs 2025-05-29 19:00:50 +02:00
strickczq
b54c5666c3 Move indent filter to separate indent.rs file
Relocated the `indent` filter implementation from alloc.rs to a new indent.rs file,
as it no longer requires memory allocation.

Updated module imports and exports in filters/mod.rs to reflect this change.

Removed unused dependencies
    (Cow, Deref, Pin) from alloc.rs.
2025-05-29 19:00:50 +02:00
strickczq
8c6d227ddb Rewrite indent filter to use IndentWriter
Refactored the `indent` filter implementation to introduce the `IndentWriter` struct,
eliminating the need for memory allocation.

Removed the `MAX_LEN` restriction and the `fuzzed_indent_filter` test,
as they are no longer necessary with the new approach.

Fixes #465.
2025-05-29 19:00:50 +02:00
Alexander Zaitsev
08682a3133
docs: Update performance.md (#188)
* docs: Update performance.md

- add documentation about PGO usage for optimizing Rinja's performance
2025-05-28 11:39:03 +02:00
Guillaume Gomez
39b957a1b3 Add issue templates 2025-05-28 03:17:01 +02:00
Guillaume Gomez
f3201cfb21
Merge pull request #456 from sinder38/update-ref-doc
Update `ref` documentation
2025-05-26 22:04:05 +02:00
René Kijewski
429aaf0821 Escape macro names like loop! 2025-05-23 21:01:00 +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
Guillaume Gomez
a2088e730a Add missing endcall in examples 2025-05-23 12:07:22 +02:00
Guillaume Gomez
7a53f7f942
Merge pull request #457 from Kijewski/pr-comp
Comparison operators cannot be chained
2025-05-23 10:20:04 +02:00
Michael Pollind
5bbaca527d add missing endcall for examples
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 19:35:53 -07: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
Guillaume Gomez
aefd0848af Fix test_short_circuit test 2025-05-22 23:07:27 +02:00
Guillaume Gomez
06c32d6d18 Allow super in calls 2025-05-22 23:04:52 +02:00
Guillaume Gomez
3ab930ded0 Fix handling of endcall whitespace characters 2025-05-22 22:50:40 +02:00
Michael Pollind
f08ca469c9 add more test add reserved word caller
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
83057d8f30 Update askama_derive/src/generator/node.rs
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
c4fcd4781a address comments
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
0547c2ee88 fix caller logic
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
b328a96ca4 simplify handler
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
ef489b60f6 add test cases and rework spaces
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
8862325e9b tweak test
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
5c07ea6842 address comments
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
7370f951a1 Update book/src/template_syntax.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
c88c4015d9 Update book/src/template_syntax.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-05-22 22:50:40 +02:00