Update toc.rs

This commit is contained in:
expikr 2024-04-16 08:45:43 -07:00
parent c671c2e904
commit 683270946c
1 changed files with 6 additions and 6 deletions

View File

@ -74,12 +74,6 @@ impl HelperDef for RenderToc {
let mut is_first_chapter = ctx.data().get("is_index").is_some(); let mut is_first_chapter = ctx.data().get("is_index").is_some();
for item in chapters { for item in chapters {
// Spacer
if item.get("spacer").is_some() {
out.write("<li class=\"spacer\"></li>")?;
continue;
}
let (section, level) = if let Some(s) = item.get("section") { let (section, level) = if let Some(s) = item.get("section") {
(s.as_str(), s.matches('.').count()) (s.as_str(), s.matches('.').count())
} else { } else {
@ -118,6 +112,12 @@ impl HelperDef for RenderToc {
} }
} }
// Spacer
if item.get("spacer").is_some() {
out.write("<li class=\"spacer\"></li>")?;
continue;
}
// Part title // Part title
if let Some(title) = item.get("part") { if let Some(title) = item.get("part") {
out.write("<li class=\"part-title\">")?; out.write("<li class=\"part-title\">")?;