Browse Source

Move adding filters to the templates mod

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
bb3cba1ad5
2 changed files with 4 additions and 4 deletions
  1. +1
    -4
      src/site.rs
  2. +3
    -0
      src/templates/mod.rs

+ 1
- 4
src/site.rs 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(),


+ 3
- 0
src/templates/mod.rs 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
};
}

Loading…
Cancel
Save