Skip to content

Commit 5913f93

Browse files
committed
New versions of rinja will be released under the name askama
New versions of `rinja` will be released under the name [`askama`]. Please update your dependencies from e.g. `rinja = "0.3.5"` to `askama = "0.13.0"`. Useful information can be found in our [upgrade guide], and in our [blog post]. [`askama`]: https://crates.io/crates/askama [upgrade guide]: https://askama.readthedocs.io/en/v0.13.0/upgrading.html [blog post]: https://blog.guillaume-gomez.fr/articles/2025-03-19+Askama+and+Rinja+merge
1 parent a0e19aa commit 5913f93

File tree

554 files changed

+76
-48474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

554 files changed

+76
-48474
lines changed

.github/workflows/rust.yml

Lines changed: 3 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,22 @@ on:
88
- cron: "32 4 * * 5"
99

1010
jobs:
11-
####################################################################################################
12-
# STEP 1: FASTEST
13-
# ["Rustfmt", "Docs", "Audit", "Book", "Typos", "Jinja2-Assumptions", "DevSkim", "CargoSort"]
14-
####################################################################################################
15-
1611
Rustfmt:
1712
runs-on: ubuntu-latest
1813
steps:
19-
# No need to test `rinja_derive_standalone`. It has same the `src` folder as `rinja_derive`.
20-
# No need to run the checks in parallel. They are fast enough.
21-
# No need for caching. No code is compiled at all.
2214
- uses: actions/checkout@v4
2315
- uses: dtolnay/rust-toolchain@nightly
2416
with:
2517
components: rustfmt
26-
- run: |
27-
set -eu
28-
for PKG in \
29-
examples/actix-web-app examples/axum-app examples/poem-app examples/rocket-app examples/salvo-app examples/warp-app fuzzing \
30-
rinja rinja_derive rinja_derive_standalone rinja_parser \
31-
testing testing-alloc testing-no-std testing-renamed
32-
do
33-
cd "$PKG"
34-
echo "Testing: $PKG"
35-
cargo +nightly fmt -- --check
36-
cd - > /dev/null
37-
done
18+
- run: cargo +nightly fmt --all -- --check
3819

3920
Docs:
40-
strategy:
41-
matrix:
42-
package: [rinja, rinja_derive, rinja_parser]
4321
runs-on: ubuntu-latest
4422
steps:
4523
- uses: actions/checkout@v4
4624
- uses: dtolnay/rust-toolchain@nightly
4725
- uses: Swatinem/rust-cache@v2
48-
- run: cd ${{ matrix.package }} && cargo doc --all-features --no-deps
26+
- run: cargo +nightly doc --all-features --no-deps --workspace
4927
env:
5028
RUSTDOCFLAGS: -Z unstable-options --generate-link-to-definition --cfg=docsrs -D warnings
5129

@@ -55,55 +33,12 @@ jobs:
5533
- uses: actions/checkout@v4
5634
- uses: EmbarkStudios/cargo-deny-action@v2
5735

58-
Book:
59-
runs-on: ubuntu-latest
60-
steps:
61-
- uses: actions/checkout@v4
62-
- name: Generate "book/theme/index.hbs" as "skeleton" of the generated pages.
63-
run: ./update-theme.py
64-
working-directory: book
65-
- name: Install mdbook
66-
run: |
67-
mkdir -p $HOME/bin
68-
curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/mdbook-0.4.40/mdbook-0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/bin
69-
- name: Convert the book to HTML
70-
run: $HOME/bin/mdbook build
71-
working-directory: book
72-
7336
Typos:
7437
runs-on: ubuntu-latest
7538
steps:
7639
- uses: actions/checkout@v4
7740
- uses: crate-ci/typos@master
7841

79-
Jinja2-Assumptions:
80-
runs-on: ubuntu-latest
81-
steps:
82-
- uses: actions/checkout@v4
83-
- uses: actions/setup-python@v5
84-
with:
85-
python-version: '3.13'
86-
- uses: astral-sh/setup-uv@v5
87-
- run: testing/jinja2-assumptions/test.sh
88-
89-
DevSkim:
90-
name: DevSkim
91-
runs-on: ubuntu-latest
92-
permissions:
93-
actions: read
94-
contents: read
95-
security-events: write
96-
steps:
97-
- uses: actions/checkout@v4
98-
99-
- name: Run DevSkim scanner
100-
uses: microsoft/DevSkim-Action@v1
101-
102-
- name: Upload DevSkim scan results to GitHub Security tab
103-
uses: github/codeql-action/upload-sarif@v3
104-
with:
105-
sarif_file: devskim-results.sarif
106-
10742
CargoSort:
10843
name: Check order in Cargo.toml
10944
runs-on: ubuntu-latest
@@ -112,140 +47,4 @@ jobs:
11247
- uses: taiki-e/install-action@v2
11348
with:
11449
tool: cargo-sort
115-
- run: |
116-
cargo sort --check --check-format --grouped
117-
set -eu
118-
for PKG in \
119-
examples/actix-web-app examples/axum-app examples/poem-app examples/rocket-app examples/salvo-app examples/warp-app fuzzing \
120-
rinja rinja_derive rinja_derive_standalone rinja_parser \
121-
testing testing-alloc testing-no-std testing-renamed
122-
do
123-
cd "$PKG"
124-
cargo sort --check --check-format --grouped
125-
cd - > /dev/null
126-
done
127-
128-
####################################################################################################
129-
# STEP 2: INTERMEDIATE
130-
# ["Test", "Package", "MSRV"]
131-
####################################################################################################
132-
133-
Test:
134-
needs: ["Rustfmt", "Docs", "Audit", "Book", "Typos", "Jinja2-Assumptions", "DevSkim", "CargoSort"]
135-
strategy:
136-
matrix:
137-
os: [ubuntu-latest, macos-latest, windows-latest]
138-
rust: [stable, beta]
139-
exclude:
140-
- os: macos-latest
141-
rust: beta
142-
- os: windows-latest
143-
rust: beta
144-
runs-on: ${{ matrix.os }}
145-
steps:
146-
- uses: actions/checkout@v4
147-
- uses: dtolnay/rust-toolchain@master
148-
with:
149-
toolchain: ${{ matrix.rust }}
150-
- uses: taiki-e/install-action@v2
151-
with:
152-
tool: cargo-nextest
153-
- uses: Swatinem/rust-cache@v2
154-
- run: cargo build --all-targets --features full
155-
- run: cargo nextest run --all-targets --no-tests=warn --features full
156-
157-
Package:
158-
needs: ["Rustfmt", "Docs", "Audit", "Book", "Typos", "Jinja2-Assumptions", "DevSkim", "CargoSort"]
159-
strategy:
160-
matrix:
161-
package: [
162-
examples/actix-web-app, examples/axum-app, examples/poem-app, examples/rocket-app, examples/salvo-app, examples/warp-app, fuzzing,
163-
rinja, rinja_derive, rinja_derive_standalone, rinja_parser,
164-
testing, testing-alloc, testing-no-std, testing-renamed,
165-
]
166-
runs-on: ubuntu-latest
167-
steps:
168-
- uses: actions/checkout@v4
169-
- uses: dtolnay/rust-toolchain@stable
170-
with:
171-
components: clippy
172-
- uses: taiki-e/install-action@v2
173-
with:
174-
tool: cargo-nextest
175-
- uses: Swatinem/rust-cache@v2
176-
- run: cd ${{ matrix.package }} && cargo build --all-targets
177-
- run: cd ${{ matrix.package }} && cargo nextest run --all-targets --no-fail-fast --no-tests=warn
178-
- run: cd ${{ matrix.package }} && cargo clippy --all-targets -- -D warnings
179-
180-
MSRV:
181-
needs: ["Rustfmt", "Docs", "Audit", "Book", "Typos", "Jinja2-Assumptions", "DevSkim", "CargoSort"]
182-
runs-on: ubuntu-latest
183-
steps:
184-
- uses: actions/checkout@v4
185-
- uses: dtolnay/rust-toolchain@master
186-
with:
187-
toolchain: "1.81.0"
188-
- run: cargo check --lib -p rinja --all-features
189-
190-
####################################################################################################
191-
# STEP 2: SLOW
192-
# ["Fuzz", "Cluster-Fuzz"]
193-
####################################################################################################
194-
195-
Fuzz:
196-
needs: ["Test", "Package", "MSRV"]
197-
strategy:
198-
matrix:
199-
fuzz_target:
200-
- all
201-
- filters
202-
- html
203-
- parser
204-
runs-on: ubuntu-latest
205-
steps:
206-
- uses: actions/checkout@v4
207-
with:
208-
submodules: recursive
209-
- run: git submodule update --remote
210-
- uses: dtolnay/rust-toolchain@master
211-
with:
212-
toolchain: nightly
213-
components: rust-src
214-
- run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cargo-fuzz-0.12.0/cargo-fuzz-0.12.0-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin
215-
- uses: Swatinem/rust-cache@v2
216-
- run: cargo fuzz run ${{ matrix.fuzz_target }} --jobs 4 -- -max_total_time=240
217-
working-directory: fuzzing
218-
env:
219-
RUSTFLAGS: '-Ctarget-feature=-crt-static'
220-
221-
Cluster-Fuzz:
222-
needs: ["Test", "Package", "MSRV"]
223-
runs-on: ubuntu-latest
224-
permissions:
225-
security-events: write
226-
steps:
227-
- name: Build Fuzzers
228-
id: build
229-
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
230-
with:
231-
oss-fuzz-project-name: rinja
232-
language: rust
233-
- name: Run Fuzzers
234-
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
235-
with:
236-
oss-fuzz-project-name: rinja
237-
language: rust
238-
fuzz-seconds: 600
239-
output-sarif: true
240-
- name: Upload Crash
241-
uses: actions/upload-artifact@v4
242-
if: failure() && steps.build.outcome == 'success'
243-
with:
244-
name: artifacts
245-
path: ./out/artifacts
246-
- name: Upload Sarif
247-
if: always() && steps.build.outcome == 'success'
248-
uses: github/codeql-action/upload-sarif@v3
249-
with:
250-
sarif_file: cifuzz-sarif/results.sarif
251-
checkout_path: cifuzz-sarif
50+
- run: cargo sort --workspace --grouped --check --check-format

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

.readthedocs.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.rustfmt.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ group_imports = "StdExternalCrate"
33
imports_granularity = "Module"
44
newline_style = "Unix"
55
normalize_comments = true
6-
overflow_delimited_expr = true
76
style_edition = "2024"
87
unstable_features = true
98
use_field_init_shorthand = true
10-
11-
ignore = [
12-
"testing/tests/hello.rs",
13-
]

Cargo.toml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
[workspace]
2-
members = [
3-
"rinja",
4-
"rinja_derive",
5-
"rinja_parser",
6-
"testing",
7-
"testing-alloc",
8-
"testing-no-std",
9-
"testing-renamed"
10-
]
2+
members = ["rinja", "rinja_derive", "rinja_parser"]
113
resolver = "2"

README.md

Lines changed: 6 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,9 @@
1-
# rinja
1+
# rinja*deprecated*
22

3-
[![Crates.io](https://img.shields.io/crates/v/rinja?logo=rust&style=flat-square&logoColor=white "Crates.io")](https://crates.io/crates/rinja)
4-
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/rinja-rs/rinja/rust.yml?branch=master&logo=github&style=flat-square&logoColor=white "GitHub Workflow Status")](https://github.com/rinja-rs/rinja/actions/workflows/rust.yml)
5-
[![Book](https://img.shields.io/readthedocs/rinja?label=book&logo=readthedocs&style=flat-square&logoColor=white "Book")](https://rinja.readthedocs.io/)
6-
[![docs.rs](https://img.shields.io/docsrs/rinja?logo=docsdotrs&style=flat-square&logoColor=white "docs.rs")](https://docs.rs/rinja/)
3+
New versions of `rinja` will be released under the name [`askama`](https://crates.io/crates/askama).
4+
Please update your dependencies from e.g. `rinja = "0.3.5"` to `askama = "0.13.0"`.
75

8-
**Rinja** implements a template rendering engine based on [Jinja](https://jinja.palletsprojects.com/),
9-
and generates type-safe Rust code from your templates at compile time
10-
based on a user-defined `struct` to hold the template's context.
11-
See below for an example. It is a fork of [Askama](https://crates.io/crates/askama), please have a look at our
12-
[blog post](https://blog.guillaume-gomez.fr/articles/2024-07-31+docs.rs+switching+jinja+template+framework+from+tera+to+rinja)
13-
highlighting differences between the two crates.
6+
Useful information can be found in our [upgrade guide], and in our [blog post].
147

15-
All feedback welcome! Feel free to file bugs, requests for documentation and
16-
any other feedback to the [issue tracker][issues].
17-
18-
You can find the documentation about our syntax, features, configuration in our book:
19-
[rinja.readthedocs.io](https://rinja.readthedocs.io/).
20-
21-
Have a look at our [*Rinja Playground*](https://rinja-rs.github.io/play-rinja/),
22-
if you want to try out rinja's code generation online.
23-
24-
### Feature highlights
25-
26-
* Construct templates using a familiar, easy-to-use syntax
27-
* Benefit from the safety provided by Rust's type system
28-
* Template code is compiled into your crate for optimal performance
29-
* Debugging features to assist you in template development
30-
* Templates must be valid UTF-8 and produce UTF-8 when rendered
31-
* Works on stable Rust
32-
33-
### Supported in templates
34-
35-
* Template inheritance
36-
* Loops, if/else statements and include support
37-
* Macro support
38-
* Variables (no mutability allowed)
39-
* Some built-in filters, and the ability to use your own
40-
* Whitespace suppressing with '-' markers
41-
* Opt-out HTML escaping
42-
* Syntax customization
43-
44-
[issues]: https://github.com/rinja-rs/rinja/issues
45-
46-
47-
How to get started
48-
------------------
49-
50-
First, add the rinja dependency to your crate's `Cargo.toml`:
51-
52-
```sh
53-
cargo add rinja
54-
```
55-
56-
Now create a directory called `templates` in your crate root.
57-
In it, create a file called `hello.html`, containing the following:
58-
59-
```jinja
60-
Hello, {{ name }}!
61-
```
62-
63-
In any Rust file inside your crate, add the following:
64-
65-
```rust
66-
use rinja::Template; // bring trait in scope
67-
68-
#[derive(Template)] // this will generate the code...
69-
#[template(path = "hello.html")] // using the template in this path, relative
70-
// to the `templates` dir in the crate root
71-
struct HelloTemplate<'a> { // the name of the struct can be anything
72-
name: &'a str, // the field name should match the variable name
73-
// in your template
74-
}
75-
76-
fn main() {
77-
let hello = HelloTemplate { name: "world" }; // instantiate your struct
78-
println!("{}", hello.render().unwrap()); // then render it.
79-
}
80-
```
81-
82-
You should now be able to compile and run this code.
8+
[upgrade guide]: https://askama.readthedocs.io/en/v0.13.0/upgrading.html
9+
[blog post]: https://blog.guillaume-gomez.fr/articles/2025-03-19+Askama+and+Rinja+merge

0 commit comments

Comments
 (0)