Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings #185

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions logic.typ
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,14 @@
#let pause = {
// We need two separate `locate`s because `repetitions` needs to be updated
// using the new value of `pause-counter`.
locate( loc => {
if not handout-mode.at(loc) {
context {
if not handout-mode.get() {
pause-counter.step()
}
})
locate( loc => {
repetitions.update(rep => calc.max(rep, pause-counter.at(loc).first() + 1))
})
}
context {
repetitions.update(rep => calc.max(rep, pause-counter.get().first() + 1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling .get() in this closure does not work, since the context is not available in it.

Alternative:

let pauses = pause-counter.get().first() + 1
repetitions.update(rep => calc.max(rep, pauses))

}
}

#let paused-content(body) = locate( loc => {
Expand All @@ -271,24 +271,24 @@
})

#let polylux-slide(body) = {
locate( loc => {
if logical-slide.at(loc).first() > 0 {
context {
if logical-slide.get().first() > 0 {
pagebreak(weak: true)
}
})
}
logical-slide.step()
subslide.update(1)
repetitions.update(1)
pause-counter.update(0)

// Having this here is a bit unfortunate concerning separation of concerns
// but I'm not comfortable with logic depending on pdfpc...
let pdfpc-slide-markers(curr-subslide) = locate( loc => [
let pdfpc-slide-markers(curr-subslide) = context [
#metadata((t: "NewSlide")) <pdfpc>
#metadata((t: "Idx", v: counter(page).at(loc).first() - 1)) <pdfpc>
#metadata((t: "Idx", v: counter(page).get().first() - 1)) <pdfpc>
#metadata((t: "Overlay", v: curr-subslide - 1)) <pdfpc>
#metadata((t: "LogicalSlide", v: logical-slide.at(loc).first())) <pdfpc>
])
#metadata((t: "LogicalSlide", v: logical-slide.get().first())) <pdfpc>
]

pdfpc-slide-markers(1)

Expand All @@ -297,8 +297,8 @@
subslide.step()
set heading(outlined: false)

locate( loc => {
let reps = repetitions.at(loc).first()
context {
let reps = repetitions.get().first()
for curr-subslide in range(2, reps + 1) {
pause-counter.update(0)
pagebreak(weak: true)
Expand All @@ -308,5 +308,5 @@
body
subslide.step()
}
})
}
}
20 changes: 10 additions & 10 deletions utils/utils.typ
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@
})
})

#let current-section = locate( loc => {
let sections = sections-state.at(loc)
#let current-section = context {
let sections = sections-state.get()
if sections.len() > 0 {
sections.last().body
} else {
[]
}
})
}

#let polylux-outline(enum-args: (:), padding: 0pt) = locate( loc => {
let sections = sections-state.final(loc)
#let polylux-outline(enum-args: (:), padding: 0pt) = context {
let sections = sections-state.final()
pad(padding, enum(
..enum-args,
..sections.map(section => link(section.loc, section.body))
))
})
}


// PROGRESS

#let polylux-progress(ratio-to-content) = locate( loc => {
let ratio = logic.logical-slide.at(loc).first() / logic.logical-slide.final(loc).first()
#let polylux-progress(ratio-to-content) = context {
let ratio = logic.logical-slide.get().first() / logic.logical-slide.final().first()
ratio-to-content(ratio)
})
}

#let last-slide-number = locate(loc => logic.logical-slide.final(loc).first())
#let last-slide-number = context { logic.logical-slide.final().first() }


// HEIGHT FITTING
Expand Down