diff --git a/docs/manual.typ b/docs/manual.typ index 540a477..3eb44dc 100644 --- a/docs/manual.typ +++ b/docs/manual.typ @@ -395,13 +395,13 @@ For the sake of brevity and owing to their consistency, the arguments that each #pagebreak() -#import("@preview/tidy:0.2.0") +#import ("@preview/tidy:0.2.0") #let module-doc = tidy.parse-module( read("/src/coercions.typ"), name: "z.coerce", label-prefix: "z.coerce", - scope: (:) + scope: (:), ) #tidy.show-module( @@ -411,29 +411,28 @@ For the sake of brevity and owing to their consistency, the arguments that each show-outline: mty-tidy.show-outline, show-parameter-list: mty-tidy.show-parameter-list, show-parameter-block: mty-tidy.show-parameter-block, - show-function: mty-tidy.show-function.with(tidy: tidy, extract-headings: true), + show-function: mty-tidy.show-function.with( + tidy: tidy, + extract-headings: true, + ), show-variable: mty-tidy.show-variable.with(tidy: tidy), show-example: mty-tidy.show-example, - show-reference: mty-tidy.show-reference + show-reference: mty-tidy.show-reference, ), first-heading-level: 2, show-module-name: true, sort-functions: false, - show-outline: true + show-outline: true, ) #tidy-module(read("/src/coercions.typ"), name: "coerce") #pagebreak() - - #let module-doc = tidy.parse-module( - read("/src/assertions.typ") - + read("/src/assertions/comparative.typ") - + read("/src/assertions/string.typ"), + read("/src/assertions.typ") + read("/src/assertions/comparative.typ") + read("/src/assertions/string.typ"), name: "z.assert", label-prefix: "z.assert", - scope: (:) + scope: (:), ) #tidy.show-module( @@ -443,22 +442,25 @@ For the sake of brevity and owing to their consistency, the arguments that each show-outline: mty-tidy.show-outline, show-parameter-list: mty-tidy.show-parameter-list, show-parameter-block: mty-tidy.show-parameter-block, - show-function: mty-tidy.show-function.with(tidy: tidy, extract-headings: true), + show-function: mty-tidy.show-function.with( + tidy: tidy, + extract-headings: true, + ), show-variable: mty-tidy.show-variable.with(tidy: tidy), show-example: mty-tidy.show-example, - show-reference: mty-tidy.show-reference + show-reference: mty-tidy.show-reference, ), first-heading-level: 2, show-module-name: true, sort-functions: false, - show-outline: true + show-outline: true, ) #let module-doc = tidy.parse-module( read("/src/assertions/length.typ"), name: "z.assert.length", label-prefix: "z.assert.string.", - scope: (:) + scope: (:), ) #tidy.show-module( @@ -468,15 +470,18 @@ For the sake of brevity and owing to their consistency, the arguments that each show-outline: mty-tidy.show-outline, show-parameter-list: mty-tidy.show-parameter-list, show-parameter-block: mty-tidy.show-parameter-block, - show-function: mty-tidy.show-function.with(tidy: tidy, extract-headings: true), + show-function: mty-tidy.show-function.with( + tidy: tidy, + extract-headings: true, + ), show-variable: mty-tidy.show-variable.with(tidy: tidy), show-example: mty-tidy.show-example, - show-reference: mty-tidy.show-reference + show-reference: mty-tidy.show-reference, ), first-heading-level: 2, show-module-name: true, sort-functions: false, - show-outline: true + show-outline: true, ) #pagebreak() diff --git a/src/types/sink.typ b/src/types/sink.typ index 624a8e6..d17ad6a 100644 --- a/src/types/sink.typ +++ b/src/types/sink.typ @@ -7,30 +7,34 @@ #let sink( positional: none, named: none, - ..args + ..args, ) = { - if ( positional != none ) {assert-base-type(positional);} - if ( named != none ) {assert-base-type(named);} + if (positional != none) { + assert-base-type(positional) + } + if (named != none) { + assert-base-type(named) + } base-type( - name: "argument-sink", + name: "argument-sink", types: (arguments,), - ..args + ..args, ) + ( positional-schema: positional, named-schema: named, handle-descendents: (self, it, ctx: z-ctx(), scope: ()) => { let positional = it.pos() - if (self.positional-schema == none){ - if ( positional.len() > 0){ + if (self.positional-schema == none) { + if (positional.len() > 0) { (self.fail-validation)( - self, - it, - scope: scope, - ctx: ctx, - message: "Unexpected positional arguments." + self, + it, + scope: scope, + ctx: ctx, + message: "Unexpected positional arguments.", ) } } else { @@ -38,19 +42,19 @@ self.positional-schema, it.pos(), ctx: ctx, - scope: (..scope, "positional") + scope: (..scope, "positional"), ) } let named = it.named() - if (self.named-schema == none){ - if ( named.len() > 0){ + if (self.named-schema == none) { + if (named.len() > 0) { (self.fail-validation)( - self, - it, - scope: scope, - ctx: ctx, - message: "Unexpected named arguments." + self, + it, + scope: scope, + ctx: ctx, + message: "Unexpected named arguments.", ) } } else { @@ -58,12 +62,12 @@ self.named-schema, it.named(), ctx: ctx, - scope: (..scope, "named") + scope: (..scope, "named"), ) } return to-args-type(..positional, ..named) - } + }, ) } \ No newline at end of file diff --git a/tests/types/sink/test.typ b/tests/types/sink/test.typ index 83a7141..cea9ff3 100644 --- a/tests/types/sink/test.typ +++ b/tests/types/sink/test.typ @@ -4,12 +4,10 @@ #show: show-rule.with(); #let positional-schema = z.any() -#let named-schema = z.dictionary( - (named: z.string()) -) +#let named-schema = z.dictionary((named: z.string())) #let sink-schema = z.sink( positional: positional-schema, - named: named-schema + named: named-schema, ) #let to-args-type(..args) = args