Browse Source

Update tera

index-subcmd
Vincent Prouillet 5 years ago
parent
commit
243702e2c2
10 changed files with 200 additions and 197 deletions
  1. +188
    -185
      Cargo.lock
  2. +1
    -1
      components/errors/Cargo.toml
  3. +1
    -1
      components/front_matter/Cargo.toml
  4. +1
    -1
      components/imageproc/Cargo.toml
  5. +1
    -1
      components/library/Cargo.toml
  6. +1
    -1
      components/site/Cargo.toml
  7. +1
    -1
      components/templates/Cargo.toml
  8. +1
    -1
      components/templates/src/lib.rs
  9. +1
    -1
      components/utils/Cargo.toml
  10. +4
    -4
      components/utils/src/templates.rs

+ 188
- 185
Cargo.lock
File diff suppressed because it is too large
View File


+ 1
- 1
components/errors/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
toml = "0.5"
image = "0.22"
syntect = "=3.2.0"

+ 1
- 1
components/front_matter/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
chrono = "0.4"
serde = "1"
serde_derive = "1"


+ 1
- 1
components/imageproc/Cargo.toml View File

@@ -6,7 +6,7 @@ authors = ["Vojtěch Král <vojtech@kral.hk>"]
[dependencies]
lazy_static = "1"
regex = "1.0"
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
image = "0.22"
rayon = "1"



+ 1
- 1
components/library/Cargo.toml View File

@@ -7,7 +7,7 @@ authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
slotmap = "0.4"
rayon = "1"
chrono = { version = "0.4", features = ["serde"] }
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
serde = "1"
serde_derive = "1"
slug = "0.1"


+ 1
- 1
components/site/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
glob = "0.3"
rayon = "1"
serde = "1"


+ 1
- 1
components/templates/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
base64 = "0.10"
lazy_static = "1"
pulldown-cmark = "0.6"


+ 1
- 1
components/templates/src/lib.rs View File

@@ -69,6 +69,6 @@ pub fn render_redirect_template(url: &str, tera: &Tera) -> Result<String> {
let mut context = Context::new();
context.insert("url", &url);

tera.render("internal/alias.html", context)
tera.render("internal/alias.html", &context)
.map_err(|e| Error::chain(format!("Failed to render alias for '{}'", url), e))
}

+ 1
- 1
components/utils/Cargo.toml View File

@@ -5,7 +5,7 @@ authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
errors = { path = "../errors" }
tera = "1.0.0-beta.10"
tera = "1.0.0-beta.17"
unicode-segmentation = "1.2"
walkdir = "2"
toml = "0.5"


+ 4
- 4
components/utils/src/templates.rs View File

@@ -11,7 +11,7 @@ macro_rules! render_default_tpl {
let mut context = Context::new();
context.insert("filename", $filename);
context.insert("url", $url);
Tera::one_off(DEFAULT_TPL, context, true).map_err(std::convert::Into::into)
Tera::one_off(DEFAULT_TPL, &context, true).map_err(std::convert::Into::into)
}};
}

@@ -27,21 +27,21 @@ pub fn render_template(
) -> Result<String> {
// check if it is in the templates
if tera.templates.contains_key(name) {
return tera.render(name, context).map_err(std::convert::Into::into);
return tera.render(name, &context).map_err(std::convert::Into::into);
}

// check if it is part of a theme
if let Some(ref t) = *theme {
let theme_template_name = format!("{}/templates/{}", t, name);
if tera.templates.contains_key(&theme_template_name) {
return tera.render(&theme_template_name, context).map_err(std::convert::Into::into);
return tera.render(&theme_template_name, &context).map_err(std::convert::Into::into);
}
}

// check if it is part of ZOLA_TERA defaults
let default_name = format!("__zola_builtins/{}", name);
if tera.templates.contains_key(&default_name) {
return tera.render(&default_name, context).map_err(std::convert::Into::into);
return tera.render(&default_name, &context).map_err(std::convert::Into::into);
}

// maybe it's a default one?


Loading…
Cancel
Save