Skip to content

Commit

Permalink
feat: make composer parameter simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed Mar 25, 2024
1 parent 08b1c98 commit 7b09ec3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions slide.typ
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
self: none,
repeat: auto,
setting: body => body,
composer: utils.side-by-side,
composer: auto,
section: none,
subsection: none,
title: none,
Expand All @@ -339,6 +339,13 @@
let setting-with-pad(body) = {
pad(..self.padding, setting(body))
}
let composer-with-side-by-side(..args) = {
if type(composer) == function {
composer(..args)
} else {
utils.side-by-side(columns: composer, ..args)
}
}
let bodies = bodies.pos()
let page-preamble(curr-subslide) = locate(loc => {
if loc.page() == self.first-slide-number {
Expand Down Expand Up @@ -385,7 +392,7 @@
return {
header = _update-states(1) + header
page(..(self.page-args + (header: header, footer: footer)), setting-with-pad(
page-preamble(1) + composer(..bodies)
page-preamble(1) + composer-with-side-by-side(..bodies)
))
}
}
Expand All @@ -403,7 +410,7 @@
let (conts, _) = _parse-content(self: self, index: repeat, ..bodies)
header = _update-states(1) + header
page(..(self.page-args + (header: header, footer: footer)), setting-with-pad(
page-preamble(1) + composer(..conts)
page-preamble(1) + composer-with-side-by-side(..conts)
))
} else {
// render all the subslides
Expand All @@ -418,7 +425,7 @@
}
result.push(page(
..(self.page-args + (header: new-header, footer: footer)),
setting-with-pad(page-preamble(i) + composer(..conts)),
setting-with-pad(page-preamble(i) + composer-with-side-by-side(..conts)),
))
}
// return the result
Expand Down

0 comments on commit 7b09ec3

Please sign in to comment.