From 4881eafad9e357aae4c686aed7f8524065c647b9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 09:13:55 -0500 Subject: [PATCH] Write IDML page references from shared model --- crates/idml/src/model/story.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/idml/src/model/story.rs b/crates/idml/src/model/story.rs index ffe0ef17d..feebb6091 100644 --- a/crates/idml/src/model/story.rs +++ b/crates/idml/src/model/story.rs @@ -202,6 +202,19 @@ impl PageReference { pub fn limit(&self) -> Option { self.values.num("PageReferenceLimit") } + + /// Writes a page-reference record from the shared index model's type and target. + pub fn to_el(self_id: &str, reference_type: &str, topic: &str, id: usize, limit: Option) -> El { + let mut el = El::new("PageReference") + .with_attr("Self", self_id) + .with_attr("PageReferenceType", reference_type) + .with_attr("ReferencedTopic", topic) + .with_attr("Id", id); + if let Some(limit) = limit { + el.set_attr("PageReferenceLimit", limit); + } + el + } } /// The elements read as [`TextNode::Container`].