summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-02 19:45:53 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-02 19:47:42 +0200
commitb469f30c83f50a5728888c7a800d31321e160e5d (patch)
tree2a6b017de627d55de3925b9985906d1b151d793b /library
parentfa4878f7d00052d1c960b836c7d689e4e7b8428e (diff)
Fix block spacing
Diffstat (limited to 'library')
-rw-r--r--library/src/layout/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index e93b2e02..d12ce158 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -466,8 +466,12 @@ impl<'a> FlowBuilder<'a> {
self.0.push(spacing.pack(), styles);
}
- let above = BlockElem::above_in(styles);
- let below = BlockElem::below_in(styles);
+ let (above, below) = if let Some(block) = content.to::<BlockElem>() {
+ (block.above(styles), block.below(styles))
+ } else {
+ (BlockElem::above_in(styles), BlockElem::below_in(styles))
+ };
+
self.0.push(above.pack(), styles);
self.0.push(content.clone(), styles);
self.0.push(below.pack(), styles);