diff --git a/mdbook-course/src/course.rs b/mdbook-course/src/course.rs index c2c45a58..d8d073d8 100644 --- a/mdbook-course/src/course.rs +++ b/mdbook-course/src/course.rs @@ -447,6 +447,13 @@ impl Slide { Ok(()) } + /// Determine whether the given chapter is a sub-chapter of this slide. + pub fn is_sub_chapter(&self, chapter: &Chapter) -> bool { + // The first `source_path` in the slide is the "parent" chapter, so anything + // else is a sub-chapter. + chapter.source_path.as_ref() != self.source_paths.get(0) + } + /// Return the total duration of this slide. pub fn minutes(&self) -> u64 { self.minutes diff --git a/mdbook-course/src/timing_info.rs b/mdbook-course/src/timing_info.rs index 2eb3bd05..2bcfa4f4 100644 --- a/mdbook-course/src/timing_info.rs +++ b/mdbook-course/src/timing_info.rs @@ -17,7 +17,10 @@ use mdbook::book::Chapter; /// Insert timing information for this slide into the speaker notes. pub fn insert_timing_info(slide: &Slide, chapter: &mut Chapter) { - if slide.minutes > 0 && chapter.content.contains("
") { + if slide.minutes > 0 + && !slide.is_sub_chapter(chapter) + && chapter.content.contains("
") + { // Include the minutes in the speaker notes. let minutes = slide.minutes; let plural = if slide.minutes == 1 {