From 2fb489137bc6769be5b3ab195937c5d00f51357e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Mortensen?= Date: Mon, 31 Aug 2020 10:00:03 +0100 Subject: [PATCH] Wrap draft chapter titles in a
Fixes the problem of a missing space before the title of draft chapters, due to the title not being wrapped in an ``. --- src/renderer/html_handlebars/helpers/toc.rs | 44 +++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index 47eda596..7a5d8a28 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -108,32 +108,32 @@ impl HelperDef for RenderToc { } // Link - let path_exists = if let Some(path) = item.get("path") { - if !path.is_empty() { - out.write("")?; - true - } else { - false + if path == ¤t_path { + out.write(" class=\"active\"")?; } + + out.write(">")?; + true } else { + out.write("
")?; false }; @@ -165,6 +165,8 @@ impl HelperDef for RenderToc { if path_exists { out.write("")?; + } else { + out.write("
")?; } // Render expand/collapse toggle