diff --git a/lib.typ b/lib.typ index 9d69e41..477aabe 100644 --- a/lib.typ +++ b/lib.typ @@ -1,20 +1,24 @@ #import "@preview/gviz:0.1.0": * #let todo-list = state("todo-list",()) +#let show-todos = state("show-todos", true) -#let todo(content) = context { - let todonum = todo-list.get().len() + 1 - text(weight: "bold", fill: red, [TODO n°#todonum #label("todo-"+str(todonum)): #content]) - todo-list.update(x => x + (("todo-"+str(x.len()+1),x.len()+1, content),)) +#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 n°#todonum #label("todo-"+str(todonum)): #content]) + todo-list.update(x => x + (("todo-"+str(x.len()+1),x.len()+1, content),)) + } } #let todos() = context { - pagebreak(weak: true) - [= TO-DOs] - for t in todo-list.final() { - let l = label(t.first()) - list.item(link(l)[TODO n°#t.at(1) p.#locate(l).page() : #t.last()]) - + if (todo-list.final().len() != 0) and (show-todos.get()) { + pagebreak(weak: true) + [= TO-DOs] + for t in todo-list.final() { + let l = label(t.first()) + list.item(link(l)[TODO n°#t.at(1) p.#locate(l).page() : #t.last()]) + } } }