Browse Source

Use platform separator for shortcodes paths

index-subcmd
Vincent Prouillet 5 years ago
parent
commit
84f10f6b69
3 changed files with 3 additions and 3 deletions
  1. +0
    -1
      components/library/src/content/ser.rs
  2. +0
    -1
      components/rebuild/tests/rebuild.rs
  3. +3
    -1
      components/rendering/src/shortcode.rs

+ 0
- 1
components/library/src/content/ser.rs View File

@@ -5,7 +5,6 @@ use tera::{Map, Value};

use content::{Page, Section};
use library::Library;
use rendering::Header;

#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct TranslatedContent<'a> {


+ 0
- 1
components/rebuild/tests/rebuild.rs View File

@@ -240,7 +240,6 @@ fn can_rebuild_after_renaming_non_md_asset_in_colocated_folder() {
fn can_rebuild_after_deleting_file() {
let tmp_dir = tempdir().expect("create temp dir");
let (site_path, mut site) = load_and_build_site!(tmp_dir, "test_site");
println!("{:#?}", site.tera.templates.keys().collect::<Vec<_>>());
let path = site_path.join("content").join("posts").join("fixed-slug.md");
fs::remove_file(&path).unwrap();



+ 3
- 1
components/rendering/src/shortcode.rs View File

@@ -1,3 +1,5 @@
use std::path::MAIN_SEPARATOR;

use pest::iterators::Pair;
use pest::Parser;
use regex::Regex;
@@ -112,7 +114,7 @@ fn render_shortcode(
}
tera_context.extend(context.tera_context.clone());

let template_name = format!("shortcodes/{}.html", name);
let template_name = format!("shortcodes{}{}.html", MAIN_SEPARATOR, name);

let res = utils::templates::render_template(&template_name, &context.tera, tera_context, &None)
.map_err(|e| Error::chain(format!("Failed to render {} shortcode", name), e))?;


Loading…
Cancel
Save