diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs
index 2b05c30e..f1901626 100644
--- a/src/renderer/html_handlebars/hbs_renderer.rs
+++ b/src/renderer/html_handlebars/hbs_renderer.rs
@@ -220,12 +220,7 @@ impl HtmlHandlebars {
}
fn register_hbs_helpers(&self, handlebars: &mut Handlebars, html_config: &HtmlConfig) {
- handlebars.register_helper(
- "toc",
- Box::new(helpers::toc::RenderToc {
- no_section_label: html_config.no_section_label,
- }),
- );
+ handlebars.register_helper("toc", Box::new(helpers::toc::toc));
handlebars.register_helper("previous", Box::new(helpers::navigation::previous));
handlebars.register_helper("next", Box::new(helpers::navigation::next));
}
@@ -402,12 +397,12 @@ fn make_data(
json!(config.book.description.clone().unwrap_or_default()),
);
data.insert("favicon".to_owned(), json!("favicon.png"));
+
if let Some(ref livereload) = html_config.livereload_url {
data.insert("livereload".to_owned(), json!(livereload));
}
- // Add google analytics tag
- if let Some(ref ga) = config.html_config().and_then(|html| html.google_analytics) {
+ if let Some(ref ga) = html.google_analytics {
data.insert("google_analytics".to_owned(), json!(ga));
}
@@ -415,6 +410,10 @@ fn make_data(
data.insert("mathjax_support".to_owned(), json!(true));
}
+ if html.no_section_label {
+ data.insert("no_section_label".to_owned(), json!(true));
+ }
+
// Add check to see if there is an additional style
if !html.additional_css.is_empty() {
let mut css = Vec::new();
diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs
index 0cb19174..6529679e 100644
--- a/src/renderer/html_handlebars/helpers/navigation.rs
+++ b/src/renderer/html_handlebars/helpers/navigation.rs
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use std::path::Path;
-use handlebars::{Context, Handlebars, Helper, RenderContext, RenderError, Renderable};
+use handlebars::{Context, Handlebars, Helper, RenderContext, RenderError, Renderable, HelperResult, Output};
use serde_json;
use utils;
@@ -45,15 +45,15 @@ impl Target {
}
}
-fn find_chapter(rc: &mut RenderContext, target: Target) -> Result