mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 07:44:40 +00:00
Add shared InDesign conversion facade
This commit is contained in:
4 files changed
+44
No files matched your search
Generated
+12
@@ -1638,6 +1638,13 @@ dependencies = [
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-indd"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"indd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-jmap"
|
||||
version = "0.1.0"
|
||||
@@ -4738,6 +4745,11 @@ version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a"
|
||||
|
||||
[[package]]
|
||||
name = "indd"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/indd-utils?rev=7f3060e5bce78d21ea70e0d5eacb96edce15dfbe#7f3060e5bce78d21ea70e0d5eacb96edce15dfbe"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.14.2"
|
||||
|
||||
@@ -65,6 +65,7 @@ craft-fig = { path = "crates/fig" }
|
||||
craft-fonts-build = { path = "crates/fonts-build" }
|
||||
craft-i18n = { path = "crates/i18n" }
|
||||
craft-idml = { path = "crates/idml" }
|
||||
craft-indd = { path = "crates/indd" }
|
||||
craft-jmap = { path = "crates/jmap" }
|
||||
craft-ical = { path = "crates/ical" }
|
||||
craft-jpeg = { path = "crates/jpeg" }
|
||||
@@ -126,6 +127,7 @@ craft-vectordrawable = { path = "crates/vectordrawable" }
|
||||
craft-xls = { path = "crates/xls" }
|
||||
craft-wordmodel = { path = "crates/wordmodel" }
|
||||
craft-xlsx = { path = "crates/xlsx" }
|
||||
indd = { git = "https://github.com/storytold/indd-utils", rev = "7f3060e5bce78d21ea70e0d5eacb96edce15dfbe" }
|
||||
craft-xcf = { path = "crates/xcf" }
|
||||
craft-xml = { path = "crates/xml" }
|
||||
craft-zip = { path = "crates/zip" }
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "craft-indd"
|
||||
description = "Shared InDesign document to IDML conversion facade for Craft applications"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
indd = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,16 @@
|
||||
//! Shared InDesign document conversion boundary.
|
||||
//!
|
||||
//! InDesign's binary document model is converted to IDML here. Applications can import the
|
||||
//! resulting package through [`craft_idml`] while retaining only their own model and UI mapping.
|
||||
|
||||
pub use indd::{Conversion, Error, Preview, Warning};
|
||||
|
||||
/// Whether `bytes` begins with the fixed signature of an InDesign document.
|
||||
pub fn is_indd(bytes: &[u8]) -> bool {
|
||||
bytes.starts_with(&indd::header::SIGNATURE)
|
||||
}
|
||||
|
||||
/// Convert an InDesign document to IDML. `name` is the file name stored in the package.
|
||||
pub fn convert(bytes: &[u8], name: &str) -> Result<Conversion, Error> {
|
||||
indd::convert(bytes, name)
|
||||
}
|
||||
Reference in new issue
Block a user