diff --git a/Cargo.toml b/Cargo.toml index b036bc55..b203f8fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,13 +15,14 @@ exclude = [ ] [dependencies] -clap = "2.2.1" -handlebars = { version = "0.20.0", features = ["serde_type"] } -serde = "0.8.17" -serde_json = "0.8.3" +clap = "2.19.2" +handlebars = { version = "0.23.0", features = ["serde_type"] } +serde = "0.8" +serde_json = "0.8" pulldown-cmark = "0.0.8" log = "0.3" -env_logger = "0.3.4" +env_logger = "0.3" +toml = { version = "0.2", features = ["serde"] } # Watch feature notify = { version = "2.5.5", optional = true } @@ -33,12 +34,10 @@ iron = { version = "0.4", optional = true } staticfile = { version = "0.3", optional = true } ws = { version = "0.5.1", optional = true} - # Tests [dev-dependencies] tempdir = "0.3.4" - [features] default = ["output", "watch", "serve"] debug = [] diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs index 5c135861..58c90100 100644 --- a/src/renderer/html_handlebars/helpers/navigation.rs +++ b/src/renderer/html_handlebars/helpers/navigation.rs @@ -1,10 +1,11 @@ use std::path::Path; -use std::collections::BTreeMap; +use std::collections::{VecDeque, BTreeMap}; use serde_json; use serde_json::value::ToJson; use handlebars::{Handlebars, RenderError, RenderContext, Helper, Context, Renderable}; + // Handlebars helper for navigation pub fn previous(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) -> Result<(), RenderError> { @@ -14,9 +15,9 @@ pub fn previous(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext // 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 chapters = c.navigate(rc.get_path(), &VecDeque::new(), "chapters"); - let current = c.navigate(rc.get_path(), "path") + let current = c.navigate(rc.get_path(), &VecDeque::new(), "path") .to_string() .replace("\"", ""); @@ -114,9 +115,9 @@ pub fn next(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) -> // 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 chapters = c.navigate(rc.get_path(), &VecDeque::new(), "chapters"); - let current = c.navigate(rc.get_path(), "path") + let current = c.navigate(rc.get_path(), &VecDeque::new(), "path") .to_string() .replace("\"", ""); diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index f5ec6c46..07a6b36d 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -1,5 +1,5 @@ use std::path::Path; -use std::collections::BTreeMap; +use std::collections::{VecDeque, BTreeMap}; use serde_json; use handlebars::{Handlebars, HelperDef, RenderError, RenderContext, Helper, Context}; @@ -15,8 +15,8 @@ impl HelperDef for RenderToc { // 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 chapters = c.navigate(rc.get_path(), &VecDeque::new(), "chapters"); + let current = c.navigate(rc.get_path(), &VecDeque::new(), "path").to_string().replace("\"", ""); try!(rc.writer.write("