From efd1853d069fbd1476e82d015da4d0d04cfaccc0 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 7 Nov 2022 12:21:12 +0100 Subject: Show it! - New show rule syntax - Set if syntax - Removed wrap syntax --- library/src/structure/table.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'library/src/structure/table.rs') 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, } -#[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 { + 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 { - match name { - "cells" => Some(Value::Array( - self.cells.iter().cloned().map(Value::Content).collect(), - )), - _ => None, - } - } - - fn realize( + fn show( &self, world: Tracked, styles: StyleChain, @@ -106,7 +106,9 @@ impl Show for TableNode { } .pack()) } +} +impl Finalize for TableNode { fn finalize( &self, _: Tracked, -- cgit v1.2.3