summaryrefslogtreecommitdiff
path: root/tests/typ/style
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/style
parent12a59963b08b68cc39dcded4d3d3e6a6631c2732 (diff)
New block spacing model
Diffstat (limited to 'tests/typ/style')
-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
4 files changed, 18 insertions, 38 deletions
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