summaryrefslogtreecommitdiff
path: root/tests/suite
diff options
context:
space:
mode:
Diffstat (limited to 'tests/suite')
-rw-r--r--tests/suite/model/par.typ35
1 files changed, 29 insertions, 6 deletions
diff --git a/tests/suite/model/par.typ b/tests/suite/model/par.typ
index 84f2ec15..fa230451 100644
--- a/tests/suite/model/par.typ
+++ b/tests/suite/model/par.typ
@@ -215,25 +215,48 @@ Welcome \ here. Does this work well?
#set text(hyphenate: false)
Lorem ipsum dolor #metadata(none) nonumy eirmod tempor.
---- par-show ---
-// This is only slightly cursed.
+--- par-show-children ---
+// Variant 1: Prevent recursion by checking the children.
+#let p = counter("p")
+#let step = p.step()
+#let nr = context p.display()
+#show par: it => {
+ if it.body.at("children", default: ()).at(0, default: none) == step {
+ return it
+ }
+ par(step + [§#nr ] + it.body)
+}
+
+= A
+
+B
+
+C #parbreak() D
+
+#block[E]
+
+#block[F #parbreak() G]
+
+--- par-show-styles ---
+// Variant 2: Prevent recursion by observing a style.
#let revoke = metadata("revoke")
#show par: it => {
if bibliography.title == revoke { return it }
set bibliography(title: revoke)
let p = counter("p")
- par[#p.step() §#context p.display() #it.body]
+ par[#p.step()§#context p.display() #it.body]
}
= A
B
-C #parbreak() D
+C
-#block[E]
+--- par-explicit-trim-space ---
+A
-#block[F #parbreak() G]
+#par[ B ]
--- issue-4278-par-trim-before-equation ---
#set par(justify: true)