diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-26 23:51:18 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-26 23:51:18 +0100 |
| commit | 50bd8634711507ead8491d8d0c2abad0481e6a83 (patch) | |
| tree | eb4a9cfc659334be5444f1e7f9d06e35439d455c /src/eval | |
| parent | 3a15922d2ffc041c3523edb479f008a9034fd400 (diff) | |
More independent placed node
Diffstat (limited to 'src/eval')
| -rw-r--r-- | src/eval/template.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/eval/template.rs b/src/eval/template.rs index e9cbbfcf..d447161a 100644 --- a/src/eval/template.rs +++ b/src/eval/template.rs @@ -337,13 +337,24 @@ impl Builder { /// Push a block node into the active flow, finishing the active paragraph. fn block(&mut self, node: PackedNode) { + let mut is_placed = false; + if let Some(placed) = node.downcast::<PlacedNode>() { + is_placed = true; + + // This prevents paragraph spacing after the placed node if it + // is completely out-of-flow. + if placed.out_of_flow() { + self.flow.last = Last::None; + } + } + self.parbreak(); - let in_flow = node.downcast::<PlacedNode>().is_none(); self.flow.push(FlowChild::Node(node)); - if in_flow { - self.parbreak(); - } else { - // This prevents duplicate paragraph spacing around placed nodes. + self.parbreak(); + + // This prevents paragraph spacing between the placed node and + // the paragraph below it. + if is_placed { self.flow.last = Last::None; } } |
