443 Commits

Author SHA1 Message Date
Guillaume Gomez
c87be3ec36 Relax rules for filesizeformat filter
Remove `humansize` dependency
2024-11-01 00:51:03 +01: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
Guillaume Gomez
c6c80fe6b7 Fix invalid locals context drop 2024-08-21 21:56:57 +02:00
René Kijewski
91626899a6 Bump version numbers for release v0.3.1 2024-08-20 15:50:00 +02:00
René Kijewski
6cd78ac9ef Apply review comments 2024-08-20 14:04:27 +02:00
René Kijewski
6d4e3dfae8 Bump version numbers 2024-08-20 12:09:54 +02:00
René Kijewski
a7f6a3f32f derive: allow in_doc = false 2024-08-20 12:09:54 +02:00
René Kijewski
42d58106b3 derive: add in_doc attribute 2024-08-20 11:50:30 +02:00
René Kijewski
307daa3179 derive: feature gate "code-in-doc" 2024-08-20 11:50:30 +02:00
René Kijewski
6a612e510b derive: use pulldown-cmark to interpret comments 2024-08-20 11:50:30 +02:00
René Kijewski
96fae8b8db derive: allow supplying source in comment
Using `#[template(source = "…")]` is tiresome, because you have to
escape the input. That makes it difficult to read, too. Using
`#[template(path = "…")` can be tiresome, too, if the code is small
and/or if you just want to prototype something.

This PR adds a third option to supply the source of a template: You can
supply the source in the comments of a template. This works similar to
doctest. Any <code>```rinja```</code> block gets extracted, and the
combined blocks are the source code of the template.
2024-08-20 11:50:30 +02:00
Guillaume Gomez
b8404c7828 Add ui regression test for new escape filter error 2024-08-18 22:43:59 +02:00
Guillaume Gomez
71f49a8fc2 Add support for prefixes for string literals 2024-08-18 22:43:59 +02:00
Guillaume Gomez
1a24ace17b Add support for b prefix for char literals 2024-08-18 22:35:03 +02:00
Guillaume Gomez
7a7e415822 Add support for | operator in when 2024-08-15 21:10:29 +02:00
René Kijewski
90096ef973 ci: sort elements in Cargo.toml 2024-08-13 19:17:37 +02:00
Guillaume Gomez
d5fef24ff7
Merge pull request #119 from Kijewski/pr-no-when
parser: allow `match` nodes w/o `when` if there is an `else`
2024-08-13 17:48:15 +02:00
René Kijewski
ed91a909ab derive: better error messages for syntax testing 2024-08-13 17:39:57 +02:00
René Kijewski
e4c5ca3f6b parser: reject closing delims that look like an op 2024-08-13 16:56:33 +02:00
Guillaume Gomez
9873ea065f Improve compile-time if conditions handling 2024-08-09 20:32:38 +02:00
René Kijewski
f818c582bf parser: allow match nodes w/o when if there is an else 2024-08-08 22:28:14 +02:00
René Kijewski
5efd31310f parser: understand arbitrarily mixed up end nodes 2024-08-07 20:43:18 +02:00
René Kijewski
dec67c686b parser: tell user proper keyword to end node 2024-08-07 20:30:25 +02:00
René Kijewski
0628afaf5e parser: add wrong node terminator test 2024-08-07 20:28:33 +02:00
Guillaume Gomez
ebcfff66cc
Merge pull request #117 from Kijewski/pr-template-times-x
derive: allow split up template attributes
2024-08-07 14:38:33 +02:00
René Kijewski
f25dac9409 derive: allow split up template attributes
In generated code or macros, it might be useful to emit multiple
`#[template]` attributes. E.g.

```rust
 #[template(source = "Hello!")]
 #[template(ext = "txt")]
 struct Hello;
```
2024-08-07 07:09:19 +02:00
René Kijewski
ed692a087d derive: don't panic if the extension is non-UTF-8 2024-08-07 07:06:55 +02:00
René Kijewski
1ff32cb0ab derive: understand extension .rinja 2024-08-07 06:12:42 +02:00
René Kijewski
6fe504e133 Bump version numbers to v0.3.0 2024-08-01 15:41:37 +02:00