mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
Write nested style lists through shared IDML model
This commit is contained in:
3 files changed
+46
-52
No files matched your search
Generated
+11
-11
@@ -1242,10 +1242,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-idml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623#7c6abc70a679334a7407087b88544a49058e9623"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511#b47d3a7915124cd2515f2c992fe45eec203f7511"
|
||||
dependencies = [
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511)",
|
||||
"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=7c6abc70a679334a7407087b88544a49058e9623#7c6abc70a679334a7407087b88544a49058e9623"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1665,7 +1665,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511#b47d3a7915124cd2515f2c992fe45eec203f7511"
|
||||
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=7c6abc70a679334a7407087b88544a49058e9623#7c6abc70a679334a7407087b88544a49058e9623"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1740,7 +1740,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511#b47d3a7915124cd2515f2c992fe45eec203f7511"
|
||||
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=7c6abc70a679334a7407087b88544a49058e9623)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511)",
|
||||
"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=7c6abc70a679334a7407087b88544a49058e9623)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511)",
|
||||
"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=7c6abc70a679334a7407087b88544a49058e9623)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511)",
|
||||
"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=7c6abc70a679334a7407087b88544a49058e9623)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=b47d3a7915124cd2515f2c992fe45eec203f7511)",
|
||||
"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 = "7c6abc70a679334a7407087b88544a49058e9623", version = "=0.1.0" }
|
||||
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "b47d3a7915124cd2515f2c992fe45eec203f7511", 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 = "7c6abc70a679334a7407087b88544a49058e9623", version = "=0.1.0" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "b47d3a7915124cd2515f2c992fe45eec203f7511", 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" }
|
||||
|
||||
@@ -274,45 +274,39 @@ impl<'a> Ex<'a> {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if let Some(list) = &list {
|
||||
let mut l = El::new("AllNestedStyles").attr("type", "list");
|
||||
for ns in list {
|
||||
let (ty, delim) = names::nested_until_out(&ns.until);
|
||||
l = l.child(
|
||||
El::new("ListItem")
|
||||
.attr("type", "record")
|
||||
.child(p("AppliedCharacterStyle", "object", names::style_self("CharacterStyle", CHAR_BUILTINS, &ns.style)))
|
||||
.child(p("Delimiter", ty, delim))
|
||||
.child(p("Repetition", "long", ns.count.to_string()))
|
||||
.child(p("Inclusive", "boolean", bool_s(ns.through))),
|
||||
);
|
||||
}
|
||||
props.push(l);
|
||||
}
|
||||
if let Some(list) = &a.nested_line_styles {
|
||||
let mut l = El::new("AllNestedLineStyles").attr("type", "list");
|
||||
for ns in list {
|
||||
l = l.child(
|
||||
El::new("ListItem")
|
||||
.attr("type", "record")
|
||||
.child(p("AppliedCharacterStyle", "object", names::style_self("CharacterStyle", CHAR_BUILTINS, &ns.style)))
|
||||
.child(p("LineCount", "long", ns.lines.to_string())),
|
||||
);
|
||||
}
|
||||
props.push(l);
|
||||
}
|
||||
if let Some(list) = &a.grep_styles {
|
||||
let mut l = El::new("AllGREPStyles").attr("type", "list");
|
||||
for g in list {
|
||||
l = l.child(
|
||||
El::new("ListItem")
|
||||
.attr("type", "record")
|
||||
.child(p("AppliedCharacterStyle", "object", names::style_self("CharacterStyle", CHAR_BUILTINS, &g.style)))
|
||||
.child(p("GrepExpression", "string", g.pattern.clone())),
|
||||
);
|
||||
}
|
||||
props.push(l);
|
||||
}
|
||||
let values = craft_idml::model::NestedStyleValues {
|
||||
nested: list.map(|list| {
|
||||
list.iter()
|
||||
.map(|style| {
|
||||
let (delimiter_type, delimiter) = names::nested_until_out(&style.until);
|
||||
craft_idml::model::NestedStyleValue {
|
||||
character_style: names::style_self("CharacterStyle", CHAR_BUILTINS, &style.style),
|
||||
inclusive: style.through,
|
||||
repetition: style.count,
|
||||
delimiter_type: delimiter_type.into(),
|
||||
delimiter,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}),
|
||||
lines: a.nested_line_styles.as_ref().map(|list| {
|
||||
list.iter()
|
||||
.map(|style| craft_idml::model::NestedLineStyleValue {
|
||||
character_style: names::style_self("CharacterStyle", CHAR_BUILTINS, &style.style),
|
||||
line_count: style.lines,
|
||||
})
|
||||
.collect()
|
||||
}),
|
||||
grep: a.grep_styles.as_ref().map(|list| {
|
||||
list.iter()
|
||||
.map(|style| craft_idml::model::GrepStyleValue {
|
||||
character_style: names::style_self("CharacterStyle", CHAR_BUILTINS, &style.style),
|
||||
expression: style.pattern.clone(),
|
||||
})
|
||||
.collect()
|
||||
}),
|
||||
};
|
||||
props.extend(values.to_els().into_iter().map(crate::xml::from_craft));
|
||||
}
|
||||
|
||||
fn para_alignment_attrs(&self, el: &mut El, a: &ParaAttrs, parent: Option<&str>) {
|
||||
|
||||
Reference in new issue
Block a user