263 Commits

Author SHA1 Message Date
René Kijewski
5944ab9bef Implement enum variants 2025-01-26 02:23:51 +01:00
Guillaume Gomez
e418834149
Merge pull request #322 from Kijewski/pr-c37ee6c72e8c9ba008e5090bb3eedfad1a2ae802
Remove intermediate allocations for error messages
2025-01-25 23:29:48 +01:00
René Kijewski
d0dcc1c0ce Remove intermediate allocations for error messages 2025-01-25 20:10:15 +01:00
René Kijewski
94288391b3 derive: add ".askama" to list of HTML extensions 2025-01-25 20:00:30 +01:00
Guillaume Gomez
b72622120d Add support for "runtime" values 2025-01-23 23:43:43 +01:00
René Kijewski
8253624ad2
Merge pull request #317 from GuillaumeGomez/generics
Add support for generics syntax in parser
2025-01-22 22:59:36 +01:00
Guillaume Gomez
1cf81ba269 Simplify filters handling 2025-01-22 22:03:05 +01:00
René Kijewski
6bbf0a3b01 Make filters |fmt and |format avail w/ "alloc" w/o "std" 2025-01-21 03:06:50 +01:00
René Kijewski
880be8226d parser: parse paths in generic arguments 2025-01-20 22:14:28 +01:00
René Kijewski
89ecbb6058 derive: let filters handle generics 2025-01-20 21:17:28 +01:00
Guillaume Gomez
73bb670df5 Allow to have generics on function calls 2025-01-18 00:55:27 +01:00
Guillaume Gomez
f2e701ee46 Allow generics on filters 2025-01-18 00:48:45 +01:00
Guillaume Gomez
960d039bbf Support recursive generics 2025-01-18 00:48:45 +01:00
Guillaume Gomez
0bfeb018a7 Add support for ::<> syntax 2025-01-18 00:48:45 +01:00
René Kijewski
9336435859 derive: keep track of called macros
Recursive macro calls, direct and indirect, would cause a stackoverflow.

This PR lets the macro call handler keep track of the stack of called
macros we are currently in, so we can abort with an error message
instead of panicking.
2024-12-29 07:52:21 +01:00
Guillaume Gomez
ae59d772c4 Correctly handle bool comparisons 2024-12-25 21:18:57 +01:00
Guillaume Gomez
5deb71920d Add regression test for if let chain 2024-12-25 21:18:57 +01:00
Guillaume Gomez
2262a8d786 Move includes count test into its own function 2024-12-25 21:18:57 +01:00
Guillaume Gomez
5cc7cb2121 Add full support for if let chain feature 2024-12-25 21:18:57 +01:00
René Kijewski
929d52f306 derive: split generator implementation into 3 files
3000 lines is much too many.
2024-12-23 19:12:43 +01:00
René Kijewski
c80e78e8b5 parser: deny all rust keywords as target names 2024-12-21 23:49:48 +01:00
René Kijewski
0cc0189927 Add missing softlinks 2024-12-21 19:55:15 +01:00
René Kijewski
e800b7ca90 derive: reserve variable prefix __rinja and free name writer 2024-12-21 19:42:03 +01:00
René Kijewski
fe36573926 Let operator ? only wrap the error in Box if needed
This leads to fewer needless allocations, and makes the operator `?`
usable in an no-alloc context.
2024-12-21 18:53:44 +01:00
René Kijewski
bedc31797c Make #![no_std] compatible 2024-12-21 18:53:44 +01:00
René Kijewski
78ea25d48f derive: use file_info in find_template 2024-12-16 19:27:48 +01:00
René Kijewski
74bf996ff3 derive: update expected output for newer trybuild versions 2024-12-16 11:46:16 +01:00
Luca Palmieri
2cf65d18cc Fix: canonicalize paths to ensure hashmap lookups behave as expected 2024-12-16 10:48:42 +01:00
René Kijewski
a443415dd0 derive: fix typo that mixes up uppercase and urlencode 2024-12-13 23:18:34 +01:00
Guillaume Gomez
43a0efda7c
Merge pull request #276 from Kijewski/pr-one-CompileError
derive: less `format!()`, shorter context on error
2024-12-13 12:02:49 +01:00
René Kijewski
b49e42f0ea Use cargo reference manifest section order
In [#131] I added a check that ensures that the section in `Cargo.toml`
(and there values) are in a specific order. I invented the order quite
randomly, in the order which I thought might be useful.

This PR changes the order to be the same as in Cargo's reference about
[The Manifest Format]. Also some missing softlinks were added.

[#131]: <https://github.com/rinja-rs/rinja/pull/131>
[The Manifest Format]: <https://doc.rust-lang.org/cargo/reference/manifest.html>
2024-12-13 10:00:48 +01:00
René Kijewski
657b70d8bb Remove stray commas 2024-12-13 02:54:43 +01:00
René Kijewski
42b4a1c272 derive: fix typo to not print whole rem file on error 2024-12-13 02:54:43 +01:00
René Kijewski
1a8ac14e3b derive: do not format to String if we can help it 2024-12-13 02:54:41 +01:00
René Kijewski
430b99bdac Fix clippy warnings in rust nightly 1.85 2024-12-11 19:50:29 +01:00
René Kijewski
ed5f485642 Make working with Errors a bit easier 2024-11-26 05:57:09 +01:00
René Kijewski
45aac915b3 derive: remove generics injection for write_header()
With the integrations gone, this feature is not needed anymore.
2024-11-25 21:45:37 +01:00
René Kijewski
20e9c2f000 Remove const Template::Template 2024-11-25 03:03:16 +01:00
René Kijewski
69ad5ea026 Remove integration crates 2024-11-25 03:03:15 +01:00
René Kijewski
611647a82b derive: replace generic &WithSpan<'_, T> with Span where possible 2024-11-24 22:31:52 +01:00
René Kijewski
47c3f6cc65 parser: shrink the size of WithSpan to one register 2024-11-24 22:30:47 +01:00
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
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
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