update dependency versions

This commit is contained in:
Gambhiro 2016-12-23 08:10:42 +00:00
parent e53dcdcf4d
commit f67ae7c71a
3 changed files with 15 additions and 15 deletions

View File

@ -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 = []

View File

@ -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("\"", "");

View File

@ -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("<ul class=\"chapter\">".as_bytes()));
// Decode json format