Skip to content

Commit

Permalink
fix: fix slide-level bug
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed Mar 7, 2024
1 parent 02dc029 commit 03da481
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion slide.typ
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@

// touying-slides
#let touying-slides(self: none, slide-level: 1, body) = {
// make sure 0 <= slide-level <= 2
assert(type(slide-level) == int and 0 <= slide-level and slide-level <= 2, message: "slide-level should be 0, 1 or 2")
// init
let (section, subsection, title, slide) = (none, none, none, ())
let last-title = none
Expand Down Expand Up @@ -447,7 +449,7 @@
(child.value.at("fn"))(..child.value.at("args"))
}
(section, subsection, title, slide) = (none, none, none, ())
} else if type(child) == content and child.func() == heading and utils.heading-depth(child) in (1, 2, 3) {
} else if type(child) == content and child.func() == heading and utils.heading-depth(child) <= slide-level + 1 {
slide = utils.trim(slide)
if (utils.heading-depth(child) == 1 and section != none) or (utils.heading-depth(child) == 2 and subsection != none) or (utils.heading-depth(child) > slide-level and title != none) or slide != () {
(self.methods.slide)(self: self, section: section, subsection: subsection, ..(if last-title != none { (title: last-title) }), slide.sum(default: []))
Expand Down

0 comments on commit 03da481

Please sign in to comment.