diff --git a/book-example/book/README.html b/book-example/book/README.html
index e84bc906..c9ff38be 100644
--- a/book-example/book/README.html
+++ b/book-example/book/README.html
@@ -24,7 +24,7 @@
-
+
mdBook
mdBook is a command line tool and Rust library to create books using Markdown.
@@ -42,15 +42,15 @@ Issues and feature requests can be posted on the
-
-
+
+
+
diff --git a/book-example/book/book.js b/book-example/book/book.js
index d3cff82f..643755e5 100644
--- a/book-example/book/book.js
+++ b/book-example/book/book.js
@@ -14,13 +14,4 @@ $( document ).ready(function() {
}
});
-
- // Hide navigation icons when there is no next or previous link
- // JavaScript Solution until I find a way to do this in the template
- $(".nav-chapters").each(function(){
- if(!$(this).attr('href')){
- this.remove();
- }
- });
-
});
diff --git a/book-example/book/cli/build.html b/book-example/book/cli/build.html
index d1817cce..93b623c4 100644
--- a/book-example/book/cli/build.html
+++ b/book-example/book/cli/build.html
@@ -24,7 +24,7 @@
-
+
The build command
The build command is used to render your book:
@@ -49,15 +49,19 @@ current working directory.
Doesn't seem to work: using JavaScript
alternative until I find a way to do it in the template
-->
+
+
+
+
diff --git a/book-example/book/cli/cli-tool.html b/book-example/book/cli/cli-tool.html
index 092236fc..353fe924 100644
--- a/book-example/book/cli/cli-tool.html
+++ b/book-example/book/cli/cli-tool.html
@@ -24,7 +24,7 @@
-
+
Command Line Tool
mdBook can be used either as a command line tool or a Rust library.
@@ -37,15 +37,19 @@ Let's focus on the command line tool capabilities first.
Doesn't seem to work: using JavaScript
alternative until I find a way to do it in the template
-->
+
+
+
+
diff --git a/book-example/book/cli/init.html b/book-example/book/cli/init.html
index 6bb81684..2044d848 100644
--- a/book-example/book/cli/init.html
+++ b/book-example/book/cli/init.html
@@ -24,7 +24,7 @@
-
+
The init command
The init command, used like this:
@@ -66,15 +66,19 @@ not create the corresponding files, init command should create the files for him
Doesn't seem to work: using JavaScript
alternative until I find a way to do it in the template
-->
+
+
+
+
diff --git a/book-example/book/format/config.html b/book-example/book/format/config.html
index c6bf15d3..f37a6042 100644
--- a/book-example/book/format/config.html
+++ b/book-example/book/format/config.html
@@ -24,7 +24,7 @@
-
+
Configuration
You can configure the parameters for your book in the book.json
file.
@@ -48,15 +48,15 @@
Doesn't seem to work: using JavaScript
alternative until I find a way to do it in the template
-->
+
+
-
-
-
+
diff --git a/book-example/book/index.html b/book-example/book/index.html
index e84bc906..c9ff38be 100644
--- a/book-example/book/index.html
+++ b/book-example/book/index.html
@@ -24,7 +24,7 @@
-
+
mdBook
mdBook is a command line tool and Rust library to create books using Markdown.
@@ -42,15 +42,15 @@ Issues and feature requests can be posted on the
-
-
+
+
+
diff --git a/src/renderer/html_handlebars/hbs_navigation_helper.rs b/src/renderer/html_handlebars/hbs_navigation_helper.rs
index b7a699c3..cb8209e4 100644
--- a/src/renderer/html_handlebars/hbs_navigation_helper.rs
+++ b/src/renderer/html_handlebars/hbs_navigation_helper.rs
@@ -1,82 +1,168 @@
extern crate handlebars;
extern crate rustc_serialize;
-use std::path::{PathBuf};
+use std::path::{PathBuf, Path};
use std::collections::BTreeMap;
-use self::rustc_serialize::json;
-use self::handlebars::{Handlebars, RenderError, RenderContext, Helper, Context};
+use self::rustc_serialize::json::{self, ToJson};
+use self::handlebars::{Handlebars, RenderError, RenderContext, Helper, Context, Renderable};
// Handlebars helper for navigation
-pub fn previous(c: &Context, _h: &Helper, _: &Handlebars, rc: &mut RenderContext) -> Result<(), RenderError> {
+pub fn previous(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) -> Result<(), RenderError> {
+ debug!("[fn]: previous (handlebars helper)");
+ debug!("[*]: Get data from context");
// get value from context data
// rc.get_path() is current json parent path, you should always use it like this
// param is the key of value you want to display
let chapters = c.navigate(rc.get_path(), "chapters");
- let current = c.navigate(rc.get_path(), "path").to_string().replace("\"", "");
- let path_to_root = c.navigate(rc.get_path(), "path_to_root").to_string().replace("\"", "");
- try!(rc.writer.write(path_to_root.as_bytes()));
+ let current = c.navigate(rc.get_path(), "path")
+ .to_string()
+ .replace("\"", "");
+ let path_to_root = PathBuf::from(
+ c.navigate(rc.get_path(), "path_to_root")
+ .to_string()
+ .replace("\"", "")
+ );
+
+ debug!("[*]: Decode chapters from JSON");
// Decode json format
- let decoded: Vec