mirror of https://github.com/rwf2/Rocket.git
Update 'minijinja' to 2.0.
This commit is contained in:
parent
347d9da663
commit
9e3f9ae00f
|
@ -27,7 +27,11 @@ normpath = "1"
|
|||
|
||||
tera = { version = "1.19.0", optional = true }
|
||||
handlebars = { version = "5.1", optional = true }
|
||||
minijinja = { version = "1.0.16", optional = true, features = ["loader"] }
|
||||
|
||||
[dependencies.minijinja]
|
||||
version = "2.0.1"
|
||||
optional = true
|
||||
features = ["loader", "speedups", "json", "urlencode"]
|
||||
|
||||
[dependencies.rocket]
|
||||
version = "0.6.0-dev"
|
||||
|
|
|
@ -156,24 +156,21 @@ impl Engines {
|
|||
|
||||
/// Returns iterator over template (name, engine_extension).
|
||||
pub(crate) fn templates(&self) -> impl Iterator<Item = (&str, &'static str)> {
|
||||
#[cfg(all(feature = "tera", feature = "handlebars"))] {
|
||||
self.tera.get_template_names()
|
||||
.map(|name| (name, Tera::EXT))
|
||||
.chain(self.handlebars.get_templates().keys()
|
||||
.map(|name| (name.as_str(), Handlebars::EXT)))
|
||||
}
|
||||
#[cfg(feature = "tera")]
|
||||
let tera = self.tera.get_template_names().map(|name| (name, Tera::EXT));
|
||||
|
||||
#[cfg(all(feature = "tera", not(feature = "handlebars")))] {
|
||||
self.tera.get_template_names().map(|name| (name, Tera::EXT))
|
||||
}
|
||||
#[cfg(feature = "handlebars")]
|
||||
let handlebars = self.handlebars.get_templates().keys()
|
||||
.map(|name| (name.as_str(), Handlebars::EXT));
|
||||
|
||||
#[cfg(all(feature = "handlebars", not(feature = "tera")))] {
|
||||
self.handlebars.get_templates().keys()
|
||||
.map(|name| (name.as_str(), Handlebars::EXT))
|
||||
}
|
||||
#[cfg(feature = "minijinja")]
|
||||
let minijinja = self.minijinja.templates()
|
||||
.map(|(name, _)| (name, Environment::EXT));
|
||||
|
||||
#[cfg(not(any(feature = "tera", feature = "handlebars")))] {
|
||||
None.into_iter()
|
||||
}
|
||||
#[cfg(not(feature = "tera"))] let tera = std::iter::empty();
|
||||
#[cfg(not(feature = "handlebars"))] let handlebars = std::iter::empty();
|
||||
#[cfg(not(feature = "minijinja"))] let minijinja = std::iter::empty();
|
||||
|
||||
tera.chain(handlebars).chain(minijinja)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
//! [configurable]: #configuration
|
||||
//! [Tera]: https://docs.rs/crate/tera/1
|
||||
//! [Handlebars]: https://docs.rs/crate/handlebars/5
|
||||
//! [MiniJinja]: https://docs.rs/minijinja/1
|
||||
//! [MiniJinja]: https://docs.rs/minijinja/2
|
||||
//!
|
||||
//! 3. Attach `Template::fairing()` and return a [`Template`] from your routes
|
||||
//! via [`Template::render()`], supplying the name of the template file
|
||||
|
|
Loading…
Reference in New Issue