I’m currently working on my thesis and to keep an overview of my progress and to dos, i have created a kind of project diary where i have a template for each day in which i note down what i did, decisions i made, next steps etc.
in each day i note down open to dos using the “cheq” package.
Now, in my main document, i would like to have an overview of all currently open tasks (potentially grouped by topic)
is there a simple way to implement something like this? I already checked out the “query” function, but seems like only some limited number of elements (like headings) can be referenced.
I am quite new to typst and scripting, so any hint would be appreciated!
It’s true that query is limited in what it can be used to find, but one of those things is metadata. This does not add anything to the document but can be queried so it can be used for this purpose:
#let todo(topic, message, done: false) = {
[#metadata((
topic: topic,
message: message,
done: done
))<todo>]
message
}
Tody I will need to #todo("Weekly", "take out the trash") since it is Wednesday.
Every morning I need to #todo("Daily", "check the mail") and #todo("Daily", "make the bed", done: true).
= ToDos
#context {
let todos = query(<todo>).map(t => t.value)
let topics = todos.map(t => t.topic).dedup()
for topic in topics {
heading(topic, level: 2)
let todos-in-topic = todos.filter(t => t.topic == topic)
let rows = todos-in-topic.map(t => (if t.done {sym.square.filled} else {sym.square.stroked}, t.message)).flatten()
table(
columns: 2,
table.header[Done][Task],
..rows
)
}
}
I haven’t tried it with multiple files but it should work.
1 Like
