diff --git a/Cargo.lock b/Cargo.lock index 64901732..bdaa785d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,26 +399,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "handlebars" -version = "2.0.2" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "hashbrown" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "heck" version = "0.3.1" @@ -471,7 +462,7 @@ name = "humantime" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -684,7 +675,7 @@ dependencies = [ "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "gitignore 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "handlebars 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "handlebars 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1007,7 +998,7 @@ dependencies = [ [[package]] name = "quick-error" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1734,8 +1725,7 @@ dependencies = [ "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" "checksum gitignore 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5beed3b526478bebc1dd164b7aa770ae709f918a7b978fcb4afdaf3bbee8dfd" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum handlebars 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "91ef1ac30f2eaaa2b835fce73c57091cb6b9fc62b7eef285efbf980b0f20001b" -"checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353" +"checksum handlebars 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bb959f7ef68cdfd3bf80efac8cc370942f6480400fee7e150b06dc0dd1ad806" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" "checksum html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce65ac8028cf5a287a7dbf6c4e0a6cf2dcf022ed5b167a81bae66ebf599a8b7" @@ -1800,7 +1790,7 @@ dependencies = [ "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" "checksum pulldown-cmark 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1c205cc82214f3594e2d50686730314f817c67ffa80fe800cf0db78c3c2b9d9e" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" diff --git a/Cargo.toml b/Cargo.toml index 55fde044..e0a2b901 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ chrono = "0.4" clap = "2.24" env_logger = "0.6" error-chain = "0.12" -handlebars = { version = "2.0", default-features = false, features = ["no_dir_source"] } +handlebars = "3.0" itertools = "0.8" lazy_static = "1.0" log = "0.4" diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 04284c50..bf27ec34 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -212,7 +212,7 @@ impl HtmlHandlebars { ); } - fn register_hbs_helpers(&self, handlebars: &mut Handlebars, html_config: &HtmlConfig) { + fn register_hbs_helpers(&self, handlebars: &mut Handlebars<'_>, html_config: &HtmlConfig) { handlebars.register_helper( "toc", Box::new(helpers::toc::RenderToc { @@ -705,7 +705,7 @@ fn partition_source(s: &str) -> (String, String) { } struct RenderItemContext<'a> { - handlebars: &'a Handlebars, + handlebars: &'a Handlebars<'a>, destination: PathBuf, data: serde_json::Map, is_index: bool, diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs index 5914d42f..9d9ea76d 100644 --- a/src/renderer/html_handlebars/helpers/navigation.rs +++ b/src/renderer/html_handlebars/helpers/navigation.rs @@ -46,7 +46,7 @@ impl Target { fn find_chapter( ctx: &Context, - rc: &mut RenderContext<'_>, + rc: &mut RenderContext<'_, '_>, target: Target, ) -> Result, RenderError> { debug!("Get data from context"); @@ -108,9 +108,9 @@ fn find_chapter( fn render( _h: &Helper<'_, '_>, - r: &Handlebars, + r: &Handlebars<'_>, ctx: &Context, - rc: &mut RenderContext<'_>, + rc: &mut RenderContext<'_, '_>, out: &mut dyn Output, chapter: &StringMap, ) -> Result<(), RenderError> { @@ -150,7 +150,7 @@ fn render( _h.template() .ok_or_else(|| RenderError::new("Error with the handlebars template")) .and_then(|t| { - let mut local_rc = rc.new_for_block(); + let mut local_rc = rc.clone(); let local_ctx = Context::wraps(&context)?; t.render(r, &local_ctx, &mut local_rc, out) })?; @@ -160,9 +160,9 @@ fn render( pub fn previous( _h: &Helper<'_, '_>, - r: &Handlebars, + r: &Handlebars<'_>, ctx: &Context, - rc: &mut RenderContext<'_>, + rc: &mut RenderContext<'_, '_>, out: &mut dyn Output, ) -> Result<(), RenderError> { trace!("previous (handlebars helper)"); @@ -176,9 +176,9 @@ pub fn previous( pub fn next( _h: &Helper<'_, '_>, - r: &Handlebars, + r: &Handlebars<'_>, ctx: &Context, - rc: &mut RenderContext<'_>, + rc: &mut RenderContext<'_, '_>, out: &mut dyn Output, ) -> Result<(), RenderError> { trace!("next (handlebars helper)"); diff --git a/src/renderer/html_handlebars/helpers/theme.rs b/src/renderer/html_handlebars/helpers/theme.rs index 297ba10d..809ee117 100644 --- a/src/renderer/html_handlebars/helpers/theme.rs +++ b/src/renderer/html_handlebars/helpers/theme.rs @@ -2,9 +2,9 @@ use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError pub fn theme_option( h: &Helper<'_, '_>, - _r: &Handlebars, + _r: &Handlebars<'_>, ctx: &Context, - rc: &mut RenderContext<'_>, + rc: &mut RenderContext<'_, '_>, out: &mut dyn Output, ) -> Result<(), RenderError> { trace!("theme_option (handlebars helper)"); diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index 9d810398..b77c7e94 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -16,9 +16,9 @@ impl HelperDef for RenderToc { fn call<'reg: 'rc, 'rc>( &self, _h: &Helper<'reg, 'rc>, - _r: &'reg Handlebars, + _r: &'reg Handlebars<'_>, ctx: &'rc Context, - rc: &mut RenderContext<'reg>, + rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output, ) -> Result<(), RenderError> { // get value from context data