added short/start/end arrows

This commit is contained in:
2024-06-19 17:52:56 +02:00
parent 8deb26441d
commit 27ad9da458
6 changed files with 71 additions and 10 deletions

View File

@ -1,6 +1,6 @@
#import "utils.typ": get-group-span
#import "renderer.typ": render
#import "participant.typ" as participant: _par
#import "participant.typ" as participant: _par, PAR-SPECIALS
#let _gap(size: 20) = {
return ((
@ -45,6 +45,22 @@
}
}
let pars = participants
participants = ()
participants.push(_par("[", invisible: true).first())
for (i, p) in pars.enumerate() {
let before = _par("?" + p.name, invisible: true).first()
let after = _par(p.name + "?", invisible: true).first()
if i == 0 {
participants.push(before)
} else {
participants.insert(-1, before)
}
participants.push(p)
participants.push(after)
}
participants.push(_par("]", invisible: true).first())
// Add index to participant
for (i, p) in participants.enumerate() {
p.insert("i", i)
@ -57,6 +73,12 @@
let (min-i, max-i) = get-group-span(participants, elmt)
elmts.at(i).insert("min-i", min-i)
elmts.at(i).insert("max-i", max-i)
} else if elmt.type == "seq" {
if elmt.p1 == "?" {
elmts.at(i).p1 = "?" + elmt.p2
} else if elmt.p2 == "?" {
elmts.at(i).p2 = elmt.p1 + "?"
}
}
}