Browse Source

Only load templates ending by .html

Avoid issues with temp files from some editors
index-subcmd
Vincent Prouillet 7 years ago
parent
commit
fb7b5646ca
3 changed files with 3 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -1
      README.md
  3. +1
    -1
      src/site.rs

+ 1
- 0
CHANGELOG.md 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


+ 1
- 1
README.md 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:


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


Loading…
Cancel
Save