mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
Use shared writer for IDML footnote preferences
This commit is contained in:
3 files changed
+56
-64
No files matched your search
Generated
+29
-29
@@ -1242,20 +1242,20 @@ dependencies = [
|
||||
[[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=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8#08531a7b46b4e09f43c77f52e13d9f918e7ba9f8"
|
||||
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=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8)",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-idml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=ef177d545e0099559b7c4b3e462f7eda969f6624#ef177d545e0099559b7c4b3e462f7eda969f6624"
|
||||
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=ef177d545e0099559b7c4b3e462f7eda969f6624)",
|
||||
"craft-zip 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=eed3c28cf016723d004d6f2c79c61424c15d4558)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=eed3c28cf016723d004d6f2c79c61424c15d4558)",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
@@ -1644,6 +1644,15 @@ dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8#08531a7b46b4e09f43c77f52e13d9f918e7ba9f8"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
@@ -1689,15 +1698,6 @@ 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"
|
||||
@@ -1717,6 +1717,16 @@ dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8#08531a7b46b4e09f43c77f52e13d9f918e7ba9f8"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
"zip 9.1.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
@@ -1757,16 +1767,6 @@ 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=ef177d545e0099559b7c4b3e462f7eda969f6624)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8)",
|
||||
"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=ef177d545e0099559b7c4b3e462f7eda969f6624)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8)",
|
||||
"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=ef177d545e0099559b7c4b3e462f7eda969f6624)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8)",
|
||||
"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=ef177d545e0099559b7c4b3e462f7eda969f6624)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=08531a7b46b4e09f43c77f52e13d9f918e7ba9f8)",
|
||||
"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 = "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 = "ef177d545e0099559b7c4b3e462f7eda969f6624", version = "=0.1.0" }
|
||||
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "08531a7b46b4e09f43c77f52e13d9f918e7ba9f8", 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 = "ef177d545e0099559b7c4b3e462f7eda969f6624", version = "=0.1.0" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "08531a7b46b4e09f43c77f52e13d9f918e7ba9f8", 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" }
|
||||
|
||||
@@ -58,41 +58,33 @@ impl<'a> Ex<'a> {
|
||||
} else {
|
||||
names::style_self("CharacterStyle", CHAR_BUILTINS, &o.ref_char_style)
|
||||
};
|
||||
let enumv = |name: &str, v: &str| {
|
||||
let mut e = El::new(name).attr("type", "enumeration");
|
||||
e.children.push(Node::Text(v.into()));
|
||||
e
|
||||
};
|
||||
let mut color = El::new("RuleColor").attr("type", "object");
|
||||
color.children.push(Node::Text(self.sw(&o.rule.color)));
|
||||
let mut el = El::new("FootnoteOption")
|
||||
.attr("StartAt", o.start_at)
|
||||
.attr("Prefix", &o.prefix)
|
||||
.attr("Suffix", &o.suffix)
|
||||
.attr("FootnoteTextStyle", names::style_self("ParagraphStyle", PARA_BUILTINS, &o.para_style))
|
||||
.attr("FootnoteMarkerStyle", marker)
|
||||
.attr("SeparatorText", &o.separator)
|
||||
.attr("SpaceBetween", num(o.space_between))
|
||||
.attr("Spacer", num(o.space_before))
|
||||
.attr("FootnoteFirstBaselineOffset", names::first_baseline_out(o.first_baseline))
|
||||
.attr("FootnoteMinimumFirstBaselineOffset", num(o.first_baseline_min))
|
||||
.attr("EnableStraddling", bool_s(o.span_columns))
|
||||
.attr("RuleOn", bool_s(o.rule.on))
|
||||
.attr("RuleLineWeight", num(o.rule.weight))
|
||||
.attr("RuleTint", num(o.rule.tint as f64 * 100.0))
|
||||
.attr("RuleLeftIndent", num(o.rule.left_indent))
|
||||
.attr("RuleWidth", num(o.rule.width))
|
||||
.attr("RuleOffset", num(o.rule.offset));
|
||||
let restart = names::NOTE_RESTART.iter().find(|r| r.0 == o.restart).map_or("DontRestart", |r| r.1);
|
||||
let affix = names::NOTE_AFFIX.iter().find(|r| r.0 == o.affix_in).map_or("NoPrefixSuffix", |r| r.1);
|
||||
let mut props = El::new("Properties");
|
||||
props.push(enumv("FootnoteNumberingStyle", names::number_style_out(o.style)));
|
||||
props.push(enumv("RestartNumbering", restart));
|
||||
props.push(enumv("ShowPrefixSuffix", affix));
|
||||
props.push(enumv("MarkerPositioning", names::note_marker_out(o.ref_position)));
|
||||
props.push(color);
|
||||
el.push(props);
|
||||
el
|
||||
let values = craft_idml::model::FootnotePreferences {
|
||||
start_at: Some(f64::from(o.start_at)),
|
||||
prefix: Some(o.prefix.clone()),
|
||||
suffix: Some(o.suffix.clone()),
|
||||
paragraph_style: Some(names::style_self("ParagraphStyle", PARA_BUILTINS, &o.para_style)),
|
||||
marker_style: Some(marker),
|
||||
separator: Some(o.separator.clone()),
|
||||
space_between: Some(o.space_between),
|
||||
space_before: Some(o.space_before),
|
||||
first_baseline: Some(names::first_baseline_out(o.first_baseline).into()),
|
||||
first_baseline_minimum: Some(o.first_baseline_min),
|
||||
span_columns: Some(o.span_columns),
|
||||
rule_on: Some(o.rule.on),
|
||||
rule_weight: Some(o.rule.weight),
|
||||
rule_tint: Some(f64::from(o.rule.tint) * 100.0),
|
||||
rule_left_indent: Some(o.rule.left_indent),
|
||||
rule_width: Some(o.rule.width),
|
||||
rule_offset: Some(o.rule.offset),
|
||||
rule_color: Some(self.sw(&o.rule.color)),
|
||||
numbering_style: Some(names::number_style_out(o.style).into()),
|
||||
restart_numbering: Some(restart.into()),
|
||||
show_prefix_suffix: Some(affix.into()),
|
||||
marker_positioning: Some(names::note_marker_out(o.ref_position).into()),
|
||||
};
|
||||
crate::xml::from_craft(values.to_el())
|
||||
}
|
||||
|
||||
/// `<Footnote>`: the footnote's paragraphs, the first starting with the footnote number marker
|
||||
|
||||
Reference in new issue
Block a user