Skip to content

Commit

Permalink
fix Handle draft chapters (#59)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
felixhuettner and dylanowen authored Feb 10, 2023
1 parent bf6f3fe commit 98b231a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<R: GraphvizRenderer> Graphviz<R> {
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 => {
Expand All @@ -103,6 +103,10 @@ impl<R: GraphvizRenderer> Graphviz<R> {
// 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
Expand Down

0 comments on commit 98b231a

Please sign in to comment.