Use upstream 'Tera.get_template_names()'.

Resolves #1637.
This commit is contained in:
Sergio Benitez 2021-05-21 11:39:17 -07:00
parent 6784ebc097
commit f85604b65e
2 changed files with 5 additions and 5 deletions

View File

@ -55,7 +55,7 @@ rmp-serde = { version = "0.15.0", optional = true }
# Templating dependencies. # Templating dependencies.
handlebars = { version = "3.0", optional = true } handlebars = { version = "3.0", optional = true }
glob = { version = "0.3", optional = true } glob = { version = "0.3", optional = true }
tera = { version = "1.0.2", optional = true } tera = { version = "1.10.0", optional = true }
notify = { version = "4.0.6", optional = true } notify = { version = "4.0.6", optional = true }
normpath = { version = "0.2", optional = true } normpath = { version = "0.2", optional = true }

View File

@ -117,17 +117,17 @@ impl Engines {
None None
} }
/// Returns iterator over template (name, engine_extension).
pub(crate) fn templates(&self) -> impl Iterator<Item = (&str, &'static str)> { pub(crate) fn templates(&self) -> impl Iterator<Item = (&str, &'static str)> {
#[cfg(all(feature = "tera_templates", feature = "handlebars_templates"))] { #[cfg(all(feature = "tera_templates", feature = "handlebars_templates"))] {
self.tera.templates.keys() self.tera.get_template_names()
.map(|name| (name.as_str(), Tera::EXT)) .map(|name| (name, Tera::EXT))
.chain(self.handlebars.get_templates().keys() .chain(self.handlebars.get_templates().keys()
.map(|name| (name.as_str(), Handlebars::EXT))) .map(|name| (name.as_str(), Handlebars::EXT)))
} }
#[cfg(all(feature = "tera_templates", not(feature = "handlebars_templates")))] { #[cfg(all(feature = "tera_templates", not(feature = "handlebars_templates")))] {
self.tera.templates.keys() self.tera.get_template_names().map(|name| (name, Tera::EXT))
.map(|name| (name.as_str(), Tera::EXT))
} }
#[cfg(all(feature = "handlebars_templates", not(feature = "tera_templates")))] { #[cfg(all(feature = "handlebars_templates", not(feature = "tera_templates")))] {