added notes
This commit is contained in:
@ -57,7 +57,8 @@
|
||||
|
||||
// List participants
|
||||
let linked = ()
|
||||
for elmt in elmts {
|
||||
let last-seq = none
|
||||
for (i, elmt) in elmts.enumerate() {
|
||||
if elmt.type == "par" {
|
||||
participants.push(elmt)
|
||||
} else if elmt.type == "seq" {
|
||||
@ -73,15 +74,44 @@
|
||||
participants.at(i).from-start = false
|
||||
}
|
||||
|
||||
let p1 = elmt.p1
|
||||
let p2 = elmt.p2
|
||||
if elmt.p1 == "?" {
|
||||
linked.push("?" + elmt.p2)
|
||||
} else {
|
||||
linked.push(elmt.p1)
|
||||
p1 = "?" + elmt.p2
|
||||
}
|
||||
if elmt.p2 == "?" {
|
||||
linked.push(elmt.p1 + "?")
|
||||
} else {
|
||||
linked.push(elmt.p2)
|
||||
p2 = elmt.p1 + "?"
|
||||
}
|
||||
linked.push(p1)
|
||||
linked.push(p2)
|
||||
last-seq = (
|
||||
elmt: elmt,
|
||||
i: i,
|
||||
p1: p1,
|
||||
p2: p2
|
||||
)
|
||||
} else if elmt.type == "note" {
|
||||
elmt.insert("linked", elmt.pos == none and elmt.side != "across")
|
||||
if elmt.pos == none and elmt.side != "across" {
|
||||
let names = participants.map(p => p.name)
|
||||
let i1 = names.position(n => n == last-seq.p1)
|
||||
let i2 = names.position(n => n == last-seq.p2)
|
||||
let pars = ((i1, last-seq.p1), (i2, last-seq.p2)).sorted(key: p => p.first())
|
||||
if elmt.side == "left" {
|
||||
elmt.pos = pars.first().last()
|
||||
} else if elmt.side == "right" {
|
||||
elmt.pos = pars.last().last()
|
||||
}
|
||||
|
||||
let seq = last-seq.elmt
|
||||
seq.insert("linked-note", elmt)
|
||||
elmts.at(last-seq.i) = seq
|
||||
}
|
||||
elmts.at(i) = elmt
|
||||
if elmt.side == "left" {
|
||||
linked.push("[")
|
||||
} else if elmt.side == "right" {
|
||||
linked.push("]")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,6 +167,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
set text(font: "Source Sans 3")
|
||||
render(participants, elmts)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user