Browse Source

Indicate which file is failing to render on error

index-subcmd
Vincent Prouillet 6 years ago
parent
commit
860d1f4d1f
2 changed files with 5 additions and 3 deletions
  1. +3
    -2
      components/content/src/page.rs
  2. +2
    -1
      components/content/src/section.rs

+ 3
- 2
components/content/src/page.rs View File

@@ -172,13 +172,14 @@ impl Page {
let res = render_content( let res = render_content(
&self.raw_content.replacen("<!-- more -->", "<a name=\"continue-reading\"></a>", 1), &self.raw_content.replacen("<!-- more -->", "<a name=\"continue-reading\"></a>", 1),
&context &context
)?;
).chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?;
self.content = res.0; self.content = res.0;
self.toc = res.1; self.toc = res.1;
if self.raw_content.contains("<!-- more -->") { if self.raw_content.contains("<!-- more -->") {
self.summary = Some({ self.summary = Some({
let summary = self.raw_content.splitn(2, "<!-- more -->").collect::<Vec<&str>>()[0]; let summary = self.raw_content.splitn(2, "<!-- more -->").collect::<Vec<&str>>()[0];
render_content(summary, &context)?.0
render_content(summary, &context)
.chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?.0
}) })
} }




+ 2
- 1
components/content/src/section.rs View File

@@ -105,7 +105,8 @@ impl Section {
permalinks, permalinks,
self.meta.insert_anchor_links, self.meta.insert_anchor_links,
); );
let res = render_content(&self.raw_content, &context)?;
let res = render_content(&self.raw_content, &context)
.chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?;
self.content = res.0; self.content = res.0;
self.toc = res.1; self.toc = res.1;
Ok(()) Ok(())


Loading…
Cancel
Save