summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-28 00:26:24 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-28 00:26:24 +0200
commit90be79dc864c776a4d6f6739af671d4ea8407549 (patch)
tree27de49da69a388d244c3786bd326d79694cd8e83 /tests
parent1a7ce3da02a25900dcdc09c110fe00229fd193d4 (diff)
Page background and foreground
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/layout/locate-group.pngbin3881 -> 42394 bytes
-rw-r--r--tests/ref/layout/page-marginals.pngbin68057 -> 69787 bytes
-rw-r--r--tests/typ/layout/locate-group.typ35
-rw-r--r--tests/typ/layout/page-marginals.typ3
4 files changed, 34 insertions, 4 deletions
diff --git a/tests/ref/layout/locate-group.png b/tests/ref/layout/locate-group.png
index e38a4a32..c9fe4065 100644
--- a/tests/ref/layout/locate-group.png
+++ b/tests/ref/layout/locate-group.png
Binary files differ
diff --git a/tests/ref/layout/page-marginals.png b/tests/ref/layout/page-marginals.png
index 734973b6..78dd4591 100644
--- a/tests/ref/layout/page-marginals.png
+++ b/tests/ref/layout/page-marginals.png
Binary files differ
diff --git a/tests/typ/layout/locate-group.typ b/tests/typ/layout/locate-group.typ
index 5c022f5a..c3a5ddab 100644
--- a/tests/typ/layout/locate-group.typ
+++ b/tests/typ/layout/locate-group.typ
@@ -32,10 +32,9 @@
..{
let seen = ()
for item in all {
- if item.value not in seen {
- seen.push(item.value)
- (num(all, item.value), item.value)
- }
+ if item.value in seen { continue }
+ (num(all, item.value), item.value)
+ seen.push(item.value)
}
}
))}
@@ -43,6 +42,34 @@
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(
diff --git a/tests/typ/layout/page-marginals.typ b/tests/typ/layout/page-marginals.typ
index 6e8e3d85..9b323692 100644
--- a/tests/typ/layout/page-marginals.typ
+++ b/tests/typ/layout/page-marginals.typ
@@ -7,6 +7,9 @@
text(0.8em)[_Chapter 1_]
}),
footer: page => v(5pt) + align(center)[\~ #page \~],
+ background: n => if n <= 2 {
+ place(center + horizon, circle(radius: 1cm, fill: luma(90%)))
+ }
)
But, soft! what light through yonder window breaks? It is the east, and Juliet