numbered todos and todo-list

main
dorianx 2024-03-21 16:01:08 +01:00
parent f80a8573d3
commit d4b11cd25c
1 changed files with 19 additions and 4 deletions

23
lib.typ
View File

@ -1,5 +1,23 @@
#import "@preview/gviz:0.1.0": *
#let todo-list = state("todo-list",())
#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 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()])
}
}
#let notes-template(doc) = [
#show raw.where(lang: "dot-render"): it => render-image(it.text)
#show raw.where(lang: "digraphLR"): it => render-image("digraph mygraph { rankdir=\"LR\";" + it.text + "}")
@ -7,8 +25,5 @@
#show raw.where(lang: "graphLR"): it => render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
#show raw.where(lang: "graphTB"): it => render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
#doc
#todos
]
#let todo(content) = {
text(weight: "bold", fill: red, [{TODO : #content}])
}