195 Commits

Author SHA1 Message Date
René Kijewski
70b41f704e Address comments 2025-07-21 22:31:05 +02:00
René Kijewski
b2b0d4cbba Add filters |default, |assigned_or and |defined_or
Also, `enum Pluralize<S, P>` is renamed into `enum Either<L, R>` and
exported.
2025-07-21 22:31:05 +02:00
Markus Ebner
fca6e6f78b
Switch Rust edition of askama_derive to 2024 2025-07-05 03:21:34 +02:00
Corey Prophitt
26507e1173 Fixed typos in template syntax book docs 2025-06-20 10:17:06 +02:00
René Kijewski
94e7757078 Filter linebreaksbr only needs core 2025-06-14 15:12:22 +02:00
René Kijewski
b9490c4b5d Filter paragraphbreaks only needs core 2025-06-14 14:57:55 +02:00
René Kijewski
781d88042c Filter linebreaks only needs core 2025-06-14 14:54:19 +02:00
Guillaume Gomez
477bfe4a3c Update information about wordcount filter 2025-06-14 13:18:22 +02:00
Guillaume Gomez
c6aa9b2e83 Add new reject filter 2025-06-06 15:48:04 +02:00
Guillaume Gomez
6010cd390f Add documentation for mutable variables 2025-06-01 16:26:57 +02:00
strickczq
6653662d9e book: remove alloc feature mention for indent filter
Updated the "filters" chapter in the book to remove the mention of the alloc feature requirement for the indent filter, as it no longer relies on memory allocation.
2025-05-29 19:00:50 +02:00
Alexander Zaitsev
08682a3133
docs: Update performance.md (#188)
* docs: Update performance.md

- add documentation about PGO usage for optimizing Rinja's performance
2025-05-28 11:39:03 +02:00
Guillaume Gomez
f3201cfb21
Merge pull request #456 from sinder38/update-ref-doc
Update `ref` documentation
2025-05-26 22:04:05 +02:00
Michael Pollind
c4fcd4781a address comments
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
5c07ea6842 address comments
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
7370f951a1 Update book/src/template_syntax.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
c88c4015d9 Update book/src/template_syntax.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
ce73e73720 feat: add caller pattern and adjust syntax to closer match jinja
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:40 +02:00
Michael Pollind
9215884c1a add docs
Signed-off-by: Michael Pollind <mpollind@gmail.com>
2025-05-22 22:50:39 +02:00
sinder
0ce68a32f8 Change deprecated as_ref to ref
Add a line about `ref` renaming to the upgrade guide
2025-05-22 22:46:24 +08:00
Dominique Martinet
cd13e4f148
book: upgrading: complete note about filter change (#453)
commit c6d45e1cdc0f ("Always supply `values` to custom filters") added a
second mandatory argument, and it was not obvious what broke on upgrade
through the current explanation so write a bit more about it.
2025-05-22 16:17:12 +02:00
René Kijewski
ab798e2482 Allow filters with explicit path
IMHO that makes custom filters much easier to use.
2025-05-17 13:20:54 +02:00
René Kijewski
6ce85f318c Make code generator re-usable for other projects
This PR
* removes the crate `askama_derive_standalone`,
* makes `askama_derive` a normal library, and
* adds the proc-macro crate `askama_macros`,

Before, it was not possible for another crate to re-export
`askama::Template` in a useful way, because the generated code assumes
that it has access to an `extern crate askama`.

`askama_derive` will export the function `derive_template()` like
`askama_derive_standalone` did, but it has an additional argument to
accept a `TokenStream` that should contain (an) statement(s) to define
the identifier `askama`, e.g. `quote! { extern crate askama; }`.

The new proc-macro crate `askama_macros` now defines the derive-macro
`Template` by calling `askama_derive::derive_template()`.

Prior art: [`encase`] → [`encase_derive`] → [`encase_derive_impl`];
[2298a3e].

[`encase`]: <https://crates.io/crates/encase/0.11.0>
[`encase_derive`]: <https://crates.io/crates/encase_derive/0.11.0>
[`encase_derive_impl`]: <https://crates.io/crates/encase_derive_impl/0.11.0>
[2298a3e]: <2298a3efd5>
2025-05-17 13:20:21 +02:00
Mateusz Maćkowski
44c67d3ba1
chore: fix tiny wording error in "Calling functions" docs 2025-04-30 18:15:21 +02:00
René Kijewski
61b7422497 Add |titlecase as alias for |title 2025-04-22 23:37:23 +02:00
René Kijewski
72bbe3ede1 Bump version number to v0.14.0 2025-04-22 23:37:23 +02:00
René Kijewski
57750338fa book: update upgrading.md 2025-04-22 23:37:23 +02:00
Guillaume Gomez
d2a788a740 Add doc about unique filter 2025-04-22 11:34:55 +02:00
Guillaume Gomez
6f912abee6 Move FastWritable into askama root 2025-04-22 11:33:57 +02:00
Guillaume Gomez
7c5deda4c1 Rename pluralize arguments into singular and plural 2025-04-21 23:11:24 +02:00
René Kijewski
6cea91a9b5 Update book page about filters 2025-04-21 23:11:24 +02:00
René Kijewski
94fddd4df5 book: add page about FastWritable 2025-04-19 22:09:28 +02:00
René Kijewski
7881bc131b Implement first and blank arguments for |indent 2025-04-17 15:07:21 +02:00
René Kijewski
c6d45e1cdc Always supply values to custom filters 2025-04-15 17:15:47 +02:00
René Kijewski
22648acf08 book: how to access runtime values in custom filters 2025-04-15 13:24:19 +02:00
Guillaume Gomez
4a17df55b5 Update variable initialization rule docs 2025-04-12 21:52:14 +02:00
Guillaume Gomez
c76d1a2563 Describe declaration/ownership when creating a new variable 2025-04-11 07:19:59 +02:00
Guillaume Gomez
5253e7cc41 Add another example for tuple for runtime values 2025-04-10 11:16:25 +02:00
Guillaume Gomez
4af7a13cbd Fix runtime error doc 2025-04-10 11:16:25 +02:00
Guillaume Gomez
bd7f4277ca Add link to blog post explaining merge of rinja and askama 2025-03-19 22:23:45 +01:00
bion howard
3afa15164d
fix toml features field in the filters chapter of the book
the features field needs to be a list here for this code to be copypasta-ready
2025-03-19 15:37:52 -04:00
René Kijewski
1de636fcb7 book: fix article link 2025-03-19 15:45:14 +01:00
René Kijewski
ed5776366c book: mention [askama_web]
[`askama_web`]: https://crates.io/crates/askama_web/
2025-03-18 11:51:38 +01:00
René Kijewski
19f6582308 Bump version number to v0.13.0-pre.0 2025-03-17 21:32:27 +01:00
René Kijewski
3cf5d85325 Update askama_playground URL 2025-03-16 21:58:21 +01:00
René Kijewski
38016cc4b8 docs: update twig's URL 2025-03-11 22:19:12 +01:00
René Kijewski
b8d8ce05ee Add bleeding edge API documentation to rtd 2025-03-11 21:32:19 +01:00
Guillaume Gomez
3b52c907c3 Rename rinja into askama 2025-03-11 19:31:06 +01:00
René Kijewski
98cb4233e2 Make derive optional
This is the same as in e.g. `serde` with the feature of the same name.
If you manually depend on `rinja_derive`, then you can make better use
of your multi-core setup.
2025-02-09 17:47:17 +01:00
René Kijewski
eb4806abcd book: document blocks 2025-02-08 20:15:38 +01:00