summaryrefslogtreecommitdiff
path: root/tests/suite/model
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2025-01-24 13:31:03 +0100
committerGitHub <noreply@github.com>2025-01-24 12:31:03 +0000
commit176b070c779ef8aa4515c8ff062b17ca9114fd3f (patch)
treee8914eda708f508e17428549862bce8ea44d38d9 /tests/suite/model
parent26e65bfef5b1da7f6c72e1409237cf03fb5d6069 (diff)
Fix space collapsing for explicit paragraphs (#5749)
Diffstat (limited to 'tests/suite/model')
-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)