From bec6f0fcf57c14797d08bbee06e38cae04a94cac Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 08:19:14 -0500 Subject: [PATCH] Write paragraph span and numbering references in shared model --- crates/idml/src/model/resources.rs | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/crates/idml/src/model/resources.rs b/crates/idml/src/model/resources.rs index 24c088e8c..b6239f9a2 100644 --- a/crates/idml/src/model/resources.rs +++ b/crates/idml/src/model/resources.rs @@ -135,6 +135,31 @@ impl ParagraphSpanValues { space_after: values.num("SpanColumnMinSpaceAfter"), } } + + /// Writes paragraph span and split-column attributes and properties. + pub fn to_parts(&self) -> (Vec<(String, String)>, Vec) { + let mut attrs = Vec::new(); + let mut properties = Vec::new(); + if let Some(kind) = &self.kind { + attrs.push(("SpanColumnType".into(), kind.clone())); + } + if let Some(count) = self.split_column_count { + properties.push(if count == 0 { + property("SpanSplitColumnCount", "enumeration", "All") + } else { + property("SpanSplitColumnCount", "long", count.to_string()) + }); + } + for (key, value) in [ + ("SplitColumnInsideGutter", self.inside_gutter), + ("SplitColumnOutsideGutter", self.outside_gutter), + ("SpanColumnMinSpaceBefore", self.space_before), + ("SpanColumnMinSpaceAfter", self.space_after), + ] { + push_number(&mut attrs, key, value); + } + (attrs, properties) + } } /// Paragraph alignment, spacing, drop cap, baseline grid and composer values after the caller @@ -744,9 +769,21 @@ impl ParagraphListValues { } } + /// Encodes a semantic paragraph-list name as its IDML object reference. + pub fn numbering_list_reference(name: &str) -> String { + if name.is_empty() { "NumberingList/$ID/[Default]".into() } else { format!("NumberingList/{}", crate::value::escape_id(name)) } + } + /// IDML attributes represented by a paragraph's list settings. pub fn to_attrs(&self) -> Vec<(String, String)> { let mut attrs = Vec::new(); + if let Some(value) = &self.applied_list { + attrs.push(("AppliedNumberingList".into(), value.clone())); + } + if let Some(value) = self.numbering_continue { + attrs.push(("NumberingContinue".into(), if value { "true" } else { "false" }.into())); + } + push_number(&mut attrs, "NumberingStartAt", self.numbering_start_at); for (key, value) in [ ("BulletsAndNumberingListType", &self.list_type), ("NumberingExpression", &self.expression),