diff --git a/gallery/doc_examples.pdf b/gallery/doc_examples.pdf index 35074c3..b06233e 100644 Binary files a/gallery/doc_examples.pdf and b/gallery/doc_examples.pdf differ diff --git a/gallery/doc_examples.typ b/gallery/doc_examples.typ index 68def41..d455879 100644 --- a/gallery/doc_examples.typ +++ b/gallery/doc_examples.typ @@ -267,6 +267,20 @@ @enduml ``` ), + ( + [Delay], + ``` + @startuml + + Alice -> Bob: Authentication Request + ... + Bob --> Alice: Authentication Response + ...5 minutes later... + Bob --> Alice: Good Bye ! + + @enduml + ``` + ), ( [Space], ``` diff --git a/src/parser.typ b/src/parser.typ index 0a9b8b1..f1c212f 100644 --- a/src/parser.typ +++ b/src/parser.typ @@ -1,6 +1,6 @@ #import "diagram.typ": diagram, _par, _evt, _gap #import "participant.typ": SHAPES -#import "separator.typ": _sep +#import "separator.typ": _sep, _delay #import "sequence.typ": _seq, _ret #import "group.typ": _grp, _alt #import "note.typ": _note, SIDES @@ -384,6 +384,19 @@ return _gap(size: size) } +#let is-delay-stmt(line) = { + return line.starts-with("...") +} + +#let parse-delay-stmt(line) = { + if line == "..." { + return _delay() + } + let m = line.match(regex("\.\.\.\s*(.*?)\s*\.\.\.")) + let name = m.captures.first() + return _delay(name: name) +} + #let is-sep-stmt(line) = { return line.starts-with("==") and line.ends-with("==") } @@ -961,6 +974,8 @@ elmts += parse-par-stmt(line) } else if is-gap-stmt(line) { elmts += parse-gap-stmt(line) + } else if is-delay-stmt(line) { + elmts += parse-delay-stmt(line) } else if is-sep-stmt(line) { elmts += parse-sep-stmt(line) } else if is-evt-stmt(line) {