template-thesis-matisse/lib/todos.typ
Jean-Marie Mineau a1a6d7cff8
wip
2025-06-11 17:27:51 +02:00

21 lines
711 B
Typst

#let todo-list = state("todo-list",())
#let show-todos = state("show-todos", true)
#let todo(done: false, content) = context {
if (not done) and (show-todos.get()) {
let todonum = todo-list.get().len() + 1
text(weight: "bold", fill: red, [TODO #todonum #label("todo-"+str(todonum)): #content])
todo-list.update(x => x + (("todo-"+str(x.len()+1),x.len()+1, content),))
}
}
#let todos() = context {
if (todo-list.final().len() != 0) and (show-todos.get()) {
pagebreak(weak: true)
text(size: 2em, weight: "bold", fill:red)[TO-DOs]
for t in todo-list.final() {
let l = label(t.first())
list.item(link(l)[TODO #t.at(1) p.#locate(l).page() : #t.last()])
}
}
}