Merge pull request #1309 from nerosnm/add-missing-space

Fix missing space before draft chapter titles
This commit is contained in:
Eric Huss 2020-09-06 09:40:55 -07:00 committed by GitHub
commit 4b773024ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 21 deletions

View File

@ -108,8 +108,10 @@ impl HelperDef for RenderToc {
} }
// Link // Link
let path_exists = if let Some(path) = item.get("path") { let path_exists = if let Some(path) =
if !path.is_empty() { item.get("path")
.and_then(|p| if p.is_empty() { None } else { Some(p) })
{
out.write("<a href=\"")?; out.write("<a href=\"")?;
let tmp = Path::new(item.get("path").expect("Error: path should be Some(_)")) let tmp = Path::new(item.get("path").expect("Error: path should be Some(_)"))
@ -131,9 +133,7 @@ impl HelperDef for RenderToc {
out.write(">")?; out.write(">")?;
true true
} else { } else {
false out.write("<div>")?;
}
} else {
false false
}; };
@ -165,6 +165,8 @@ impl HelperDef for RenderToc {
if path_exists { if path_exists {
out.write("</a>")?; out.write("</a>")?;
} else {
out.write("</div>")?;
} }
// Render expand/collapse toggle // Render expand/collapse toggle