Move adding filters to the templates mod

This commit is contained in:
Vincent Prouillet 2017-05-13 11:45:29 +09:00
parent 72c626ee55
commit bb3cba1ad5
2 changed files with 4 additions and 4 deletions

View file

@ -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(),

View file

@ -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
};
}