summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-09 18:16:59 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-09 18:20:02 +0100
commit010cc2effc2fd0e1c4e52d5c914cb4d74506bc0a (patch)
treee50060d271f076b00945e5569e7f8ffef2c28e9f /tests/typ
parent12a59963b08b68cc39dcded4d3d3e6a6631c2732 (diff)
New block spacing model
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/base/eval.typ1
-rw-r--r--tests/typ/layout/stack-1.typ2
-rw-r--r--tests/typ/structure/attach.typ18
-rw-r--r--tests/typ/structure/desc.typ2
-rw-r--r--tests/typ/structure/heading.typ4
-rw-r--r--tests/typ/structure/list.typ2
-rw-r--r--tests/typ/style/construct.typ12
-rw-r--r--tests/typ/style/set.typ4
-rw-r--r--tests/typ/style/show-node.typ7
-rw-r--r--tests/typ/style/show-recursive.typ33
-rw-r--r--tests/typ/text/indent.typ4
-rw-r--r--tests/typ/text/justify.typ8
-rw-r--r--tests/typ/text/par.typ26
13 files changed, 45 insertions, 78 deletions
diff --git a/tests/typ/base/eval.typ b/tests/typ/base/eval.typ
index 668264d3..80235c0c 100644
--- a/tests/typ/base/eval.typ
+++ b/tests/typ/base/eval.typ
@@ -8,7 +8,6 @@
#eval("#let")
---
-#set raw(around: none)
#show raw: it => text("IBM Plex Sans", eval(it.text))
Interacting
diff --git a/tests/typ/layout/stack-1.typ b/tests/typ/layout/stack-1.typ
index 0ecbe246..6a884667 100644
--- a/tests/typ/layout/stack-1.typ
+++ b/tests/typ/layout/stack-1.typ
@@ -42,9 +42,9 @@
---
// Test aligning things in RTL stack with align function & fr units.
#set page(width: 50pt, margins: 5pt)
+#set block(spacing: 5pt)
#set text(8pt)
#stack(dir: rtl, 1fr, [A], 1fr, [B], [C])
-#v(5pt)
#stack(dir: rtl,
align(center, [A]),
align(left, [B]),
diff --git a/tests/typ/structure/attach.typ b/tests/typ/structure/attach.typ
index c6d3c28c..c13de236 100644
--- a/tests/typ/structure/attach.typ
+++ b/tests/typ/structure/attach.typ
@@ -9,10 +9,8 @@ Attached to:
Next paragraph.
---
-// Test attached list without parbreak after it.
-// Ensures the par spacing is used below by setting
-// super high around spacing.
-#set list(around: 100pt)
+// Test that attached list isn't affected by block spacing.
+#show list: it => { set block(above: 100pt); it }
Hello
- A
World
@@ -29,8 +27,8 @@ World
- B
---
-// Test not-attached tight list.
-#set list(around: 15pt)
+// Test non-attached tight list.
+#set block(spacing: 15pt)
Hello
- A
World
@@ -41,8 +39,8 @@ World
More.
---
-// Test that wide lists cannot be attached ...
-#set list(around: 15pt, spacing: 15pt)
+// Test that wide lists cannot be ...
+#set block(spacing: 15pt)
Hello
- A
@@ -50,7 +48,7 @@ Hello
World
---
-// ... unless really forced to.
+// ... even if forced to.
Hello
-#list(attached: true, tight: false)[A][B]
+#list(tight: false)[A][B]
World
diff --git a/tests/typ/structure/desc.typ b/tests/typ/structure/desc.typ
index af1b2986..1bc92625 100644
--- a/tests/typ/structure/desc.typ
+++ b/tests/typ/structure/desc.typ
@@ -30,8 +30,8 @@ No: list \
---
// Test style change.
#set text(8pt)
-
/ First list: #lorem(4)
+
#set desc(body-indent: 30pt)
/ Second list: #lorem(4)
diff --git a/tests/typ/structure/heading.typ b/tests/typ/structure/heading.typ
index b552f6c3..9fd4e648 100644
--- a/tests/typ/structure/heading.typ
+++ b/tests/typ/structure/heading.typ
@@ -43,9 +43,9 @@ multiline.
---
// Test styling.
-#show heading.where(level: 5): it => {
+#show heading.where(level: 5): it => block(
text(family: "Roboto", fill: eastern, it.body + [!])
-}
+)
= Heading
===== Heading 🌍
diff --git a/tests/typ/structure/list.typ b/tests/typ/structure/list.typ
index 9a021f31..9ed5993a 100644
--- a/tests/typ/structure/list.typ
+++ b/tests/typ/structure/list.typ
@@ -6,7 +6,7 @@ No list
---
_Shopping list_
-#list(attached: true)[Apples][Potatoes][Juice]
+#list[Apples][Potatoes][Juice]
---
- First level.
diff --git a/tests/typ/style/construct.typ b/tests/typ/style/construct.typ
index 4b0f966a..be11e97e 100644
--- a/tests/typ/style/construct.typ
+++ b/tests/typ/style/construct.typ
@@ -4,11 +4,7 @@
// Ensure that constructor styles aren't passed down the tree.
// The inner list should have no extra indent.
#set par(leading: 2pt)
-#list(
- body-indent: 20pt,
- [First],
- list([A], [B])
-)
+#list(body-indent: 20pt, [First], list[A][B])
---
// Ensure that constructor styles win, but not over outer styles.
@@ -29,5 +25,7 @@
A #rect(fill: yellow, inset: 5pt, rect()) B
---
-// The inner list should not be indented extra.
-[#set text(1em);#list(indent: 20pt, list[A])]
+// The constructor property should still work
+// when there are recursive show rules.
+#show list: text.with(blue)
+#list(label: "(a)", [A], list[B])
diff --git a/tests/typ/style/set.typ b/tests/typ/style/set.typ
index 2864b81b..fc5053b1 100644
--- a/tests/typ/style/set.typ
+++ b/tests/typ/style/set.typ
@@ -19,9 +19,9 @@ Hello *{x}*
- No more fruit
---
-// Test that that par spacing and text style are respected from
+// Test that that block spacing and text style are respected from
// the outside, but the more specific fill is respected.
-#set par(spacing: 4pt)
+#set block(spacing: 4pt)
#set text(style: "italic", fill: eastern)
#let x = [And the forest #parbreak() lay silent!]
#text(fill: forest, x)
diff --git a/tests/typ/style/show-node.typ b/tests/typ/style/show-node.typ
index 4b0542e5..51b4734e 100644
--- a/tests/typ/style/show-node.typ
+++ b/tests/typ/style/show-node.typ
@@ -2,7 +2,6 @@
---
// Override lists.
-#set list(around: none)
#show list: it => "(" + it.items.join(", ") + ")"
- A
@@ -13,7 +12,6 @@
---
// Test full reset.
-#set heading(around: none)
#show heading: [B]
#show heading: text.with(size: 10pt, weight: 400)
A [= Heading] C
@@ -21,7 +19,6 @@ A [= Heading] C
---
// Test full removal.
#show heading: none
-#set heading(around: none)
Where is
= There are no headings around here!
@@ -29,7 +26,7 @@ my heading?
---
// Test integrated example.
-#show heading: it => {
+#show heading: it => block({
set text(10pt)
move(dy: -1pt)[📖]
h(5pt)
@@ -38,7 +35,7 @@ my heading?
} else {
text(red, it.body)
}
-}
+})
= Task 1
Some text.
diff --git a/tests/typ/style/show-recursive.typ b/tests/typ/style/show-recursive.typ
index 566879af..91a295f2 100644
--- a/tests/typ/style/show-recursive.typ
+++ b/tests/typ/style/show-recursive.typ
@@ -16,51 +16,36 @@
= Nope
---
-// Test recursive base recipe. (Burn it with fire!)
-#set list(label: [- Hey])
-- Labelless
-- List
-
----
// Test show rule in function.
-#let starwars(body) = [
- #show list: it => {
+#let starwars(body) = {
+ show list: it => block({
stack(dir: ltr,
text(red, it),
1fr,
scale(x: -100%, text(blue, it)),
)
- }
- #body
-]
+ })
+ body
+}
- Normal list
+
#starwars[
- Star
- Wars
- List
]
+
- Normal list
---
// Test multi-recursion with nested lists.
-#set rect(inset: 2pt)
+#set rect(inset: 3pt)
#show list: rect.with(stroke: blue)
#show list: rect.with(stroke: red)
+#show list: block
- List
- Nested
- List
- Recursive!
-
----
-// Inner heading is not finalized. Bug?
-#set heading(around: none)
-#show heading: it => it.body
-#show heading: [
- = A [
- = B
- ]
-]
-
-= Discarded
diff --git a/tests/typ/text/indent.typ b/tests/typ/text/indent.typ
index 97044153..b2f3d87b 100644
--- a/tests/typ/text/indent.typ
+++ b/tests/typ/text/indent.typ
@@ -2,7 +2,7 @@
---
#set par(indent: 12pt, leading: 5pt)
-#set heading(above: 8pt)
+#set block(spacing: 5pt)
#show heading: text.with(size: 10pt)
The first paragraph has no indent.
@@ -31,7 +31,7 @@ starts a paragraph without indent.
---
// This is madness.
-#set par(indent: 12pt, spacing-and-indent: true)
+#set par(indent: 12pt)
Why would anybody ever ...
... want spacing and indent?
diff --git a/tests/typ/text/justify.typ b/tests/typ/text/justify.typ
index e61817a6..e3d61322 100644
--- a/tests/typ/text/justify.typ
+++ b/tests/typ/text/justify.typ
@@ -1,12 +1,8 @@
---
#set page(width: 180pt)
-#set par(
- justify: true,
- indent: 14pt,
- spacing: 0pt,
- leading: 5pt,
-)
+#set block(spacing: 5pt)
+#set par(justify: true, indent: 14pt, leading: 5pt)
This text is justified, meaning that spaces are stretched so that the text
forms a "block" with flush edges at both sides.
diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ
index 08202ef5..56a33577 100644
--- a/tests/typ/text/par.typ
+++ b/tests/typ/text/par.typ
@@ -7,33 +7,27 @@ To the right! Where the sunlight peeks behind the mountain.
---
// Test changing leading and spacing.
-#set par(spacing: 1em, leading: 2pt)
+#set block(spacing: 1em)
+#set par(leading: 2pt)
But, soft! what light through yonder window breaks?
It is the east, and Juliet is the sun.
---
-// Test that largest paragraph spacing wins.
-#set par(spacing: 2.5pt)
-[#set par(spacing: 15pt);First]
-[#set par(spacing: 7.5pt);Second]
-Third
-
-Fourth
-
----
// Test that paragraph spacing loses against block spacing.
-#set par(spacing: 100pt)
-#set table(around: 5pt)
+// TODO
+// #set block(spacing: 100pt)
+// #show table: set block(spacing: 5pt)
+#set block(spacing: 5pt)
Hello
#table(columns: 4, fill: (x, y) => if odd(x + y) { silver })[A][B][C][D]
---
// While we're at it, test the larger block spacing wins.
-#set raw(around: 15pt)
-#set math(around: 7.5pt)
-#set list(around: 2.5pt)
-#set par(spacing: 0pt)
+#set block(spacing: 0pt)
+#show raw: it => { set block(spacing: 15pt); it }
+#show math: it => { set block(spacing: 7.5pt); it }
+#show list: it => { set block(spacing: 2.5pt); it }
```rust
fn main() {}