From 0a4a2b66da843e3c36c17e6c77d85c34cb2617f0 Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Fri, 1 Sep 2017 08:20:27 +0200 Subject: [PATCH] Fix the print title that was using the title from the last rendered chapter. Fixes #414 --- src/renderer/html_handlebars/hbs_renderer.rs | 3 +++ src/theme/index.hbs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 9ace5dcc..0333999a 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -207,6 +207,9 @@ impl HtmlHandlebars { /// Update the context with data for this file fn configure_print_version(&self, data: &mut serde_json::Map, print_content: &str) { + // Make sure that the Print chapter does not display the title from + // the last rendered chapter by removing it from its context + data.remove("chapter_title"); data.insert("path".to_owned(), json!("print.md")); data.insert("content".to_owned(), json!(print_content)); data.insert("path_to_root".to_owned(), json!(utils::fs::path_to_root(Path::new("print.md")))); diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 9340ba7a..2d30bbf0 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -2,7 +2,7 @@ - {{ chapter_title }} - {{ title }} + {{ chapter_title }} {{#if chapter_title }}-{{/if}} {{ title }}