René Kijewski
d4657fae5c
derive CompileError::rendered: bool
is unused
2024-11-24 01:08:51 +01:00
René Kijewski
277cdb4f87
derive: PartialTemplateArgs
actually does not need keep track of the argument keys
2024-11-24 01:08:51 +01:00
René Kijewski
8709364c9a
Merge pull request #264 from GuillaumeGomez/allow-variables-inheritance-in-block
...
Allow variables inheritance in block
2024-11-24 00:22:04 +01:00
René Kijewski
476a50d184
book: add retry to download
2024-11-24 00:07:59 +01:00
René Kijewski
e182022f87
derive: fix lifetimes for sub-generators
...
Remove inheritance from `MapChain`, and simply open a new scope.
Add lifetime to `Generator` and `Heritage` to reference its root
context.
2024-11-23 23:55:12 +01:00
René Kijewski
466b92559a
derive: MapChain does not need to be generic
2024-11-23 21:03:21 +01:00
Guillaume Gomez
07e6216e83
Allow variables to be inherited in blocks
2024-11-22 18:44:42 +01:00
Guillaume Gomez
0edbca2b60
Fix variables not inherited from parent
2024-11-22 18:20:14 +01:00
Guillaume Gomez
9173cb3cd2
Merge pull request #262 from chrisp60/fix-259-macro-arg-kw
...
fix: normalize macro args on call (fixes #259 )
2024-11-21 21:51:27 +01:00
chrisp60
0018b3bf77
fix: normalize macro args on call #259
2024-11-21 08:58:11 -05:00
René Kijewski
35b8433acb
Merge pull request #261 from Kijewski/pr-there-can-only-be-one-fuzz
...
parser: remove obsolete parser fuzzing
2024-11-21 00:09:41 +01:00
René Kijewski
f7917d57c1
parser: remove obsolete parser fuzzing
...
The fuzzing we inherited from askama only tested the parser. In rinja we
parse multiple aspects of the project in a unified crate: `fuzzing`.
Everything the old fuzzer did is included in the new fuzzer, and more.
2024-11-20 23:55:51 +01:00
Guillaume Gomez
b856eb8d44
Merge pull request #244 from GuillaumeGomez/allow-underscore
...
Allow idents to start with `_`
2024-11-20 15:13:05 +01:00
Guillaume Gomez
2ec7740894
Update license in deny.toml
2024-11-20 15:00:18 +01:00
Guillaume Gomez
8dbbb9ae48
Allow to create variables named _
2024-11-20 14:55:05 +01:00
René Kijewski
fb2d4eb941
Merge pull request #258 from Kijewski/pr-canon-paths
...
Canonicalize include paths before emitting
2024-11-19 23:58:16 +01:00
Guillaume Gomez
53f15d8931
Simplify Target::PlaceHolder
handling
2024-11-19 21:31:05 +01:00
Guillaume Gomez
5dce4a69a2
Handle ..
in is_shadowing_variable
as well
2024-11-19 21:31:05 +01:00
René Kijewski
f5954443eb
Remove unwrap()
s in string inclusion
2024-11-19 21:23:50 +01:00
Guillaume Gomez
7aa8868b29
Extend checks for underscore ident misuses
2024-11-19 21:21:54 +01:00
David Koloski
0a041957da
Canonicalize include paths before emitting
...
This allows `CARGO_MANIFEST_DIR` to be a relative path, which can be
useful in non-cargo build systems.
2024-11-19 21:15:22 +01:00
Guillaume Gomez
f39a846598
Allow idents to start with _
2024-11-19 18:10:06 +01:00
René Kijewski
f86feddbb4
Merge pull request #253 from Kijewski/pr-refactor-generator
...
derive: refactor generator for greater re-usability
2024-11-18 20:31:46 +01:00
René Kijewski
05534b21cc
derive: refactor generator for greater re-usability
2024-11-18 20:16:52 +01:00
René Kijewski
612b1d32b7
Merge pull request #252 from Kijewski/pr-no-ext
...
Remove `EXTENSION` constant from `Template`
2024-11-18 17:16:24 +01:00
René Kijewski
968b80fcb8
Remove EXTENSION
constant from Template
...
I doubt that is needed in any circumstance, and it makes implementing
enum variants harder.
2024-11-18 16:55:30 +01:00
René Kijewski
c6f8bfabc5
Merge pull request #251 from Kijewski/pr-unify-arg-errors
...
derive: fix typos and unify error messages
2024-11-18 15:49:10 +01:00
René Kijewski
26f6808aa6
derive: fix typos and unify error messages
2024-11-18 15:43:16 +01:00
Guillaume Gomez
f3cff091b7
Merge pull request #250 from GuillaumeGomez/filters
...
Remove restriction preventing to have | surrounded by whistespace characters
2024-11-18 15:28:26 +01:00
René Kijewski
7b91babbc7
Merge pull request #248 from GuillaumeGomez/missing-title
...
Add missing "Escapers" title in the book
2024-11-18 15:23:56 +01:00
Guillaume Gomez
27950a4399
Add an escaper example
2024-11-18 15:17:56 +01:00
Guillaume Gomez
abe167effc
Update book about filters
2024-11-18 15:15:21 +01:00
René Kijewski
afc0de1700
Merge pull request #247 from GuillaumeGomez/improve-error-message
...
Improve error message when an extension escaper is missing
2024-11-18 14:24:41 +01:00
René Kijewski
6eb4ab3196
Merge pull request #249 from GuillaumeGomez/fix-integration-chapter
...
Fix integrations book chapter
2024-11-18 14:21:05 +01:00
Guillaume Gomez
d7bc44a87d
Remove restriction preventing to have |
surrounded by whistespace characters
2024-11-17 20:25:01 +01:00
Guillaume Gomez
b5b6d0b101
Fix integrations book chapter
2024-11-16 14:02:32 +01:00
Guillaume Gomez
7b44ef7741
Add missing "Escapers" title in the book
2024-11-15 15:06:29 +01:00
Guillaume Gomez
b0d834c0fd
Improve error message when an extension escaper is missing
2024-11-15 15:02:10 +01:00
Guillaume Gomez
41425e15aa
Merge pull request #243 from Kijewski/pr-enum
...
derive: refactor `#[template]` parsing
2024-11-14 22:33:34 +01:00
René Kijewski
cedc1d8aa5
derive: refactor #[template]
parsing
...
This allows parsing a `#[template]` attribute without expecting all
attributes to be set, which makes the parsing re-usable, which is a
prerequisit to implement `enum` variant handling.
2024-11-14 21:19:49 +01:00
René Kijewski
9335c76cc5
Merge pull request #242 from epage/winnow-04-cleanup
...
refactor(parser): Remove redundant closure
2024-11-14 21:17:49 +01:00
Ed Page
93f7788aa8
refactor(parser): Remove redundant closure
2024-11-14 13:36:43 -06:00
René Kijewski
5772a6849e
Merge pull request #241 from Kijewski/pr-extends
...
parser: allow whitespace control on `extends`
2024-11-14 17:05:24 +01:00
René Kijewski
ebdd3f8b43
parser: allow whitespace control on extends
2024-11-14 16:53:14 +01:00
Guillaume Gomez
8dd3fc9628
Merge pull request #238 from Kijewski/pr-is_ascii_whitespace
...
parser: use built-in whitespace trimming
2024-11-14 14:43:14 +01:00
Guillaume Gomez
9eab13b363
Merge pull request #240 from Kijewski/pr-book
...
book: pin to mdbook v0.4.40 for now and add table of contents to pages
2024-11-14 18:19:23 +08:00
René Kijewski
a9e0132b28
book: add toc
2024-11-14 11:12:02 +01:00
René Kijewski
b76d1000b6
book: pin to mdbook v0.4.40 for now
2024-11-14 11:12:02 +01:00
René Kijewski
d3b9b6ea56
Raise MSRV to 1.80
2024-11-13 23:33:06 +01:00
René Kijewski
9b733d8887
parser: use built-in whitespace trimming
...
Our `is_ws()` implementation was the same since the earliest days of askama:
<4805acc8eb (diff-a9b78e3979c46af7f12ceef379a5a7a657fbe8d77900aa6b4e88b7519b415ca3R31-R34)
>.
It considers spaces ` `, horizontal tabs `\t`, carriage return `\r`, and
end of line `\n` characters as white spaces characters. Rust's
`u8::is_ascii_whitespace()` adds formfeed `\f` to the list.
This PR replaces `is_ws()` with the built-in
`char::is_ascii_whitespace()`. The parser is a tiny bit faster, and we
are a bit more standard conforming:
<details>
<summary>benchmark results</summary>
```text
Running benches/from_str.rs (/home/kijewski/git/rust/rinja/target/release/deps/from_str-fae58673a015eed7)
librustdoc/all time: [322.12 µs 323.71 µs 325.71 µs]
thrpt: [43.355 MiB/s 43.623 MiB/s 43.837 MiB/s]
change:
time: [-6.3192% -5.9056% -5.4469%] (p = 0.00 < 0.05)
thrpt: [+5.7607% +6.2763% +6.7454%]
Performance has improved.
librustdoc/item_info time: [5.6035 µs 5.6117 µs 5.6220 µs]
thrpt: [27.989 MiB/s 28.041 MiB/s 28.082 MiB/s]
change:
time: [-5.7565% -5.2861% -4.7532%] (p = 0.00 < 0.05)
thrpt: [+4.9904% +5.5811% +6.1081%]
Performance has improved.
librustdoc/item_union time: [32.750 µs 32.863 µs 32.984 µs]
thrpt: [29.926 MiB/s 30.036 MiB/s 30.139 MiB/s]
change:
time: [-8.0835% -7.2746% -6.3867%] (p = 0.00 < 0.05)
thrpt: [+6.8224% +7.8453% +8.7944%]
Performance has improved.
librustdoc/page time: [149.16 µs 149.45 µs 149.84 µs]
thrpt: [41.327 MiB/s 41.433 MiB/s 41.515 MiB/s]
change:
time: [-7.1007% -6.8131% -6.5353%] (p = 0.00 < 0.05)
thrpt: [+6.9922% +7.3113% +7.6435%]
Performance has improved.
librustdoc/print_item time: [18.142 µs 18.197 µs 18.253 µs]
thrpt: [51.726 MiB/s 51.883 MiB/s 52.040 MiB/s]
change:
time: [-5.4557% -5.0690% -4.6229%] (p = 0.00 < 0.05)
thrpt: [+4.8470% +5.3396% +5.7706%]
Performance has improved.
librustdoc/short_item_info
time: [17.533 µs 17.552 µs 17.576 µs]
thrpt: [51.547 MiB/s 51.618 MiB/s 51.674 MiB/s]
change:
time: [-6.0722% -5.6344% -5.2641%] (p = 0.00 < 0.05)
thrpt: [+5.5566% +5.9708% +6.4647%]
Performance has improved.
librustdoc/sidebar time: [35.947 µs 36.056 µs 36.176 µs]
thrpt: [34.113 MiB/s 34.226 MiB/s 34.330 MiB/s]
change:
time: [-7.6516% -7.0295% -6.4676%] (p = 0.00 < 0.05)
thrpt: [+6.9148% +7.5611% +8.2856%]
Performance has improved.
librustdoc/source time: [13.274 µs 13.318 µs 13.364 µs]
thrpt: [55.161 MiB/s 55.353 MiB/s 55.537 MiB/s]
change:
time: [-6.2263% -5.9307% -5.6552%] (p = 0.00 < 0.05)
thrpt: [+5.9941% +6.3047% +6.6397%]
Performance has improved.
librustdoc/type_layout_size
time: [8.1719 µs 8.2034 µs 8.2364 µs]
thrpt: [32.884 MiB/s 33.016 MiB/s 33.143 MiB/s]
change:
time: [-5.6332% -5.3531% -5.0853%] (p = 0.00 < 0.05)
thrpt: [+5.3578% +5.6559% +5.9695%]
Performance has improved.
librustdoc/type_layout time: [29.034 µs 29.101 µs 29.175 µs]
thrpt: [92.278 MiB/s 92.513 MiB/s 92.726 MiB/s]
change:
time: [-8.3192% -7.9370% -7.4312%] (p = 0.00 < 0.05)
thrpt: [+8.0278% +8.6212% +9.0741%]
Performance has improved.
```
</details>
I doubt that anyone is relying on the fact that the invisible character
`\f` won't be stripped by whitespace control. If you absolutely need
this character to be preserved, then you can always use `{{ '\u{b}' }}`.
Right now, `trim_ascii_start()` is manually implemented, because it is
only stable since rust 1.80.
2024-11-13 23:28:32 +01:00