-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht-tag.typ
40 lines (34 loc) · 1.06 KB
/
t-tag.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#import "t-attributes.typ": *
#import "@preview/xarrow:0.3.0": xarrow
#let pif = math.partial
#let sp = math.display(" ")
#let to-string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(to-string).join("")
} else if content.has("body") {
to-string(content.body)
} else if content == [ ] {
" "
}
}
#let task-collector = state("task-collector", ())
#let task(content) = [
#text(green, style: "normal", [
#place[#figure(kind: "task", supplement: none)[]#label(to-string(content))]
[TODO: #content]
])
#task-collector.update(x => { x.push((to-string(content), label(to-string(content)))); x })
]
#let task-display() = context table(
columns: 2,
..{
let map = it => ([#ref(it.at(1))], [#it.at(0)]);
task-collector.final().map(map).flatten()
}
)
#let tag(name) = strong[
#place[#figure(kind: "Entry", supplement: none)[ ]#label(to-string[#name])]
$strong(angle.l)$#counter(figure).display()$strong(angle.r)$
]