470 Commits

Author SHA1 Message Date
René Kijewski
66dac1df06 Add failing test from issue 272
Reported by Ciprian Dorin Craciun ([@cipriancraciun]) in issue [#272].

[#272]: <https://github.com/rinja-rs/rinja/issues/272>
[@cipriancraciun]: <https://github.com/cipriancraciun>
2024-11-26 07:23:37 +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
e2515bdacb derive: reword in_doc error message if code block is absent 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
Guillaume Gomez
07e6216e83 Allow variables to be inherited in blocks 2024-11-22 18:44:42 +01:00
chrisp60
0018b3bf77 fix: normalize macro args on call #259 2024-11-21 08:58:11 -05:00
Guillaume Gomez
8dbbb9ae48 Allow to create variables named _ 2024-11-20 14:55:05 +01:00
Guillaume Gomez
7aa8868b29 Extend checks for underscore ident misuses 2024-11-19 21:21:54 +01:00
Guillaume Gomez
f39a846598 Allow idents to start with _ 2024-11-19 18:10:06 +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
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
Guillaume Gomez
d7bc44a87d Remove restriction preventing to have | surrounded by whistespace characters 2024-11-17 20:25:01 +01:00
Guillaume Gomez
b0d834c0fd Improve error message when an extension escaper is missing 2024-11-15 15:02:10 +01:00
René Kijewski
ebdd3f8b43 parser: allow whitespace control on extends 2024-11-14 16:53:14 +01:00
René Kijewski
d3b9b6ea56 Raise MSRV to 1.80 2024-11-13 23:33:06 +01:00
René Kijewski
c5ed6af5a3 parser: add better error messages for broken closing block tags 2024-11-13 20:14:42 +01:00
René Kijewski
e7f5de2697 Add garbled closing block test 2024-11-13 20:03:08 +01:00
René Kijewski
7f9c91de0b Add concat operator ~
The string concatenation operator `~` is present in jinja and tera:
<https://jinja.palletsprojects.com/en/stable/templates/#other-operators>.
While it's not the most important operator, it can come in handy e.g.
with filters: `{{ a|upper }}{{ b|upper }}` → `{{ (a ~ b)|upper }}`.
2024-11-12 17:07:17 +01:00
René Kijewski
3e07719ad9 derive: reject unions as they require unsafe code 2024-11-11 00:55:47 +01:00
René Kijewski
fe551596f3 unions generate invalid code 2024-11-11 00:42:08 +01:00
Guillaume Gomez
6e13c81a5f Move types into their tests 2024-11-09 22:22:42 +01:00
Guillaume Gomez
e98cfa9ce8
Merge pull request #207 from GuillaumeGomez/macro-default-value
Add support for default value in macros
2024-11-09 19:18:49 +08:00
René Kijewski
19db2765b7 parser: more strict macro argument parsing 2024-11-09 08:37:54 +01:00
René Kijewski
84b76ac966 Add HtmlSafe reference wrapper tests 2024-11-03 00:37:06 +01:00
Guillaume Gomez
c87be3ec36 Relax rules for filesizeformat filter
Remove `humansize` dependency
2024-11-01 00:51:03 +01:00
Guillaume Gomez
6df0892d1a Make it possible to use macro arguments as default value 2024-10-25 23:24:11 +02:00
Guillaume Gomez
cf0d821b9e Add code generation for default value arguments 2024-10-25 23:21:05 +02:00
René Kijewski
3cb337255b Bump version number to v0.3.5
We gathered quiet a few changes in the last month:
<https://github.com/rinja-rs/rinja/compare/v0.3.4...1e319fd0c869884b68c9287bc4bcb1309b16328e>
2024-10-23 15:10:15 +02:00
Guillaume Gomez
1e319fd0c8
Merge pull request #200 from Kijewski/pr-ref
Unify trait impl for reference wrapper types
2024-10-23 21:03:35 +08:00
Guillaume Gomez
c77cd37821 Add regression test for config delimiters 2024-10-20 05:06:06 +02:00
René Kijewski
f7d1e9a5b4 Unify trait impl for reference wrapper types
This changes makes sure that no implementation is forgotten and
deduplicates some code.
2024-10-16 21:46:59 +02:00
René Kijewski
f195158140 filters: remove num-traits
They were added in <https://github.com/djc/askama/pull/146>.

The example when they might be useful sounds contrived. You can always
manually add the package `num-traits` to your project and use the
methods directly. `into_isize` and `into_f64` wasn't even documented in
the book.
2024-10-08 13:16:32 +02:00
René Kijewski
dfcfde9ce9 generator: use re-exported core and std
This way, even a shadowed `core` or `std` does not prevent the generated
code from working correctly.
2024-10-04 06:40:00 +02:00
Guillaume Gomez
191fc15b6a Fix typo 2024-10-03 14:48:50 +02:00
Guillaume Gomez
8ba1e16f3e Add regression test for */& operators in functions/methods arguments 2024-10-03 14:48:50 +02:00
René Kijewski
4b44189809 ci: update formatting for edition=2024 2024-09-24 02:07:17 +02:00
Guillaume Gomez
d488a1d28f Update crates version to 0.3.4 2024-09-19 17:45:24 +02:00
René Kijewski
77931a774f
Merge pull request #179 from GuillaumeGomez/rust-macro-not-prepended
Do not prepend rust macro calls with `&`
2024-09-18 18:21:05 +02:00
Guillaume Gomez
40d10cea5e Add regression test for rust macro calls not prepended with & 2024-09-18 17:37:26 +02:00
René Kijewski
eed37cd415 Run clippy --fix -- -D clippy::pedantic 2024-09-16 22:58:50 +02:00
René Kijewski
cb35670afc benches: add benchmark for io::write() and to_string() 2024-09-14 00:03:11 +02:00
René Kijewski
27443641f5 filters: escape arguments to pluralize at compile time 2024-09-13 14:01:30 +02:00
Guillaume Gomez
447729f753 Update crates version to 0.3.3 2024-09-11 20:34:06 +02:00
René Kijewski
ecd0e6e84e parser: make {#-#} a syntax error 2024-09-11 03:27:53 +02:00
René Kijewski
1948d63241 parser: add context information for unknown tags 2024-09-10 16:09:42 +02:00
René Kijewski
7b4f1dc907 parser: add optional {% endwhen %} 2024-09-10 04:09:40 +02:00
Guillaume Gomez
a60c2e7db9 Add regression test for unclosed items 2024-09-10 02:40:12 +02:00
Guillaume Gomez
37c520fc38 Update crate version to 0.3.2 2024-08-25 22:36:49 +02:00
René Kijewski
3d6fa3e7ae
Merge pull request #151 from GuillaumeGomez/fix-loop-locals-context
Fix invalid locals context drop
2024-08-22 21:13:26 +02:00