From bb3cba1ad54b1d7ca1f87a06ae6e64a1f623a45f Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Sat, 13 May 2017 11:45:29 +0900 Subject: [PATCH] Move adding filters to the templates mod --- src/site.rs | 5 +---- src/templates/mod.rs | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/site.rs b/src/site.rs index ee62500..d394a8f 100644 --- a/src/site.rs +++ b/src/site.rs @@ -15,7 +15,7 @@ use pagination::Paginator; use utils::{create_file, create_directory}; use section::{Section}; use front_matter::{SortBy}; -use templates::{GUTENBERG_TERA, filters, global_fns}; +use templates::{GUTENBERG_TERA, global_fns}; /// Renders the `internal/alias.html` template that will redirect @@ -77,9 +77,6 @@ impl Site { let tpl_glob = format!("{}/{}", path.to_string_lossy().replace("\\", "/"), "templates/**/*.*ml"); let mut tera = Tera::new(&tpl_glob).chain_err(|| "Error parsing templates")?; tera.extend(&GUTENBERG_TERA)?; - tera.register_filter("markdown", filters::markdown); - tera.register_filter("base64_encode", filters::base64_encode); - tera.register_filter("base64_decode", filters::base64_decode); let site = Site { base_path: path.to_path_buf(), diff --git a/src/templates/mod.rs b/src/templates/mod.rs index 11e5077..7982fb4 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -18,6 +18,9 @@ lazy_static! { ("internal/alias.html", include_str!("builtins/internal/alias.html")), ]).unwrap(); + tera.register_filter("markdown", filters::markdown); + tera.register_filter("base64_encode", filters::base64_encode); + tera.register_filter("base64_decode", filters::base64_decode); tera }; }