diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7ca840b2..2c9eed5a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,7 +33,7 @@ jobs: matrix: package: [ askama, askama_actix, askama_axum, askama_derive, askama_escape, - askama_parser, askama_rocket, askama_tide, askama_warp, testing, + askama_parser, askama_rocket, askama_warp, testing, ] runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index 8375b266..b2e8046c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,6 @@ members = [ "askama_escape", "askama_parser", "askama_rocket", - "askama_tide", "askama_warp", "testing", ] diff --git a/askama/Cargo.toml b/askama/Cargo.toml index 47404cb0..c05fecf4 100644 --- a/askama/Cargo.toml +++ b/askama/Cargo.toml @@ -28,7 +28,6 @@ urlencode = ["askama_derive/urlencode", "percent-encoding"] with-actix-web = ["askama_derive/with-actix-web"] with-axum = ["askama_derive/with-axum"] with-rocket = ["askama_derive/with-rocket"] -with-tide = ["askama_derive/with-tide"] with-warp = ["askama_derive/with-warp"] # deprecated diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml index 2ce6cbf1..1afb51cf 100644 --- a/askama_derive/Cargo.toml +++ b/askama_derive/Cargo.toml @@ -24,7 +24,6 @@ num-traits = [] with-actix-web = [] with-axum = [] with-rocket = [] -with-tide = [] with-warp = [] [dependencies] diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs index c83e0ead..cc7e4acc 100644 --- a/askama_derive/src/lib.rs +++ b/askama_derive/src/lib.rs @@ -163,8 +163,6 @@ const CRATE: &str = if cfg!(feature = "with-actix-web") { "::askama_axum" } else if cfg!(feature = "with-rocket") { "::askama_rocket" -} else if cfg!(feature = "with-tide") { - "::askama_tide" } else if cfg!(feature = "with-warp") { "::askama_warp" } else { diff --git a/askama_tide/Cargo.toml b/askama_tide/Cargo.toml deleted file mode 100644 index 27d227bf..00000000 --- a/askama_tide/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "askama_tide" -version = "0.16.0" -edition = "2021" -rust-version = "1.65" -description = "Tide integration for Askama templates" -keywords = ["markup", "template", "html", "tide", "http-types"] -homepage = "https://github.com/djc/askama" -repository = "https://github.com/djc/askama" -documentation = "https://docs.rs/askama" -license = "MIT OR Apache-2.0" -workspace = ".." -readme = "README.md" - -[dependencies] -askama = { version = "0.13", path = "../askama", default-features = false, features = ["with-tide"] } -tide = { version = "0.16", default-features = false } - -[dev-dependencies] -async-std = { version = "1.6.5", features = ["attributes"] } - -[features] -default = ["askama/default"] -config = ["askama/config"] -humansize = ["askama/humansize"] -markdown = ["askama/markdown"] -num-traits = ["askama/num-traits"] -serde-json = ["askama/serde-json"] -serde-yaml = ["askama/serde-yaml"] -urlencode = ["askama/urlencode"] diff --git a/askama_tide/LICENSE-APACHE b/askama_tide/LICENSE-APACHE deleted file mode 120000 index 965b606f..00000000 --- a/askama_tide/LICENSE-APACHE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE-APACHE \ No newline at end of file diff --git a/askama_tide/LICENSE-MIT b/askama_tide/LICENSE-MIT deleted file mode 120000 index 76219eb7..00000000 --- a/askama_tide/LICENSE-MIT +++ /dev/null @@ -1 +0,0 @@ -../LICENSE-MIT \ No newline at end of file diff --git a/askama_tide/README.md b/askama_tide/README.md deleted file mode 100644 index af900b39..00000000 --- a/askama_tide/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# askama_tide: Askama integration with tide - -[![Documentation](https://docs.rs/askama_tide/badge.svg)](https://docs.rs/askama_tide/) -[![Latest version](https://img.shields.io/crates/v/askama_tide.svg)](https://crates.io/crates/askama_tide) -[![Build Status](https://github.com/djc/askama/workflows/CI/badge.svg)](https://github.com/djc/askama/actions?query=workflow%3ACI) -[![Chat](https://img.shields.io/discord/976380008299917365?logo=discord)](https://discord.gg/ZucwjE6bmT) - -Integration of the [Askama](https://github.com/djc/askama) templating engine in -code building on the tide web framework. diff --git a/askama_tide/src/lib.rs b/askama_tide/src/lib.rs deleted file mode 100644 index 57c1672a..00000000 --- a/askama_tide/src/lib.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![forbid(unsafe_code)] -#![deny(elided_lifetimes_in_paths)] -#![deny(unreachable_pub)] - -pub use tide; - -pub use askama::*; -use tide::{Body, Response}; - -pub fn try_into_body(t: &T) -> Result { - let string = t.render()?; - let mut body = Body::from_string(string); - body.set_mime(T::MIME_TYPE); - Ok(body) -} - -pub fn into_response(t: &T) -> Response { - match try_into_body(t) { - Ok(body) => { - let mut response = Response::new(200); - response.set_body(body); - response - } - - Err(error) => { - let mut response = Response::new(500); - response.set_error(error); - response - } - } -} diff --git a/askama_tide/templates/hello.html b/askama_tide/templates/hello.html deleted file mode 100644 index 8149be7a..00000000 --- a/askama_tide/templates/hello.html +++ /dev/null @@ -1 +0,0 @@ -Hello, {{ name }}! diff --git a/askama_tide/tests/tide.rs b/askama_tide/tests/tide.rs deleted file mode 100644 index 44a065e5..00000000 --- a/askama_tide/tests/tide.rs +++ /dev/null @@ -1,28 +0,0 @@ -use askama::Template; -use async_std::prelude::*; -use tide::{http::mime::HTML, Body, Response}; - -#[derive(Template)] -#[template(path = "hello.html")] -struct HelloTemplate<'a> { - name: &'a str, -} - -#[async_std::test] -async fn template_to_response() { - let mut res: Response = HelloTemplate { name: "world" }.into(); - assert_eq!(res.status(), 200); - assert_eq!(res.content_type(), Some(HTML)); - - let res: &mut tide::http::Response = res.as_mut(); - assert_eq!(res.body_string().await.unwrap(), "Hello, world!"); -} - -#[async_std::test] -async fn template_to_body() { - let mut body: Body = HelloTemplate { name: "world" }.try_into().unwrap(); - assert_eq!(body.mime(), &HTML); - let mut body_string = String::new(); - body.read_to_string(&mut body_string).await.unwrap(); - assert_eq!(body_string, "Hello, world!"); -} diff --git a/book/src/integrations.md b/book/src/integrations.md index 6a47bdbc..81797dd8 100644 --- a/book/src/integrations.md +++ b/book/src/integrations.md @@ -51,20 +51,7 @@ trait for each template type. This makes it simple to return a template from a Warp filter. See [the example](https://github.com/djc/askama/blob/main/askama_warp/tests/warp.rs) from the Askama test suite for more on how to integrate. -## Tide integration - -In your template definitions, replace `askama::Template` with -[`askama_tide::Template`][askama_tide]. - -Enabling the `with-tide` feature appends `Into` and -`TryInto` implementations for each template type. This -provides the ability for tide apps to build a response directly from -a template, or to append a templated body to an existing -`Response`. See [the example](https://github.com/djc/askama/blob/main/askama_tide/tests/tide.rs) -from the Askama test suite for more on how to integrate. - [askama_rocket]: https://docs.rs/askama_rocket [askama_actix]: https://docs.rs/askama_actix [askama_axum]: https://docs.rs/askama_axum [askama_warp]: https://docs.rs/askama_warp -[askama_tide]: https://docs.rs/askama_tide