Skip to content

Commit

Permalink
Styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrswift committed Jun 2, 2024
1 parent 7f51d60 commit 4677cba
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 44 deletions.
41 changes: 23 additions & 18 deletions docs/manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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()
Expand Down
48 changes: 26 additions & 22 deletions src/types/sink.typ
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,67 @@
#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 {
positional = (self.positional-schema.validate)(
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 {
named = (self.named-schema.validate)(
self.named-schema,
it.named(),
ctx: ctx,
scope: (..scope, "named")
scope: (..scope, "named"),
)
}

return to-args-type(..positional, ..named)
}
},
)

}
6 changes: 2 additions & 4 deletions tests/types/sink/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4677cba

Please sign in to comment.