Only load templates ending by .html

Avoid issues with temp files from some editors
This commit is contained in:
Vincent Prouillet 2017-04-22 11:44:56 +09:00
parent f35ca24893
commit fb7b5646ca
3 changed files with 3 additions and 2 deletions

View file

@ -12,6 +12,7 @@
- Add tables and footnotes support in markdown - Add tables and footnotes support in markdown
- Add previous/previous_in_section/next/next_in_section/summary to `Page` - Add previous/previous_in_section/next/next_in_section/summary to `Page`
- Add more language syntaxes - Add more language syntaxes
- Only load templates ending by `.html`
## 0.0.3 (2017-04-05) ## 0.0.3 (2017-04-05)
- Add some colours in console - Add some colours in console

View file

@ -45,7 +45,7 @@ If you want to add some of your own variables, you will need to put them in the
they will be silently ignored. they will be silently ignored.
### Templates ### Templates
Templates live in the `templates/` directory. Templates live in the `templates/` directory and the files need to end by `.html`.
Only [Tera](https://github.com/Keats/tera) templates are supported. Only [Tera](https://github.com/Keats/tera) templates are supported.
Each kind of page get their own variables: Each kind of page get their own variables:

View file

@ -79,7 +79,7 @@ impl Site {
pub fn new<P: AsRef<Path>>(path: P, config_file: &str) -> Result<Site> { pub fn new<P: AsRef<Path>>(path: P, config_file: &str) -> Result<Site> {
let path = path.as_ref(); let path = path.as_ref();
let tpl_glob = format!("{}/{}", path.to_string_lossy().replace("\\", "/"), "templates/**/*"); let tpl_glob = format!("{}/{}", path.to_string_lossy().replace("\\", "/"), "templates/**/*.html");
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("markdown", filters::markdown);