mirror of https://github.com/rwf2/Rocket.git
Add '.tera' extension to default Tera escapes.
This commit is contained in:
parent
ab94e344b4
commit
8deac6dba9
|
@ -8,7 +8,13 @@ use super::{TemplateInfo, TEMPLATE_DIR};
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref TERA: Result<tera::Tera, String> = {
|
static ref TERA: Result<tera::Tera, String> = {
|
||||||
let path: PathBuf = [&*TEMPLATE_DIR, "**", "*.tera"].iter().collect();
|
let path: PathBuf = [&*TEMPLATE_DIR, "**", "*.tera"].iter().collect();
|
||||||
tera::Tera::new(path.to_str().unwrap()).map_err(|e| format!("{:?}", e))
|
let ext = [".html.tera", ".htm.tera", ".xml.tera", ".html", ".htm", ".xml"];
|
||||||
|
tera::Tera::new(path.to_str().unwrap())
|
||||||
|
.map(|mut tera| {
|
||||||
|
tera.autoescape_on(ext.to_vec());
|
||||||
|
tera
|
||||||
|
})
|
||||||
|
.map_err(|e| format!("{:?}", e))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue