2319 Commits

Author SHA1 Message Date
Guillaume Gomez
829ebb0ab3
Merge pull request #266 from Kijewski/pr-enum-optimizations
Second round of optimizations extracted from PR to implement `enum` variants
2024-11-24 20:45:09 +01:00
Guillaume Gomez
2aa3db966f
Merge pull request #268 from Kijewski/pr-no-proc-macro
derive standalone: opt out of native `proc-macro` support
2024-11-24 20:02:56 +01:00
Guillaume Gomez
8da1865912
Merge pull request #269 from Kijewski/pr-safer-match-on-unit-structs
derive: a safe-guard to disable bindings a unit struct was expected
2024-11-24 20:02:12 +01:00
René Kijewski
50f50e3931 derive: a safe-guard to disable bindings a unit struct was expected
This does not fix the error, as rinja is not able to tell was the
actually intended to do, but rust gives you a guide what the error is,
and the error is not silently ignored.
2024-11-24 19:06:47 +01:00
René Kijewski
78136c2351 derive standalone: opt out of native proc-macro support
We know that there is none, because `rinja_derive_standalone` is not run
inside of rust, but, as the name says, standalone. This makes the
playground WASM data a little smaller.
2024-11-24 18:57:53 +01:00
René Kijewski
87ee5fb948 Templates always implement FastWritable 2024-11-24 18:24:37 +01:00
René Kijewski
ebbd9ce4c8 derive: make PartialTemplateArgs::new() return None if there is no #[template] 2024-11-24 18:24:37 +01:00
René Kijewski
9488f218d4 derive: only one, re-usable template_to_string() function 2024-11-24 18:24:37 +01:00
René Kijewski
0d39b84fc0 derive: do not clone #[doc] attributes 2024-11-24 18:24:35 +01:00
René Kijewski
9527d14d7f derive: capture source = … value into an Arc for cheaper cloning 2024-11-24 17:25:58 +01:00
René Kijewski
bef7c3a38c derive: fix missing import 2024-11-24 17:24:07 +01:00
Guillaume Gomez
e4b89797b0
Merge pull request #260 from Kijewski/pr-stuff-in-derive
derive: some clean-ups and optimizations
2024-11-24 01:29:33 +01:00
René Kijewski
85f06449ac derive: remove needless format!() calls 2024-11-24 01:16:29 +01:00
René Kijewski
e2515bdacb derive: reword in_doc error message if code block is absent 2024-11-24 01:08:51 +01:00
René Kijewski
acd27514d0 derive: do not capture string when we have the parsed value 2024-11-24 01:08:51 +01:00
René Kijewski
51deb4d048 derive: parse whitespace early and pass parsed value around instead of an &str 2024-11-24 01:08:51 +01:00
René Kijewski
8055e37411 Unify Whitespace and WhitespaceHandling 2024-11-24 01:08:51 +01:00
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