diff --git a/Cargo.lock b/Cargo.lock index 260d56d8c..b5555c3c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1242,20 +1242,20 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b#9e0ee3d1564307d3f4a4b69f45ced137a526121b" +source = "git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558#eed3c28cf016723d004d6f2c79c61424c15d4558" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558)", "thiserror 2.0.21", ] [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558#eed3c28cf016723d004d6f2c79c61424c15d4558" +source = "git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624#ef177d545e0099559b7c4b3e462f7eda969f6624" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624)", "thiserror 2.0.21", ] @@ -1662,15 +1662,6 @@ dependencies = [ "thiserror 2.0.21", ] -[[package]] -name = "craft-xml" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b#9e0ee3d1564307d3f4a4b69f45ced137a526121b" -dependencies = [ - "quick-xml 0.41.0", - "thiserror 2.0.21", -] - [[package]] name = "craft-xml" version = "0.1.0" @@ -1698,6 +1689,15 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624#ef177d545e0099559b7c4b3e462f7eda969f6624" +dependencies = [ + "quick-xml 0.41.0", + "thiserror 2.0.21", +] + [[package]] name = "craft-xml" version = "0.1.0" @@ -1737,16 +1737,6 @@ dependencies = [ "zip 9.1.1", ] -[[package]] -name = "craft-zip" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b#9e0ee3d1564307d3f4a4b69f45ced137a526121b" -dependencies = [ - "flate2", - "thiserror 2.0.21", - "zip 9.1.1", -] - [[package]] name = "craft-zip" version = "0.1.0" @@ -1767,6 +1757,16 @@ dependencies = [ "zip 9.1.1", ] +[[package]] +name = "craft-zip" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624#ef177d545e0099559b7c4b3e462f7eda969f6624" +dependencies = [ + "flate2", + "thiserror 2.0.21", + "zip 9.1.1", +] + [[package]] name = "craft-zip" version = "0.1.0" @@ -2021,7 +2021,7 @@ dependencies = [ "craft-prepress", "craft-print", "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624)", "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1)", "designcraft-color", "designcraft-compose", @@ -2103,9 +2103,9 @@ name = "designcraft-idml" version = "0.20.1" dependencies = [ "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624)", "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624)", "designcraft-color", "designcraft-compose", "designcraft-doc", @@ -2222,7 +2222,7 @@ version = "0.20.1" dependencies = [ "craft-docx", "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9e0ee3d1564307d3f4a4b69f45ced137a526121b)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624)", "craft-rtf", "craft-wordmodel", "craft-xlsx", diff --git a/Cargo.toml b/Cargo.toml index 78da9b6ec..cf8039315 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,10 @@ craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4052591363 craft-designcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "93d0998383aa150fa50a2ffbf49ef37786e37eca", 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/storytold/craft-libs", rev = "9e0ee3d1564307d3f4a4b69f45ced137a526121b", version = "=0.1.0" } +craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "ef177d545e0099559b7c4b3e462f7eda969f6624", 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/storytold/craft-libs", rev = "cc23ffd4d26f3074808e2187d332564817624f8f", version = "=0.1.0", features = ["tree-render", "tree-text"] } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "9e0ee3d1564307d3f4a4b69f45ced137a526121b", version = "=0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "ef177d545e0099559b7c4b3e462f7eda969f6624", version = "=0.1.0" } craft-xml-dtd = { package = "craft-xml", git = "https://github.com/storytold/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/document.rs b/crates/idml/src/import/document.rs index 44e42a500..7c6632df7 100644 --- a/crates/idml/src/import/document.rs +++ b/crates/idml/src/import/document.rs @@ -263,47 +263,48 @@ impl<'r> Importer<'r> { /// Preferences › `FootnoteOption` (after styles: it names the footnote text and marker styles). pub(super) fn footnote_option(&mut self, e: &El) { + let values = craft_idml::model::FootnotePreferences::from_el(&crate::xml::to_craft(e)); let mut o = designcraft_doc::FootnoteOptions::default(); - if let Some(v) = e.num("StartAt") { + if let Some(v) = values.start_at { o.start_at = v.max(0.0) as u32; } - o.prefix = e.get("Prefix").unwrap_or("").into(); - o.suffix = e.get("Suffix").unwrap_or("").into(); - if let Some(r) = e.get("FootnoteTextStyle") { + o.prefix = values.prefix.unwrap_or_default(); + o.suffix = values.suffix.unwrap_or_default(); + if let Some(r) = values.paragraph_style.as_deref() { o.para_style = self.para_style_ref(r); } - if let Some(r) = e.get("FootnoteMarkerStyle") { + if let Some(r) = values.marker_style.as_deref() { o.ref_char_style = self.char_style_ref(r); } - if let Some(v) = e.get("SeparatorText") { - o.separator = v.into(); + if let Some(v) = values.separator { + o.separator = v; } - o.space_between = e.num("SpaceBetween").unwrap_or(0.0); - o.space_before = e.num("Spacer").unwrap_or(0.0); - if let Some(v) = e.prop("FootnoteFirstBaselineOffset") { + o.space_between = values.space_between.unwrap_or(0.0); + o.space_before = values.space_before.unwrap_or(0.0); + if let Some(v) = values.first_baseline.as_deref() { o.first_baseline = names::first_baseline_in(v.trim()); } - o.first_baseline_min = e.num("FootnoteMinimumFirstBaselineOffset").unwrap_or(0.0); - o.span_columns = e.boolean("EnableStraddling").unwrap_or(false); - o.rule.on = e.boolean("RuleOn").unwrap_or(true); - o.rule.weight = e.num("RuleLineWeight").unwrap_or(1.0); - o.rule.tint = tint(e.num("RuleTint")).unwrap_or(1.0); - o.rule.left_indent = e.num("RuleLeftIndent").unwrap_or(0.0); - o.rule.width = e.num("RuleWidth").unwrap_or(72.0); - o.rule.offset = e.num("RuleOffset").unwrap_or(0.0); - if let Some(c) = e.prop("RuleColor") { + o.first_baseline_min = values.first_baseline_minimum.unwrap_or(0.0); + o.span_columns = values.span_columns.unwrap_or(false); + o.rule.on = values.rule_on.unwrap_or(true); + o.rule.weight = values.rule_weight.unwrap_or(1.0); + o.rule.tint = tint(values.rule_tint).unwrap_or(1.0); + o.rule.left_indent = values.rule_left_indent.unwrap_or(0.0); + o.rule.width = values.rule_width.unwrap_or(72.0); + o.rule.offset = values.rule_offset.unwrap_or(0.0); + if let Some(c) = values.rule_color.as_deref() { o.rule.color = self.swatch_ref(c.trim()); } - if let Some(v) = e.prop("FootnoteNumberingStyle") { + if let Some(v) = values.numbering_style.as_deref() { o.style = names::note_style_in(v.trim()); } - if let Some(v) = e.prop("RestartNumbering") { + if let Some(v) = values.restart_numbering.as_deref() { o.restart = names::NOTE_RESTART.iter().find(|r| r.1 == v.trim()).map_or(Default::default(), |r| r.0); } - if let Some(v) = e.prop("ShowPrefixSuffix") { + if let Some(v) = values.show_prefix_suffix.as_deref() { o.affix_in = names::NOTE_AFFIX.iter().find(|r| r.1 == v.trim()).map_or(Default::default(), |r| r.0); } - if let Some(v) = e.prop("MarkerPositioning") { + if let Some(v) = values.marker_positioning.as_deref() { o.ref_position = names::note_marker_in(v.trim()); } self.footnote_options = o;