diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs
index 8b300a94..82026dfd 100644
--- a/src/renderer/html_handlebars/helpers/navigation.rs
+++ b/src/renderer/html_handlebars/helpers/navigation.rs
@@ -60,12 +60,13 @@ pub fn previous(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext
match previous.get("path") {
Some(p) => {
+ // Hack for windows who tends to use `\` as separator instead of `/`
let path = Path::new(p).with_extension("html");
debug!("[*]: Inserting link: {:?}", path);
match path.to_str() {
Some(p) => {
- previous_chapter.insert("link".to_owned(), p.to_json());
+ previous_chapter.insert("link".to_owned(), p.replace("\\", "/").to_json());
},
None => {
return Err(RenderError {
@@ -170,7 +171,8 @@ pub fn next(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) ->
match link.to_str() {
Some(l) => {
- next_chapter.insert("link".to_owned(), l.to_json());
+ // Hack for windows who tends to use `\` as separator instead of `/`
+ next_chapter.insert("link".to_owned(), l.replace("\\", "/").to_json());
},
None => return Err(RenderError { desc: "Link could not converted to str".to_owned() }),
}
diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs
index 9f4e142d..7ecb4da6 100644
--- a/src/renderer/html_handlebars/helpers/toc.rs
+++ b/src/renderer/html_handlebars/helpers/toc.rs
@@ -68,6 +68,8 @@ impl HelperDef for RenderToc {
.with_extension("html")
.to_str()
.unwrap()
+ // Hack for windows who tends to use `\` as separator instead of `/`
+ .replace("\\", "/")
.as_bytes()));
try!(rc.writer.write("\"".as_bytes()));
@@ -98,7 +100,8 @@ impl HelperDef for RenderToc {
// filter all events that are not inline code blocks
let parser = Parser::new(&name).filter(|event| {
match event {
- &Event::Start(Tag::Code) | &Event::End(Tag::Code) => true,
+ &Event::Start(Tag::Code) |
+ &Event::End(Tag::Code) => true,
&Event::InlineHtml(_) => true,
&Event::Text(_) => true,
_ => false,