mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
Read IDML tab stops through shared model
This commit is contained in:
3 files changed
+19
-21
No files matched your search
Generated
+9
-9
@@ -1242,10 +1242,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-idml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2#4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772#4abdd336b8b14c30366d28c1bb296284d2056772"
|
||||
dependencies = [
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772)",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
@@ -1656,7 +1656,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2#4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772#4abdd336b8b14c30366d28c1bb296284d2056772"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1730,7 +1730,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2#4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772#4abdd336b8b14c30366d28c1bb296284d2056772"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
@@ -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=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772)",
|
||||
"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=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772)",
|
||||
"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=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772)",
|
||||
"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=4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4abdd336b8b14c30366d28c1bb296284d2056772)",
|
||||
"craft-rtf",
|
||||
"craft-wordmodel",
|
||||
"craft-xlsx",
|
||||
|
||||
+2
-2
@@ -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 = "19692b6190465671e41967c75d0cd4c439d0c84c", 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 = "4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2", version = "=0.1.0" }
|
||||
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "4abdd336b8b14c30366d28c1bb296284d2056772", 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 = "4f104d03d2a952c12ae39ceda6bcbf0a3fd073d2", version = "=0.1.0" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4abdd336b8b14c30366d28c1bb296284d2056772", 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" }
|
||||
|
||||
@@ -413,16 +413,14 @@ impl<'r> Importer<'r> {
|
||||
|
||||
fn read_tabs(&mut self, e: &El) -> Option<Vec<TabStop>> {
|
||||
let list = e.prop_el("TabList")?;
|
||||
let tabs: Vec<_> = list
|
||||
.find_all("ListItem")
|
||||
.map(|item| {
|
||||
let get = |key: &str| item.find(key).map(|element| element.text_content());
|
||||
TabStop {
|
||||
position: get("Position").and_then(|value| value.trim().parse::<f64>().ok()).filter(|value| value.is_finite()).unwrap_or(0.0),
|
||||
align: names::tab_align_in(get("Alignment").unwrap_or_default().trim()),
|
||||
leader: get("Leader").unwrap_or_default(),
|
||||
align_on: get("AlignmentCharacter").filter(|character| character != ".").unwrap_or_default(),
|
||||
}
|
||||
let model_list = crate::xml::to_craft(list);
|
||||
let tabs: Vec<_> = craft_idml::model::TabStopValues::from_list(&model_list)
|
||||
.into_iter()
|
||||
.map(|tab| TabStop {
|
||||
position: tab.position,
|
||||
align: names::tab_align_in(tab.alignment.trim()),
|
||||
leader: tab.leader,
|
||||
align_on: if tab.alignment_character == "." { String::new() } else { tab.alignment_character },
|
||||
})
|
||||
.collect();
|
||||
let sanitized = TabStop::sanitized_list(tabs.clone());
|
||||
|
||||
Reference in new issue
Block a user