diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-07 12:21:12 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-07 12:46:05 +0100 |
| commit | efd1853d069fbd1476e82d015da4d0d04cfaccc0 (patch) | |
| tree | 842b745c134306539d10c61be9485794fe8dc7dc /library/src/structure/table.rs | |
| parent | eb951c008beea502042db4a3a0e8d1f8b51f6f52 (diff) | |
Show it!
- New show rule syntax
- Set if syntax
- Removed wrap syntax
Diffstat (limited to 'library/src/structure/table.rs')
| -rw-r--r-- | library/src/structure/table.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/library/src/structure/table.rs b/library/src/structure/table.rs index 722f11e6..fbf1c7c0 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(Show)] +#[node(Show, Finalize)] impl TableNode { /// How to fill the cells. #[property(referenced)] @@ -46,6 +46,15 @@ impl TableNode { } .pack()) } + + fn field(&self, name: &str) -> Option<Value> { + match name { + "cells" => Some(Value::Array( + self.cells.iter().cloned().map(Value::Content).collect(), + )), + _ => None, + } + } } impl Show for TableNode { @@ -58,16 +67,7 @@ impl Show for TableNode { .pack() } - fn field(&self, name: &str) -> Option<Value> { - match name { - "cells" => Some(Value::Array( - self.cells.iter().cloned().map(Value::Content).collect(), - )), - _ => None, - } - } - - fn realize( + fn show( &self, world: Tracked<dyn World>, styles: StyleChain, @@ -106,7 +106,9 @@ impl Show for TableNode { } .pack()) } +} +impl Finalize for TableNode { fn finalize( &self, _: Tracked<dyn World>, |
