Skip to content

Commit bc674c9

Browse files
committed
refactor: move show-strong-with-alert to per-slide level and fix #123
1 parent 91d4f41 commit bc674c9

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/core.typ

+11-3
Original file line numberDiff line numberDiff line change
@@ -1685,8 +1685,16 @@
16851685
self = utils.merge-dicts(self, config)
16861686
}
16871687
assert(bodies.named().len() == 0, message: "unexpected named arguments:" + repr(bodies.named().keys()))
1688-
let setting-with-auto-offset-for-heading(body) = {
1688+
let setting-fn(body) = {
16891689
set heading(offset: self.at("slide-level", default: 0)) if self.at("auto-offset-for-heading", default: true)
1690+
show: body => {
1691+
if self.at("show-strong-with-alert", default: true) {
1692+
show strong: self.methods.alert.with(self: self)
1693+
body
1694+
} else {
1695+
body
1696+
}
1697+
}
16901698
setting(body)
16911699
}
16921700
let composer-with-side-by-side(..args) = {
@@ -1810,7 +1818,7 @@
18101818
)
18111819
header = page-preamble(self) + header
18121820
set page(..(self.page + page-extra-args + (header: header, footer: footer)))
1813-
setting-with-auto-offset-for-heading(subslide-preamble(self) + composer-with-side-by-side(..conts))
1821+
setting-fn(subslide-preamble(self) + composer-with-side-by-side(..conts))
18141822
} else {
18151823
// render all the subslides
18161824
let result = ()
@@ -1825,7 +1833,7 @@
18251833
// update the counter in the first subslide only
18261834
result.push({
18271835
set page(..(self.page + page-extra-args + (header: new-header, footer: footer)))
1828-
setting-with-auto-offset-for-heading(subslide-preamble(self) + composer-with-side-by-side(..conts))
1836+
setting-fn(subslide-preamble(self) + composer-with-side-by-side(..conts))
18291837
})
18301838
}
18311839
// return the result

src/slides.typ

-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@
3434
body => body
3535
}
3636

37-
show: body => {
38-
if self.at("show-strong-with-alert", default: true) {
39-
show strong: self.methods.alert.with(self: self)
40-
body
41-
} else {
42-
body
43-
}
44-
}
45-
4637
show: body => {
4738
if self.at("scale-list-items", default: none) != none {
4839
magic.scale-list-items(scale: self.at("scale-list-items", default: none), body)

0 commit comments

Comments
 (0)