From a09cc3352e464e9bb2714da3cd7d26d4288ac3e6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 07:02:10 -0500 Subject: [PATCH] Expose typed cell edges and table layout --- crates/idml/src/model/story.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/idml/src/model/story.rs b/crates/idml/src/model/story.rs index 1812b2627..bc84b2803 100644 --- a/crates/idml/src/model/story.rs +++ b/crates/idml/src/model/story.rs @@ -308,12 +308,18 @@ pub struct TableColumn { impl TableLayout { pub fn from_el(el: &El) -> TableLayout { + Self::from_table(&Table::from_el(el)) + } + + pub fn from_table(table: &Table) -> TableLayout { let mut layout = TableLayout::default(); - for child in el.elements() { - match child.local() { - "Row" => layout.rows.push(TableRow { values: Values::of(child) }), - "Column" => layout.columns.push(TableColumn { values: Values::of(child) }), - _ => {} + for child in &table.children { + if let TableChild::Other(element) = child { + match element.local() { + "Row" => layout.rows.push(TableRow { values: Values::of(element) }), + "Column" => layout.columns.push(TableColumn { values: Values::of(element) }), + _ => {} + } } } layout @@ -366,6 +372,7 @@ pub struct CellOptions { pub minimum_first_baseline_offset: Option, pub rotation_angle: Option, pub edge_stroke_priorities: [i32; 4], + pub edge_strokes: [super::StrokeValues; 4], } /// The children of `el` other than ``, as text nodes. @@ -712,6 +719,7 @@ impl Cell { minimum_first_baseline_offset: self.values.num("MinimumFirstBaselineOffset"), rotation_angle: self.values.num("RotationAngle"), edge_stroke_priorities: [priority("TopEdge"), priority("LeftEdge"), priority("BottomEdge"), priority("RightEdge")], + edge_strokes: ["TopEdge", "LeftEdge", "BottomEdge", "RightEdge"].map(|side| self.values.stroke_values(side)), } }