diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-09-19 11:14:58 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-09-19 11:16:05 +0200 |
| commit | 4ec3bcee487c1567bc6551f81d4f69eee4379076 (patch) | |
| tree | 84ece5a894679adbe06c43712af685c5561a83ca /tests | |
| parent | e5f958b92161732ae46ccc66ce3d6eea213cf925 (diff) | |
Remove pins and memoization
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/layout/locate-break.typ | 5 | ||||
| -rw-r--r-- | tests/typ/layout/locate-group.typ | 89 | ||||
| -rw-r--r-- | tests/typ/layout/locate.typ | 22 |
3 files changed, 0 insertions, 116 deletions
diff --git a/tests/typ/layout/locate-break.typ b/tests/typ/layout/locate-break.typ deleted file mode 100644 index 28631cfa..00000000 --- a/tests/typ/layout/locate-break.typ +++ /dev/null @@ -1,5 +0,0 @@ -// Test locate with crazy pagebreaks. - ---- -#set page(height: 10pt) -{3 * locate(me => me.page * pagebreak())} diff --git a/tests/typ/layout/locate-group.typ b/tests/typ/layout/locate-group.typ deleted file mode 100644 index c3a5ddab..00000000 --- a/tests/typ/layout/locate-group.typ +++ /dev/null @@ -1,89 +0,0 @@ -// Test locatable groups. - ---- -// Test counting. -#let letters = group("\u{1F494}") -#let counter = letters.entry( - (me, all) => [{1 + me.index} / {all.len()}] -) - -#counter \ -#box(counter) \ -#counter \ - ---- -// Test minimal citation engine with references before the document. -#let cited = group("citations") -#let num(cited, key) = { - let index = 0 - for item in cited { - if item.value == key { - index = item.index - break - } - } - [\[{index + 1}\]] -} - -#let cite(key) = cited.entry(value: key, (_, all) => num(all, key)) -{cited.all(all => grid( - columns: (auto, 1fr), - gutter: 5pt, - ..{ - let seen = () - for item in all { - if item.value in seen { continue } - (num(all, item.value), item.value) - seen.push(item.value) - } - } -))} - -As shown in #cite("abc") and #cite("def") and #cite("abc") ... - ---- -// Test lovely sidebar. -#let lovely = group("lovely") -#let words = ("Juliet", "soft", "fair", "maid") -#let regex = regex(words.map(p => "(" + p + ")").join("|")) -#show word: regex as underline(word) + lovely.entry(_ => {}) -#set page( - paper: "a8", - margins: (left: 25pt, rest: 15pt), - foreground: lovely.all(entries => { - let seen = () - for y in entries.map(it => it.y) { - if y in seen { continue } - let line = entries.filter(it => it.y == y) - for i, it in line { - let x = 10pt - 4pt * (line.len() - i - 1) - place(dx: x, dy: it.y - 8pt, [💗]) - } - seen.push(y) - } - }), -) - -But, soft! what light through yonder window breaks? It is the east, and Juliet -is the sun. Arise, fair sun, and kill the envious moon, Who is already sick and -pale with grief, That thou her maid art far more fair than she: Be not her maid, -since she is envious. - ---- -// Test that `all` contains `me`. -// Ref: false -#show it: heading as group("headings").entry( - (me, all) => { - let last - for prev in all { - last = prev - if prev.index == me.index { - break - } - } - assert(last == me) - } -) - -= A -== B diff --git a/tests/typ/layout/locate.typ b/tests/typ/layout/locate.typ deleted file mode 100644 index ec2262c5..00000000 --- a/tests/typ/layout/locate.typ +++ /dev/null @@ -1,22 +0,0 @@ -// Test locate me. - ---- -#set page(height: 60pt) -#let pin = locate(me => box({ - let c(length) = str(int(length / 1pt ) ) - square(size: 1.5pt, fill: blue) - h(0.15em) - text(0.5em)[{me.page}, #c(me.x), #c(me.y)] -})) - -#place(rotate(origin: top + left, 25deg, move(dx: 40pt, pin))) - -#pin -#h(10pt) -#box(pin) \ -#pin - -#place(bottom + right, pin) - -#pagebreak() -#align(center + horizon, pin + [\ ] + pin) |
