Move adding filters to the templates mod
This commit is contained in:
parent
72c626ee55
commit
bb3cba1ad5
|
@ -15,7 +15,7 @@ use pagination::Paginator;
|
||||||
use utils::{create_file, create_directory};
|
use utils::{create_file, create_directory};
|
||||||
use section::{Section};
|
use section::{Section};
|
||||||
use front_matter::{SortBy};
|
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
|
/// 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 tpl_glob = format!("{}/{}", path.to_string_lossy().replace("\\", "/"), "templates/**/*.*ml");
|
||||||
let mut tera = Tera::new(&tpl_glob).chain_err(|| "Error parsing templates")?;
|
let mut tera = Tera::new(&tpl_glob).chain_err(|| "Error parsing templates")?;
|
||||||
tera.extend(&GUTENBERG_TERA)?;
|
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 {
|
let site = Site {
|
||||||
base_path: path.to_path_buf(),
|
base_path: path.to_path_buf(),
|
||||||
|
|
|
@ -18,6 +18,9 @@ lazy_static! {
|
||||||
|
|
||||||
("internal/alias.html", include_str!("builtins/internal/alias.html")),
|
("internal/alias.html", include_str!("builtins/internal/alias.html")),
|
||||||
]).unwrap();
|
]).unwrap();
|
||||||
|
tera.register_filter("markdown", filters::markdown);
|
||||||
|
tera.register_filter("base64_encode", filters::base64_encode);
|
||||||
|
tera.register_filter("base64_decode", filters::base64_decode);
|
||||||
tera
|
tera
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue