I’m having an issue with accessing context data in a helper function
#let direct-trace(location, display-text) = {
let content = display-text
show link: set underline(stroke: 0pt)
link(location)[
#set text(fill: purple.darken(30%), weight: "bold", size: 0.9em)
#box(
fill: purple.lighten(96%),
stroke: 0.5pt + purple.lighten(60%),
radius: 2pt,
inset: (x: 3pt, y: 0pt),
outset: (y: 2.5pt),
content
)
]
}
#let addressed-by(target-id) = context {
let addressing = []
let count = 0
for (a, location, b) in addr-list.final() {
if a == target-id {
addressing += direct-trace(location, a)
count += 1
}
}
(addressing, count)
}
#context addressed-by("UEB-cost-predictability") //works
#let (addr, count) = addressed-by("UEB-cost-predictability") //does not work
addr-list is a global state variable that keeps track of what things have been addressed. I tried to create a helper function that retrieves the final count of addressed concerns and formats the references found.
However, I can’t seem to ‘unwrap’ the data out of the context. Writing the context directly to content does produce the right output. Is there a way to get the inner content and use it in a function?