Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename rinja into askama #353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GuillaumeGomez
Copy link
Contributor

Part of #335.

@@ -87,7 +87,7 @@
expected += after[0] * (not nws)
expected += after[1]

# FIXME: Rinja does not include whitespace before eof
# FIXME: Askama does not include whitespace before eof

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note test

Suspicious comment
@GuillaumeGomez GuillaumeGomez force-pushed the rename branch 2 times, most recently from eb3d6a5 to 037e93e Compare February 20, 2025 21:45
@Kijewski
Copy link
Collaborator

I think the soft-links to the config files are still broken. I guess the easiest solution is to recreate them all:

ln -fst . ../clippy.toml ../deny.toml ../LICENSE-APACHE ../LICENSE-MIT ../.rustfmt.toml ../tomlfmt.toml ../_typos.toml

@GuillaumeGomez
Copy link
Contributor Author

I think I'll let you handle the fuzzing part. Normally everything else was done. :)

@Kijewski
Copy link
Collaborator

Oh, this is a chicken & egg problem I didn't think about. Can you please simply comment out the cluster-fuzz block in the CI? We can comment it back in after we updated the fuzzing config in oss-fuzz.

@GuillaumeGomez
Copy link
Contributor Author

I was afraid of something like this. Commenting it out then.

@Kijewski
Copy link
Collaborator

This is great, thank you! I'll have a proper look tomorrow. (The bvg is on strike, so I'll have to get up early tomorrow to have a nice walk to work. :D)

@GuillaumeGomez
Copy link
Contributor Author

Time to buy a bike! :D

On my side I'll be on a train back home tomorrow, so should not get to bed too late either. ^^'

README.md Outdated
Comment on lines 11 to 13
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like "Askama v0.13 the next iteration of rinja v0.3, itself a previous fork of Askama"?

@@ -1,11 +1,11 @@
[package]
name = "rinja"
name = "askama"
version = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.3.5"
version = "0.13.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to do that in another PR. We'll need to update the version before the release in any case.

@@ -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 }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama_derive = { version = "=0.3.5", path = "../askama_derive", default-features = false, optional = true }
askama_derive = { version = "=0.13.0", path = "../askama_derive", default-features = false, optional = true }

//! // can easily disable the auto-escaping with the `|safe` filter,
//! // but a malicious user cannot insert e.g. HTML scripts this way.
//! ```
//!
//! A Rinja template is a `struct` definition which provides the template
//! A Askama template is a `struct` definition which provides the template
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//! A Askama template is a `struct` definition which provides the template
//! An Askama template is a `struct` or `enum` definition which provides the template

static DEFAULT_SYNTAX_NAME: &str = "default";
static DEFAULT_ESCAPERS: &[(&[&str], &str)] = &[
(
&[
"askama", "html", "htm", "j2", "jinja", "jinja2", "rinja", "svg", "xml",
"askama", "html", "htm", "j2", "jinja", "jinja2", "askama", "svg", "xml",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"askama", "html", "htm", "j2", "jinja", "jinja2", "askama", "svg", "xml",
"askama", "html", "htm", "j2", "jinja", "jinja2", "svg", "xml",

@@ -651,13 +651,13 @@ mod tests {
(str_set(&["js"]), "::my_filters::Js".into()),
(
str_set(&[
"askama", "html", "htm", "j2", "jinja", "jinja2", "rinja", "svg", "xml"
"askama", "html", "htm", "j2", "jinja", "jinja2", "askama", "svg", "xml"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"askama", "html", "htm", "j2", "jinja", "jinja2", "askama", "svg", "xml"
"askama", "html", "htm", "j2", "jinja", "jinja2", "svg", "xml"

@@ -1055,7 +1055,7 @@ const _: () = {
};

#[cfg(feature = "code-in-doc")]
const JINJA_EXTENSIONS: &[&str] = &["askama", "j2", "jinja", "jinja2", "rinja"];
const JINJA_EXTENSIONS: &[&str] = &["askama", "j2", "jinja", "jinja2", "askama"];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const JINJA_EXTENSIONS: &[&str] = &["askama", "j2", "jinja", "jinja2", "askama"];
const JINJA_EXTENSIONS: &[&str] = &["askama", "j2", "jinja", "jinja2"];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll actually keep rinja for memories. :)

[package]
name = "rinja_derive_standalone"
name = "askama_derive_standalone"
version = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.3.5"
version = "0.13.0"

@@ -21,7 +20,7 @@ harness = false
required-features = ["__standalone"]

[dependencies]
parser = { package = "rinja_parser", version = "=0.3.5", path = "../rinja_parser" }
parser = { package = "askama_parser", version = "=0.3.5", path = "../askama_parser" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parser = { package = "askama_parser", version = "=0.3.5", path = "../askama_parser" }
parser = { package = "askama_parser", version = "=0.13.0", path = "../askama_parser" }

@@ -1,12 +1,12 @@
[package]
name = "rinja_parser"
name = "askama_parser"
version = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.3.5"
version = "0.13.0"

@@ -1,18 +1,18 @@
[package]
name = "bench-build"
version = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.3.5"
version = "0.13.0"

Comment on lines +10 to +11
askama = { path = "../askama", version = "0.3.5", default-features = false, features = ["std"] }
askama_derive = { path = "../askama_derive", version = "0.3.5", features = ["std"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { path = "../askama", version = "0.3.5", default-features = false, features = ["std"] }
askama_derive = { path = "../askama_derive", version = "0.3.5", features = ["std"] }
askama = { path = "../askama", version = "0.13.0", default-features = false, features = ["std"] }
askama_derive = { path = "../askama_derive", version = "0.13.0", features = ["std"] }

@@ -9,7 +9,7 @@ you have to opt-in to the feature [`"serde_json"`](#serde_json):

```toml
[dependencies]
rinja = { version = "0.3.5", features = ["serde_json"] }
askama = { version = "0.3.5", features = ["serde_json"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", features = ["serde_json"] }
askama = { version = "0.13.0", features = ["serde_json"] }

@@ -18,7 +18,7 @@ for more information.
## Default features

Any [semver-compatible](https://doc.rust-lang.org/cargo/reference/semver.html) upgrade
(e.g. `rinja = "0.3.4"` to `rinja = "0.3.5"`) will keep the same list of default features.
(e.g. `askama = "0.3.4"` to `askama = "0.3.5"`) will keep the same list of default features.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(e.g. `askama = "0.3.4"` to `askama = "0.3.5"`) will keep the same list of default features.
(e.g. `askama = "0.13.0"` to `askama = "0.13.1"`) will keep the same list of default features.

@@ -28,7 +28,7 @@ You can opt-out of using the feature flags by using

```toml
[dependencies]
rinja = { version = "0.3.5", default-features = false }
askama = { version = "0.3.5", default-features = false }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", default-features = false }
askama = { version = "0.13.0", default-features = false }


## Getting Started

First, add the following to your crate's `Cargo.toml`:

```toml
# in [dependencies] section
rinja = "0.3.5"
askama = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = "0.3.5"
askama = "0.13.0"

@@ -2,21 +2,21 @@

## Rendering Performance

When rendering a rinja template, you should prefer the methods
When rendering a askama template, you should prefer the methods
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When rendering a askama template, you should prefer the methods
When rendering an askama template, you should prefer the methods

@@ -46,26 +46,26 @@ give you more in-dept explanations:
* The feature `"serde-yaml"` was removed.
Use e.g. [`yaml-rust2`](https://lib.rs/crates/yaml-rust2) directly.

## From rinja v0.3 to askama v0.13
## From askama v0.3 to askama v0.13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please undo all changes in this file below this line.

@@ -65,7 +65,7 @@ impl Responder for AppError {
type Body = String;

fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body> {
// The error handler uses a rinja template to display its content.
// The error handler uses a askama template to display its content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// The error handler uses a askama template to display its content.
// The error handler uses an askama template to display its content.

# and axum as your web-framework.
[dependencies]
askama = { version = "0.3.5", path = "../../askama" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", path = "../../askama" }
askama = { version = "0.13.0", path = "../../askama" }

}

/// This is your error handler
impl IntoResponse for AppError {
fn into_response(self) -> Response {
// It uses a rinja template to display its content.
// It uses a askama template to display its content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It uses a askama template to display its content.
// It uses an askama template to display its content.

# and poem as your web-framework.
[dependencies]
askama = { version = "0.3.5", path = "../../askama" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", path = "../../askama" }
askama = { version = "0.13.0", path = "../../askama" }

@@ -71,7 +71,7 @@ impl ResponseError for AppError {
/// This is your error handler
impl IntoResponse for AppError {
fn into_response(self) -> Response {
// It uses a rinja template to display its content.
// It uses a askama template to display its content.
Copy link
Collaborator

@Kijewski Kijewski Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It uses a askama template to display its content.
// It uses an askama template to display its content.

# and rocket as your web-framework.
[dependencies]
rinja = { version = "0.3.5", path = "../../rinja" }
askama = { version = "0.3.5", path = "../../askama" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", path = "../../askama" }
askama = { version = "0.13.0", path = "../../askama" }

}

/// This is your error handler
impl<'r> Responder<'r, 'static> for AppError {
fn respond_to(self, request: &'r Request<'_>) -> Result<Response<'static>, Status> {
// It uses a rinja template to display its content.
// It uses a askama template to display its content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It uses a askama template to display its content.
// It uses a askama template to display its content.

# and salvo as your web-framework.
[dependencies]
rinja = { version = "0.3.5", path = "../../rinja" }
askama = { version = "0.3.5", path = "../../askama" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", path = "../../askama" }
askama = { version = "0.13.0", path = "../../askama" }

}

/// This is your error handler
impl Scribe for AppError {
fn render(self, res: &mut Response) {
// It uses a rinja template to display its content.
// It uses a askama template to display its content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It uses a askama template to display its content.
// It uses a askama template to display its content.

# and actix-web as your web-framework.
[dependencies]
askama = { version = "0.3.5", path = "../../askama" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { version = "0.3.5", path = "../../askama" }
askama = { version = "0.13.0", path = "../../askama" }

}

/// This is your error handler
impl Reply for AppError {
fn into_response(self) -> Response {
// It uses a rinja template to display its content.
// It uses a askama template to display its content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// It uses a askama template to display its content.
// It uses a askama template to display its content.

@@ -1,12 +1,12 @@
[package]
name = "rinja_testing-alloc"
name = "askama_testing-alloc"
version = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.3.5"
version = "0.13.0"

edition = "2021"
rust-version = "1.81"
publish = false

[dev-dependencies]
rinja = { path = "../rinja", version = "0.3.5", default-features = false, features = ["alloc", "derive"] }
askama = { path = "../askama", version = "0.3.5", default-features = false, features = ["alloc", "derive"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { path = "../askama", version = "0.3.5", default-features = false, features = ["alloc", "derive"] }
askama = { path = "../askama", version = "0.13.0", default-features = false, features = ["alloc", "derive"] }

@@ -1,12 +1,12 @@
[package]
name = "rinja_testing-no-std"
name = "askama_testing-no-std"
version = "0.3.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "0.3.5"
version = "0.13.0"

edition = "2021"
rust-version = "1.81"
publish = false

[dev-dependencies]
rinja = { path = "../rinja", version = "0.3.5", default-features = false, features = ["derive"] }
askama = { path = "../askama", version = "0.3.5", default-features = false, features = ["derive"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
askama = { path = "../askama", version = "0.3.5", default-features = false, features = ["derive"] }
askama = { path = "../askama", version = "0.13.0", default-features = false, features = ["derive"] }

@Kijewski
Copy link
Collaborator

I really should have made a commit instead of supplying suggestions in Github. :| Maybe hit "commit suggestion" a lot, then squash the commits manually? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants