diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-25 10:36:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-25 12:16:13 +0100 |
| commit | bf5edbbbbb75120d065d1c9587ccfa4eed4fdca1 (patch) | |
| tree | 956af910ab27a8cec0db83171cd3f0b6d0570a60 /library/src/structure | |
| parent | 96f72eee6c6b595164c7a0576c407d7a590661db (diff) | |
Tidy up
Diffstat (limited to 'library/src/structure')
| -rw-r--r-- | library/src/structure/doc.rs | 2 | ||||
| -rw-r--r-- | library/src/structure/heading.rs | 14 | ||||
| -rw-r--r-- | library/src/structure/list.rs | 4 | ||||
| -rw-r--r-- | library/src/structure/reference.rs | 4 | ||||
| -rw-r--r-- | library/src/structure/table.rs | 4 |
5 files changed, 11 insertions, 17 deletions
diff --git a/library/src/structure/doc.rs b/library/src/structure/doc.rs index 42ad628e..e471a852 100644 --- a/library/src/structure/doc.rs +++ b/library/src/structure/doc.rs @@ -18,7 +18,7 @@ impl LayoutRoot for DocNode { let mut frames = vec![]; for (page, map) in self.0.iter() { let number = 1 + frames.len(); - frames.extend(page.layout(world, number, map.chain(&styles))?); + frames.extend(page.layout(world, number, styles.chain(map))?); } Ok(frames) } diff --git a/library/src/structure/heading.rs b/library/src/structure/heading.rs index cf732a4e..063f3c97 100644 --- a/library/src/structure/heading.rs +++ b/library/src/structure/heading.rs @@ -34,18 +34,13 @@ impl HeadingNode { } impl Show for HeadingNode { - fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { - Ok(BlockNode(self.body.clone()).pack()) + fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> Content { + BlockNode(self.body.clone()).pack() } } impl Finalize for HeadingNode { - fn finalize( - &self, - _: Tracked<dyn World>, - _: StyleChain, - realized: Content, - ) -> SourceResult<Content> { + fn finalize(&self, realized: Content) -> Content { let scale = match self.level.get() { 1 => 1.4, 2 => 1.2, @@ -61,7 +56,6 @@ impl Finalize for HeadingNode { map.set(TextNode::WEIGHT, FontWeight::BOLD); map.set(BlockNode::ABOVE, VNode::block_around(above.into())); map.set(BlockNode::BELOW, VNode::block_around(below.into())); - - Ok(realized.styled_with_map(map)) + realized.styled_with_map(map) } } diff --git a/library/src/structure/list.rs b/library/src/structure/list.rs index 222dcbcf..c35ffd44 100644 --- a/library/src/structure/list.rs +++ b/library/src/structure/list.rs @@ -81,8 +81,8 @@ impl<const L: ListKind> LayoutBlock for ListNode<L> { fn layout_block( &self, world: Tracked<dyn World>, - regions: &Regions, styles: StyleChain, + regions: &Regions, ) -> SourceResult<Vec<Frame>> { let mut cells = vec![]; let mut number = 1; @@ -139,7 +139,7 @@ impl<const L: ListKind> LayoutBlock for ListNode<L> { gutter: Axes::with_y(vec![gutter.into()]), cells, } - .layout_block(world, regions, styles) + .layout_block(world, styles, regions) } } diff --git a/library/src/structure/reference.rs b/library/src/structure/reference.rs index 361f8c25..948aa6f6 100644 --- a/library/src/structure/reference.rs +++ b/library/src/structure/reference.rs @@ -20,7 +20,7 @@ impl RefNode { } impl Show for RefNode { - fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { - Ok(TextNode::packed(format_eco!("@{}", self.0))) + fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> Content { + TextNode::packed(format_eco!("@{}", self.0)) } } diff --git a/library/src/structure/table.rs b/library/src/structure/table.rs index 54413b63..4dd14cdd 100644 --- a/library/src/structure/table.rs +++ b/library/src/structure/table.rs @@ -54,8 +54,8 @@ impl LayoutBlock for TableNode { fn layout_block( &self, world: Tracked<dyn World>, - regions: &Regions, styles: StyleChain, + regions: &Regions, ) -> SourceResult<Vec<Frame>> { let fill = styles.get(Self::FILL); let stroke = styles.get(Self::STROKE).map(PartialStroke::unwrap_or_default); @@ -89,7 +89,7 @@ impl LayoutBlock for TableNode { gutter: self.gutter.clone(), cells, } - .layout_block(world, regions, styles) + .layout_block(world, styles, regions) } } |
