From 98b231a8ac9b1f4dc2bf7e0a55224834d6ec7f73 Mon Sep 17 00:00:00 2001 From: felixhuettner Date: Fri, 10 Feb 2023 15:52:27 +0100 Subject: [PATCH] fix Handle draft chapters (#59) * Update depedencies there seems to have been a change in the toml dependency that breaks the current code. * Fix handling of draft chapters otherwise we will not render things that are below daft chapters. --------- Co-authored-by: Dylan Owen --- src/preprocessor.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/preprocessor.rs b/src/preprocessor.rs index a198469..188a3ff 100644 --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -79,7 +79,7 @@ impl Graphviz { for item in mem::take(items) { item_futures.push(async { match item { - BookItem::Chapter(chapter) if chapter.path.is_some() => { + BookItem::Chapter(chapter) => { self.process_chapter(chapter).await.map(BookItem::Chapter) } item => { @@ -103,6 +103,10 @@ impl Graphviz { // make sure to process our chapter sub-items self.process_sub_items(&mut chapter.sub_items).await?; + if chapter.path.is_none() { + return Ok(chapter); + } + // assume we've already filtered out all the draft chapters let mut chapter_path = self.src_dir.join(chapter.path.as_ref().unwrap()); // remove the chapter filename