From a23b40e29aa6df1e9ff5506f82f34b0cfa4f2d47 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 01:52:51 -0500 Subject: [PATCH] Use shared CSV and TSV format mappings --- Cargo.lock | 42 ++++++++++++------------ Cargo.toml | 2 +- crates/engine/src/cmd/datamerge/parse.rs | 6 ++-- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3abdb8bc0..940657fd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1152,12 +1152,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" +source = "git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5#71337f6772b57a61e0f171c941f695822eea19a5" [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309#fccc0082711b8ae4e19824dd20339a8473d47309" +source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" [[package]] name = "craft-epub" @@ -1172,12 +1172,12 @@ dependencies = [ [[package]] name = "craft-file-formats" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309#fccc0082711b8ae4e19824dd20339a8473d47309" +source = "git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5#71337f6772b57a61e0f171c941f695822eea19a5" dependencies = [ - "craft-eps 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", - "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", + "craft-eps 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", + "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", "serde", "serde_json", ] @@ -1213,20 +1213,20 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" +source = "git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5#71337f6772b57a61e0f171c941f695822eea19a5" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", "thiserror 2.0.21", ] [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309#fccc0082711b8ae4e19824dd20339a8473d47309" +source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", "thiserror 2.0.21", ] @@ -1384,9 +1384,9 @@ source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad605 [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" +source = "git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5#71337f6772b57a61e0f171c941f695822eea19a5" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5)", "flate2", "kurbo", "roxmltree 0.21.2", @@ -1396,9 +1396,9 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309#fccc0082711b8ae4e19824dd20339a8473d47309" +source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", "flate2", "kurbo", "roxmltree 0.21.2", @@ -1501,7 +1501,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" +source = "git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5#71337f6772b57a61e0f171c941f695822eea19a5" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309#fccc0082711b8ae4e19824dd20339a8473d47309" +source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1519,7 +1519,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" +source = "git+https://github.com/storytold/craft-libs?rev=71337f6772b57a61e0f171c941f695822eea19a5#71337f6772b57a61e0f171c941f695822eea19a5" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1529,7 +1529,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fccc0082711b8ae4e19824dd20339a8473d47309#fccc0082711b8ae4e19824dd20339a8473d47309" +source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#ba24fe2435adb3c81ad6057faf36365fbba736cf" dependencies = [ "flate2", "thiserror 2.0.21", diff --git a/Cargo.toml b/Cargo.toml index 159929912..606797d72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "ba24 craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "47bf5650b0d503b97bfb5e841746c4957897d11f", version = "=0.1.0" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a47b78256c6acf3d7fdc4bc7cfbc25c373eac522", version = "=0.1.0" } craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a47b78256c6acf3d7fdc4bc7cfbc25c373eac522", version = "=0.1.0" } -craft-file-formats = { git = "https://github.com/storytold/craft-libs", rev = "fccc0082711b8ae4e19824dd20339a8473d47309", version = "=0.1.0" } +craft-file-formats = { git = "https://github.com/storytold/craft-libs", rev = "71337f6772b57a61e0f171c941f695822eea19a5", version = "=0.1.0" } # Shared keyboard bindings: chords, overrides, conflicts, egui dispatch, the Keyboard Shortcuts dialog. craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", version = "=0.1.0", features = ["egui", "ui"] } # Separations, ink coverage and the ink manager; same revision as craft-pdf and the krilla patch. diff --git a/crates/engine/src/cmd/datamerge/parse.rs b/crates/engine/src/cmd/datamerge/parse.rs index 16ce57b0f..77dfb669a 100644 --- a/crates/engine/src/cmd/datamerge/parse.rs +++ b/crates/engine/src/cmd/datamerge/parse.rs @@ -358,9 +358,9 @@ fn decode_utf8(bytes: &[u8], _name: &str) -> Result { } fn sniff(name: &str, text: &str) -> Delimiter { - match extension(name).as_str() { - "tsv" | "tab" => return Delimiter::Tab, - "csv" => return Delimiter::Comma, + match craft_file_formats::detect(name, &[]) { + Some(craft_file_formats::Format::Tsv) => return Delimiter::Tab, + Some(craft_file_formats::Format::Csv) => return Delimiter::Comma, _ => {} } match craft_csv::sniff_delimiter(text, '"') {