diff --git a/docs/examples.typ b/docs/examples.typ index 3c98aec..a37ab85 100644 --- a/docs/examples.typ +++ b/docs/examples.typ @@ -63,6 +63,45 @@ _grp("Group 1", desc: "Description", { }) ```) +#let alt = example(``` +_par("a", display-name: "Alice") +_par("b", display-name: "Bob") + +_alt( + "first encounter", { + _seq("a", "b", comment: "Who are you ?") + _seq("b", "a", comment: "I'm Bob") + }, + + "know eachother", { + _seq("a", "b", comment: "Hello Bob") + _seq("b", "a", comment: "Hello Alice") + }, + + "best friends", { + _seq("a", "b", comment: "Hi !") + _seq("b", "a", comment: "Hi !") + } +) +```) + +#let loop = example(``` +_par("a", display-name: "Alice") +_par("b", display-name: "Bob") + +_loop("default loop", { + _seq("a", "b", comment: "Are you here ?") +}) +_gap() +_loop("min loop", min: 1, { + _seq("a", "b", comment: "Are you here ?") +}) +_gap() +_loop("min-max loop", min: 1, max: 5, { + _seq("a", "b", comment: "Are you still here ?") +}) +```) + #let sync = example(``` _par("alice", display-name: "Alice") _par("bob", display-name: "Bob") diff --git a/docs/groups.typ b/docs/groups.typ index 76ed0f7..ece4ae7 100644 --- a/docs/groups.typ +++ b/docs/groups.typ @@ -2,7 +2,7 @@ /// #examples.grp /// - name (content): The group's name /// - desc (none, content): Optional description -/// - type (str): The groups's type (unused for the moment) +/// - type (str): The groups's type (should only be set through other functions like @@_alt() or @@_loop() ) /// - elmts (array): Elements inside the group (can be sequences, other groups, notes, etc.) #let _grp( name, @@ -11,9 +11,48 @@ elmts ) = {} -/// Synchronizes multiple sequences +/// Creates an alt-else group of sequences +/// +/// It contains at least one section but can have as many as needed +/// #examples.alt +/// - desc (content): The alt's label +/// - elmts (array): Elements inside the alt's first section +/// - ..args (content, array): Complementary "else" sections.\ You can add as many else sections as you need by passing a content (else section label) followed by an array of elements (see example) +#let _alt( + desc, + elmts, + ..args +) + +/// Creates a looped group of sequences +/// #examples.loop +/// - desc (content): Loop description +/// - min (none, number): Optional lower bound of the loop +/// - max (auto, number): Upper bound of the loop. If left as `auto` and `min` is set, it will be infinity (`'*'`) +/// - elmts (array): Elements inside the group +#let _loop( + desc, + min: none, + max: auto, + elmts +) = {} + +/// Synchronizes multiple sequences\ +/// All elements inside a synchronized group will start at the same time /// #examples.sync /// - elmts (array): Synchronized elements (generally sequences or notes) #let _sync( elmts -) \ No newline at end of file +) + +/// Creates an optional group\ +/// This is a simple wrapper around @@_grp() +/// - desc (content): Group description +/// - elmts (array): Elements inside the group +#let _opt(desc, elmts) = {} + +/// Creates a break group\ +/// This is a simple wrapper around @@_grp() +/// - desc (content): Group description +/// - elmts (array): Elements inside the group +#let _break(desc, elmts) = {} \ No newline at end of file diff --git a/manual.pdf b/manual.pdf index cccf85c..57ec601 100644 Binary files a/manual.pdf and b/manual.pdf differ diff --git a/manual.typ b/manual.typ index 557ecf6..8678ec6 100644 --- a/manual.typ +++ b/manual.typ @@ -183,7 +183,7 @@ chronos.diagram({ examples: examples ) ) -#tidy.show-module(grp-docs, show-outline: false) +#tidy.show-module(grp-docs, show-outline: false, sort-functions: none) #pagebreak(weak: true)