diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-18 15:33:06 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-19 22:40:42 +0100 |
| commit | 1937d746abf19a5c1142db546912dbed0e6711fb (patch) | |
| tree | 287a7462720698347361be5d34d61cf7bf3dce45 /library/src/structure | |
| parent | 9b8c1dc19fcda399f00e486460b4cc521d1a460b (diff) | |
Show everything!
Diffstat (limited to 'library/src/structure')
| -rw-r--r-- | library/src/structure/heading.rs | 4 | ||||
| -rw-r--r-- | library/src/structure/list.rs | 29 | ||||
| -rw-r--r-- | library/src/structure/reference.rs | 4 | ||||
| -rw-r--r-- | library/src/structure/table.rs | 19 |
4 files changed, 4 insertions, 52 deletions
diff --git a/library/src/structure/heading.rs b/library/src/structure/heading.rs index e069e3a9..d99e2db8 100644 --- a/library/src/structure/heading.rs +++ b/library/src/structure/heading.rs @@ -34,10 +34,6 @@ impl HeadingNode { } impl Show for HeadingNode { - fn unguard_parts(&self, id: RecipeId) -> Content { - Self { body: self.body.unguard(id), ..*self }.pack() - } - fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(BlockNode(self.body.clone()).pack()) } diff --git a/library/src/structure/list.rs b/library/src/structure/list.rs index 8de22f64..aa844232 100644 --- a/library/src/structure/list.rs +++ b/library/src/structure/list.rs @@ -6,7 +6,7 @@ use crate::prelude::*; use crate::text::{ParNode, SpaceNode, TextNode}; /// An unordered (bulleted) or ordered (numbered) list. -#[derive(Debug, Clone, Hash)] +#[derive(Debug, Hash)] pub struct ListNode<const L: ListKind = LIST> { /// If true, the items are separated by leading instead of list spacing. pub tight: bool, @@ -20,7 +20,7 @@ pub type EnumNode = ListNode<ENUM>; /// A description list. pub type DescNode = ListNode<DESC>; -#[node(Show, LayoutBlock)] +#[node(LayoutBlock)] impl<const L: ListKind> ListNode<L> { /// How the list is labelled. #[property(referenced)] @@ -77,20 +77,6 @@ impl<const L: ListKind> ListNode<L> { } } -impl<const L: ListKind> Show for ListNode<L> { - fn unguard_parts(&self, id: RecipeId) -> Content { - Self { - items: self.items.map(|item| item.unguard(id)), - ..*self - } - .pack() - } - - fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { - Ok(self.clone().pack()) - } -} - impl<const L: ListKind> LayoutBlock for ListNode<L> { fn layout_block( &self, @@ -178,17 +164,6 @@ impl ListItem { } } - fn unguard(&self, sel: RecipeId) -> Self { - match self { - Self::List(body) => Self::List(Box::new(body.unguard(sel))), - Self::Enum(number, body) => Self::Enum(*number, Box::new(body.unguard(sel))), - Self::Desc(item) => Self::Desc(Box::new(DescItem { - term: item.term.unguard(sel), - body: item.body.unguard(sel), - })), - } - } - /// Encode the item into a value. fn encode(&self) -> Value { match self { diff --git a/library/src/structure/reference.rs b/library/src/structure/reference.rs index 7004f49e..4f672707 100644 --- a/library/src/structure/reference.rs +++ b/library/src/structure/reference.rs @@ -20,10 +20,6 @@ impl RefNode { } impl Show for RefNode { - fn unguard_parts(&self, _: RecipeId) -> Content { - Self(self.0.clone()).pack() - } - fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(TextNode::packed(format_eco!("@{}", self.0))) } diff --git a/library/src/structure/table.rs b/library/src/structure/table.rs index 72ea3da5..eaadc3a1 100644 --- a/library/src/structure/table.rs +++ b/library/src/structure/table.rs @@ -2,7 +2,7 @@ use crate::layout::{GridNode, TrackSizing, TrackSizings}; use crate::prelude::*; /// A table of items. -#[derive(Debug, Clone, Hash)] +#[derive(Debug, Hash)] pub struct TableNode { /// Defines sizing for content rows and columns. pub tracks: Axes<Vec<TrackSizing>>, @@ -12,7 +12,7 @@ pub struct TableNode { pub cells: Vec<Content>, } -#[node(Show, LayoutBlock)] +#[node(LayoutBlock)] impl TableNode { /// How to fill the cells. #[property(referenced)] @@ -50,21 +50,6 @@ impl TableNode { } } -impl Show for TableNode { - fn unguard_parts(&self, id: RecipeId) -> Content { - Self { - tracks: self.tracks.clone(), - gutter: self.gutter.clone(), - cells: self.cells.iter().map(|cell| cell.unguard(id)).collect(), - } - .pack() - } - - fn show(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { - Ok(self.clone().pack()) - } -} - impl LayoutBlock for TableNode { fn layout_block( &self, |
