summaryrefslogtreecommitdiff
path: root/tests/typ/style
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-18 15:02:02 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-18 16:57:53 +0100
commite01970b20a058ab1b4ebea916f229c9b706c84e4 (patch)
tree5c5efc75abd6e607bd45a0602603231edf520503 /tests/typ/style
parent05ec0f993b4a1b8481e494ee16285d23f000872f (diff)
Basic show rules
Diffstat (limited to 'tests/typ/style')
-rw-r--r--tests/typ/style/set.typ2
-rw-r--r--tests/typ/style/show.typ52
-rw-r--r--tests/typ/style/wrap.typ2
3 files changed, 50 insertions, 6 deletions
diff --git a/tests/typ/style/set.typ b/tests/typ/style/set.typ
index 0d4d47cc..6ce1d303 100644
--- a/tests/typ/style/set.typ
+++ b/tests/typ/style/set.typ
@@ -1,5 +1,5 @@
// General tests for set.
---
-// Error: 2-10 set is only allowed directly in markup
+// Error: 2-10 set, show and wrap are only allowed directly in markup
{set f(x)}
diff --git a/tests/typ/style/show.typ b/tests/typ/style/show.typ
index 533e50f5..1055f9c7 100644
--- a/tests/typ/style/show.typ
+++ b/tests/typ/style/show.typ
@@ -1,9 +1,53 @@
// Test show rules.
+#set page("a8", footer: p => v(-5pt) + align(right, [#p]))
+
+#let i = 1
+#set heading(size: 100%)
+#show heading(level, body) as {
+ if level == 1 {
+ v(10pt)
+ underline(text(150%, blue)[{i}. #body])
+ i += 1
+ } else {
+ text(red, body)
+ }
+}
+
+#v(-10pt)
+
+= Aufgabe
+Some text.
+
+== Subtask
+Some more text.
+
+== Another subtask
+Some more text.
+
+= Aufgabe
+Another text.
+
+---
+#set heading(size: 100%, strong: false, block: false)
+#show heading(a, b) as [B]
+A [= Heading] C
+
+---
+// Error: 1-22 unexpected argument
+#show heading() as []
+= Heading
+
+---
+// Error: 1-28 expected template, found string
+#show heading(_, _) as "hi"
+= Heading
+
---
-// Error: 1-34 show rules are not yet implemented
-#show heading(body) as [*{body}*]
+// Error: 1-29 show rule is recursive
+#show strong(x) as strong(x)
+*Hi*
---
-// Error: 2-15 show is only allowed directly in markup
-{show (a) as b}
+// Error: 2-19 set, show and wrap are only allowed directly in markup
+{show list(a) as b}
diff --git a/tests/typ/style/wrap.typ b/tests/typ/style/wrap.typ
index 2fa7716e..9c94b9ae 100644
--- a/tests/typ/style/wrap.typ
+++ b/tests/typ/style/wrap.typ
@@ -25,5 +25,5 @@ A [_B #wrap c in [*#c*]; C_] D
Forest
---
-// Error: 6-17 wrap is only allowed directly in markup
+// Error: 6-17 set, show and wrap are only allowed directly in markup
{1 + wrap x in y}