diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-28 12:40:16 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-28 12:40:16 +0100 |
| commit | 989d170dc7318ca3cbaa5b76760eb14f4e6a8605 (patch) | |
| tree | 0a486ddb4d339b8a43313f7c6e18b9595b8fd955 /library/src/structure | |
| parent | 7caf98fe42797eab59a39ef71071030c9790245a (diff) | |
Fragments
Diffstat (limited to 'library/src/structure')
| -rw-r--r-- | library/src/structure/document.rs | 3 | ||||
| -rw-r--r-- | library/src/structure/list.rs | 10 | ||||
| -rw-r--r-- | library/src/structure/table.rs | 10 |
3 files changed, 12 insertions, 11 deletions
diff --git a/library/src/structure/document.rs b/library/src/structure/document.rs index 2e5761e0..e52c92ad 100644 --- a/library/src/structure/document.rs +++ b/library/src/structure/document.rs @@ -26,7 +26,8 @@ impl LayoutRoot for DocumentNode { let mut pages = vec![]; for (page, map) in self.0.iter() { let number = 1 + pages.len(); - pages.extend(page.layout(world, number, styles.chain(map))?); + let fragment = page.layout(world, number, styles.chain(map))?; + pages.extend(fragment); } Ok(Document { diff --git a/library/src/structure/list.rs b/library/src/structure/list.rs index 6bfddd2e..b51284a8 100644 --- a/library/src/structure/list.rs +++ b/library/src/structure/list.rs @@ -18,7 +18,7 @@ pub type EnumNode = ListNode<ENUM>; /// A description list. pub type DescNode = ListNode<DESC>; -#[node(LayoutBlock)] +#[node(Layout)] impl<const L: ListKind> ListNode<L> { /// How the list is labelled. #[property(referenced)] @@ -75,13 +75,13 @@ impl<const L: ListKind> ListNode<L> { } } -impl<const L: ListKind> LayoutBlock for ListNode<L> { - fn layout_block( +impl<const L: ListKind> Layout for ListNode<L> { + fn layout( &self, world: Tracked<dyn World>, styles: StyleChain, regions: &Regions, - ) -> SourceResult<Vec<Frame>> { + ) -> SourceResult<Fragment> { let mut cells = vec![]; let mut number = 1; @@ -137,7 +137,7 @@ impl<const L: ListKind> LayoutBlock for ListNode<L> { gutter: Axes::with_y(vec![gutter.into()]), cells, } - .layout_block(world, styles, regions) + .layout(world, styles, regions) } } diff --git a/library/src/structure/table.rs b/library/src/structure/table.rs index 4dd14cdd..bb900f3d 100644 --- a/library/src/structure/table.rs +++ b/library/src/structure/table.rs @@ -12,7 +12,7 @@ pub struct TableNode { pub cells: Vec<Content>, } -#[node(LayoutBlock)] +#[node(Layout)] impl TableNode { /// How to fill the cells. #[property(referenced)] @@ -50,13 +50,13 @@ impl TableNode { } } -impl LayoutBlock for TableNode { - fn layout_block( +impl Layout for TableNode { + fn layout( &self, world: Tracked<dyn World>, styles: StyleChain, regions: &Regions, - ) -> SourceResult<Vec<Frame>> { + ) -> SourceResult<Fragment> { let fill = styles.get(Self::FILL); let stroke = styles.get(Self::STROKE).map(PartialStroke::unwrap_or_default); let padding = styles.get(Self::PADDING); @@ -89,7 +89,7 @@ impl LayoutBlock for TableNode { gutter: self.gutter.clone(), cells, } - .layout_block(world, styles, regions) + .layout(world, styles, regions) } } |
