Skip to content

Commit

Permalink
add ref with count test
Browse files Browse the repository at this point in the history
  • Loading branch information
PgBiel committed Jan 10, 2025
1 parent 5ec35bf commit 991e307
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/unit/elements/reference/count/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# added by typst-test
Binary file added test/unit/elements/reference/count/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions test/unit/elements/reference/count/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#import "/test/unit/base.typ": template
#show: template
#set text(5pt)

#import "/src/lib.typ" as e: field

#show ref: e.ref

#let wock = e.element.declare(
"wock",
display: it => {
rect(width: 2.5pt, height: 2.5pt, fill: blue)
},
fields: (
field("depth", int, default: 1),
field("offset", int, default: 0),
field("run", function, default: () => {})
),
synthesize: it => {
it.level = it.depth + it.offset
it
},
count: c => it => c.step(level: it.level),
reference: (
supplement: [Wock],
numbering: "1.1"
),
prefix: ""
)

#wock(label: <my-wock>)
@my-wock

#wock(depth: 2, label: <my-wock2>)
@my-wock2[abc]

0 comments on commit 991e307

Please sign in to comment.