Skip to content

Commit

Permalink
Rename rinja into askama
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 20, 2025
1 parent c3fac0c commit a8d2b84
Show file tree
Hide file tree
Showing 275 changed files with 1,230 additions and 1,290 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
Rustfmt:
runs-on: ubuntu-latest
steps:
# No need to test `rinja_derive_standalone`. It has same the `src` folder as `rinja_derive`.
# No need to test `askama_derive_standalone`. It has same the `src` folder as `askama_derive`.
# No need to run the checks in parallel. They are fast enough.
# No need for caching. No code is compiled at all.
- uses: actions/checkout@v4
Expand All @@ -27,7 +27,7 @@ jobs:
set -eu
for PKG in \
bench-build examples/actix-web-app examples/axum-app examples/poem-app examples/rocket-app examples/salvo-app examples/warp-app fuzzing \
rinja rinja_derive rinja_derive_standalone rinja_parser \
askama askama_derive askama_derive_standalone askama_parser \
testing testing-alloc testing-no-std testing-renamed
do
cd "$PKG"
Expand All @@ -39,7 +39,7 @@ jobs:
Docs:
strategy:
matrix:
package: [rinja, rinja_derive, rinja_parser]
package: [askama, askama_derive, askama_parser]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
set -eu
for PKG in \
bench-build examples/actix-web-app examples/axum-app examples/poem-app examples/rocket-app examples/salvo-app examples/warp-app fuzzing \
rinja rinja_derive rinja_derive_standalone rinja_parser \
askama askama_derive askama_derive_standalone askama_parser \
testing testing-alloc testing-no-std testing-renamed
do
cd "$PKG"
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
matrix:
package: [
bench-build, examples/actix-web-app, examples/axum-app, examples/poem-app, examples/rocket-app, examples/salvo-app, examples/warp-app, fuzzing,
rinja, rinja_derive, rinja_derive_standalone, rinja_parser,
askama, askama_derive, askama_derive_standalone, askama_parser,
testing, testing-alloc, testing-no-std, testing-renamed,
]
runs-on: ubuntu-latest
Expand All @@ -185,7 +185,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.81.0"
- run: cargo check --lib -p rinja --all-features
- run: cargo check --lib -p askama --all-features

####################################################################################################
# STEP 2: SLOW
Expand Down Expand Up @@ -228,12 +228,12 @@ jobs:
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: rinja
oss-fuzz-project-name: askama
language: rust
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: rinja
oss-fuzz-project-name: askama
language: rust
fuzz-seconds: 600
output-sarif: true
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
members = [
"rinja",
"rinja_derive",
"rinja_parser",
"askama",
"askama_derive",
"askama_parser",
"testing",
"testing-alloc",
"testing-no-std",
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# rinja
# askama

[![Crates.io](https://img.shields.io/crates/v/rinja?logo=rust&style=flat-square&logoColor=white "Crates.io")](https://crates.io/crates/rinja)
[![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)
[![Book](https://img.shields.io/readthedocs/rinja?label=book&logo=readthedocs&style=flat-square&logoColor=white "Book")](https://rinja.readthedocs.io/)
[![docs.rs](https://img.shields.io/docsrs/rinja?logo=docsdotrs&style=flat-square&logoColor=white "docs.rs")](https://docs.rs/rinja/)
[![Crates.io](https://img.shields.io/crates/v/askama?logo=rust&style=flat-square&logoColor=white "Crates.io")](https://crates.io/crates/askama)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/askama-rs/askama/rust.yml?branch=master&logo=github&style=flat-square&logoColor=white "GitHub Workflow Status")](https://github.com/askama-rs/askama/actions/workflows/rust.yml)
[![Book](https://img.shields.io/readthedocs/askama?label=book&logo=readthedocs&style=flat-square&logoColor=white "Book")](https://askama.readthedocs.io/)
[![docs.rs](https://img.shields.io/docsrs/askama?logo=docsdotrs&style=flat-square&logoColor=white "docs.rs")](https://docs.rs/askama/)

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

All feedback welcome! Feel free to file bugs, requests for documentation and
any other feedback to the [issue tracker][issues].

You can find the documentation about our syntax, features, configuration in our book:
[rinja.readthedocs.io](https://rinja.readthedocs.io/).
[askama.readthedocs.io](https://askama.readthedocs.io/).

Have a look at our [*Rinja Playground*](https://rinja-rs.github.io/play-rinja/),
if you want to try out rinja's code generation online.
Have a look at our [*Rinja Playground*](https://askama-rs.github.io/play-askama/),
if you want to try out askama's code generation online.

### Feature highlights

Expand All @@ -41,16 +41,16 @@ if you want to try out rinja's code generation online.
* Opt-out HTML escaping
* Syntax customization

[issues]: https://github.com/rinja-rs/rinja/issues
[issues]: https://github.com/askama-rs/askama/issues


How to get started
------------------

First, add the rinja dependency to your crate's `Cargo.toml`:
First, add the askama dependency to your crate's `Cargo.toml`:

```sh
cargo add rinja
cargo add askama
```

Now create a directory called `templates` in your crate root.
Expand All @@ -63,7 +63,7 @@ Hello, {{ name }}!
In any Rust file inside your crate, add the following:

```rust
use rinja::Template; // bring trait in scope
use askama::Template; // bring trait in scope

#[derive(Template)] // this will generate the code...
#[template(path = "hello.html")] // using the template in this path, relative
Expand Down
4 changes: 2 additions & 2 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ extend-exclude = [
"fuzzing/fuzz/artifacts/",
"fuzzing/fuzz/corpus/",
"target/",
"rinja_parser/tests/*.txt",
"askama_parser/tests/*.txt",
"testing/templates/fuzzed-*",
# filler texts
"rinja/benches/strings.inc",
"askama/benches/strings.inc",
# too many false positives
"testing/tests/gen_ws_tests.py",
]
Expand Down
File renamed without changes.
28 changes: 14 additions & 14 deletions rinja/Cargo.toml → askama/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "rinja"
name = "askama"
version = "0.3.5"
description = "Type-safe, compiled Jinja-like templates for Rust"
keywords = ["markup", "template", "jinja2", "html"]
categories = ["template-engine"]
homepage = "https://rinja.readthedocs.io/"
repository = "https://github.com/rinja-rs/rinja"
homepage = "https://askama.readthedocs.io/"
repository = "https://github.com/askama-rs/askama"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.81"
Expand All @@ -27,7 +27,7 @@ harness = false
itoa = "1.0.11"

# needed by feature "derive"
rinja_derive = { version = "=0.3.5", path = "../rinja_derive", default-features = false, optional = true }
askama_derive = { version = "=0.3.5", path = "../askama_derive", default-features = false, optional = true }

# needed by feature "serde_json"
serde = { version = "1.0", optional = true, default-features = false }
Expand All @@ -44,25 +44,25 @@ criterion = "0.5"
maintenance = { status = "actively-developed" }

[features]
default = ["config", "derive", "std", "urlencode", "rinja_derive?/default"]
full = ["default", "blocks", "code-in-doc", "serde_json", "rinja_derive?/full"]
default = ["config", "derive", "std", "urlencode", "askama_derive?/default"]
full = ["default", "blocks", "code-in-doc", "serde_json", "askama_derive?/full"]

alloc = [
"rinja_derive?/alloc",
"askama_derive?/alloc",
"serde?/alloc",
"serde_json?/alloc",
"percent-encoding?/alloc",
]
blocks = ["rinja_derive?/blocks"]
code-in-doc = ["rinja_derive?/code-in-doc"]
config = ["rinja_derive?/config"]
derive = ["rinja_derive"]
serde_json = ["rinja_derive?/serde_json", "dep:serde", "dep:serde_json"]
blocks = ["askama_derive?/blocks"]
code-in-doc = ["askama_derive?/code-in-doc"]
config = ["askama_derive?/config"]
derive = ["askama_derive"]
serde_json = ["askama_derive?/serde_json", "dep:serde", "dep:serde_json"]
std = [
"alloc",
"rinja_derive?/std",
"askama_derive?/std",
"serde?/std",
"serde_json?/std",
"percent-encoding?/std",
]
urlencode = ["rinja_derive?/urlencode", "dep:percent-encoding"]
urlencode = ["askama_derive?/urlencode", "dep:percent-encoding"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion rinja/benches/escape.rs → askama/benches/escape.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use askama::filters::{Html, escape};
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use rinja::filters::{Html, escape};

criterion_main!(benches);
criterion_group!(benches, functions);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rinja/benches/to-json.rs → askama/benches/to-json.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use askama::Template;
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use rinja::Template;

criterion_main!(benches);
criterion_group!(benches, functions);
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions rinja/src/error.rs → askama/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::io;
/// The [`Result`](std::result::Result) type with [`Error`] as default error type
pub type Result<I, E = Error> = core::result::Result<I, E>;

/// rinja's error type
/// askama's error type
///
/// Used as error value for e.g. [`Template::render()`][crate::Template::render()]
/// and custom filters.
Expand Down Expand Up @@ -264,7 +264,7 @@ pub trait ResultConverter {
type Input;

/// Consume an interior mutable `self`, and turn it into a [`crate::Result`]
fn rinja_conv_result(self, result: Self::Input) -> Result<Self::Value, Error>;
fn askama_conv_result(self, result: Self::Input) -> Result<Self::Value, Error>;
}

/// Helper marker to be used with [`ResultConverter`]
Expand All @@ -288,7 +288,7 @@ where
type Input = Result<T, E>;

#[inline]
fn rinja_conv_result(self, result: Self::Input) -> Result<Self::Value, Error> {
fn askama_conv_result(self, result: Self::Input) -> Result<Self::Value, Error> {
result.map_err(Error::custom)
}
}
Expand All @@ -301,7 +301,7 @@ where
type Input = Result<T, E>;

#[inline]
fn rinja_conv_result(self, result: Self::Input) -> Result<Self::Value, Error> {
fn askama_conv_result(self, result: Self::Input) -> Result<Self::Value, Error> {
result.map_err(Into::into)
}
}
Loading

0 comments on commit a8d2b84

Please sign in to comment.