From 987dc174bab9276decd74b9054b4ae1440977266 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 04:43:35 -0500 Subject: [PATCH] Read IDML ink settings through shared model --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 4 ++-- crates/idml/src/import/swatches.rs | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 47a3aa8df..897e8f0a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1225,10 +1225,10 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934#46bb2753a5fdd68bba3fc8535bc0abdcaec8b934" +source = "git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e#4f4f8f8bc6b4cc850279f927808252d32f7c866e" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934)", - "craft-zip 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934)", + "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e)", + "craft-zip 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e)", "thiserror 2.0.21", ] @@ -1587,7 +1587,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934#46bb2753a5fdd68bba3fc8535bc0abdcaec8b934" +source = "git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e#4f4f8f8bc6b4cc850279f927808252d32f7c866e" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1633,7 +1633,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934#46bb2753a5fdd68bba3fc8535bc0abdcaec8b934" +source = "git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e#4f4f8f8bc6b4cc850279f927808252d32f7c866e" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1914,7 +1914,7 @@ dependencies = [ "craft-prepress", "craft-print", "craft-svg 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=2e670cf9377b523112f3fe4b409399772c745895)", - "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934)", + "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e)", "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1)", "designcraft-color", "designcraft-compose", @@ -1998,8 +1998,8 @@ dependencies = [ name = "designcraft-idml" version = "0.20.1" dependencies = [ - "craft-idml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934)", - "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934)", + "craft-idml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e)", + "craft-xml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e)", "designcraft-color", "designcraft-compose", "designcraft-doc", @@ -2116,7 +2116,7 @@ version = "0.20.1" dependencies = [ "craft-docx", "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=46bb2753a5fdd68bba3fc8535bc0abdcaec8b934)", + "craft-idml 0.1.0 (git+https://github.com/dylanmtaylor/craft-libs?rev=4f4f8f8bc6b4cc850279f927808252d32f7c866e)", "craft-rtf", "craft-wordmodel", "craft-xlsx", diff --git a/Cargo.toml b/Cargo.toml index bb3aff26a..4bcbc7f92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,10 @@ craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4052591363 craft-document-bundle = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } craft-epub = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } -craft-idml = { git = "https://github.com/dylanmtaylor/craft-libs", rev = "46bb2753a5fdd68bba3fc8535bc0abdcaec8b934", version = "=0.1.0" } +craft-idml = { git = "https://github.com/dylanmtaylor/craft-libs", rev = "4f4f8f8bc6b4cc850279f927808252d32f7c866e", version = "=0.1.0" } craft-indd = { git = "https://github.com/storytold/craft-libs", rev = "47bf5650b0d503b97bfb5e841746c4957897d11f", version = "=0.1.0" } craft-svg = { git = "https://github.com/dylanmtaylor/craft-libs", rev = "2e670cf9377b523112f3fe4b409399772c745895", version = "=0.1.0", features = ["tree-render", "tree-text"] } -craft-xml = { git = "https://github.com/dylanmtaylor/craft-libs", rev = "46bb2753a5fdd68bba3fc8535bc0abdcaec8b934", version = "=0.1.0" } +craft-xml = { git = "https://github.com/dylanmtaylor/craft-libs", rev = "4f4f8f8bc6b4cc850279f927808252d32f7c866e", version = "=0.1.0" } craft-xml-dtd = { package = "craft-xml", git = "https://github.com/dylanmtaylor/craft-libs", rev = "f23b0f33f0d00b157476533a43cbbcfd901aa1f1", version = "=0.1.0" } craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } diff --git a/crates/idml/src/import/swatches.rs b/crates/idml/src/import/swatches.rs index 87a84a9e2..330019c1e 100644 --- a/crates/idml/src/import/swatches.rs +++ b/crates/idml/src/import/swatches.rs @@ -48,17 +48,17 @@ impl<'r> Importer<'r> { /// Ink Manager settings: inks converted to process and ink aliases. fn read_inks(&mut self, top: &[El]) { - for e in top.iter().filter(|e| e.local() == "Ink") { - let Some(name) = e - .get("Name") - .filter(|n| !n.starts_with("$ID/") && !["Process Cyan", "Process Magenta", "Process Yellow", "Process Black"].contains(n)) + let model_top: Vec<_> = top.iter().map(crate::xml::to_craft).collect(); + for e in craft_idml::model::inks(&model_top) { + let Some(name) = + e.name().filter(|n| !n.starts_with("$ID/") && !["Process Cyan", "Process Magenta", "Process Yellow", "Process Black"].contains(n)) else { continue; }; - if e.get("ConvertToProcess") == Some("true") { + if e.convert_to_process() { self.inks.to_process.push(name.to_string()); } - if let Some(a) = e.get("AliasInkName").filter(|a| !a.is_empty() && *a != name && !a.starts_with("$ID/")) { + if let Some(a) = e.alias().filter(|a| !a.is_empty() && *a != name && !a.starts_with("$ID/")) { self.inks.aliases.push((name.to_string(), a.to_string())); } }