A fast, helpful, and open-source document parser
rename + pptx
Logan Markewichcbf15c5ead09
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex c185d6f..48cd7a7 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -49,7 +49,7 @@ jobs:if: runner.os == 'Linux'run: |sudo apt-get update- # Fonts: liteparse-docx layout tests need real font faces — 25 of+ # Fonts: liteparse-ooxml layout tests need real font faces — 25 of# them fail in a fontless environment (measurer, list_label,# floating, build::block). Liberation + DejaVu is the set the musl# test run validated; macOS/Windows runners ship system fonts.diff --git a/.github/workflows/release-crates.yml b/.github/workflows/release-crates.ymlindex e833374..08ca2c5 100644--- a/.github/workflows/release-crates.yml+++ b/.github/workflows/release-crates.yml@@ -70,7 +70,7 @@ jobs:# Must precede liteparse: it is a path dependency of the `docx-native`# feature, and cargo refuses to publish a crate whose path deps are# unpublished — optional or not.- publish_if_new liteparse-docx+ publish_if_new liteparse-ooxmlpublish_if_new liteparseenv:CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}diff --git a/Cargo.lock b/Cargo.lockindex 4072aa8..117ebd8 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2047,7 +2047,7 @@ dependencies = ["file-format","flate2","image",- "liteparse-docx",+ "liteparse-ooxml","liteparse-pdfium","liteparse-pdfium-sys","lopdf",@@ -2071,7 +2071,23 @@ dependencies = [][[package]]-name = "liteparse-docx"+name = "liteparse-napi"+version = "2.11.0"+dependencies = [+ "image",+ "liteparse",+ "liteparse-pdfium",+ "liteparse-pdfium-sys",+ "napi",+ "napi-build",+ "napi-derive",+ "serde",+ "serde_json",+ "tokio",+]++[[package]]+name = "liteparse-ooxml"version = "0.1.0"dependencies = ["bitflags 2.13.1",@@ -2091,22 +2107,6 @@ dependencies = ["zip",]-[[package]]-name = "liteparse-napi"-version = "2.11.0"-dependencies = [- "image",- "liteparse",- "liteparse-pdfium",- "liteparse-pdfium-sys",- "napi",- "napi-build",- "napi-derive",- "serde",- "serde_json",- "tokio",-]-[[package]]name = "liteparse-pdfium"version = "1.5.0"diff --git a/Cargo.toml b/Cargo.tomlindex a221706..9e558b3 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -4,7 +4,7 @@ members = ["crates/pdfium-sys","crates/pdfium","crates/liteparse",- "crates/liteparse-docx",+ "crates/liteparse-ooxml","crates/liteparse-napi","crates/liteparse-python","crates/liteparse-wasm",diff --git a/crates/liteparse-docx/ATTRIBUTION.md b/crates/liteparse-ooxml/ATTRIBUTION.mdsimilarity index 99%rename from crates/liteparse-docx/ATTRIBUTION.mdrename to crates/liteparse-ooxml/ATTRIBUTION.mdindex 631bd78..1966eef 100644--- a/crates/liteparse-docx/ATTRIBUTION.md+++ b/crates/liteparse-ooxml/ATTRIBUTION.md@@ -170,8 +170,8 @@ dropped as a numbering id, but must still never be coerced to `1`).### Verifying```-cargo test -p liteparse-docx-cargo build -p liteparse-docx --example parse_probe+cargo test -p liteparse-ooxml+cargo build -p liteparse-ooxml --example parse_probepython3 bench/docx_native_spike/fuzz_attribute_values.py --mode all```diff --git a/crates/liteparse-docx/Cargo.toml b/crates/liteparse-ooxml/Cargo.tomlsimilarity index 92%rename from crates/liteparse-docx/Cargo.tomlrename to crates/liteparse-ooxml/Cargo.tomlindex c9ae531..a1b33c6 100644--- a/crates/liteparse-docx/Cargo.toml+++ b/crates/liteparse-ooxml/Cargo.toml@@ -1,10 +1,10 @@[package]-name = "liteparse-docx"+name = "liteparse-ooxml"version = "0.1.0"edition.workspace = truelicense = "MIT"repository.workspace = true-description = "Native DOCX structure reader (vendored Skia-free subset of dxpdf)"+description = "Native OOXML structure reader (vendored Skia-free subset of dxpdf)"publish = true[dependencies]diff --git a/crates/liteparse-docx/LICENSE b/crates/liteparse-ooxml/LICENSEsimilarity index 100%rename from crates/liteparse-docx/LICENSErename to crates/liteparse-ooxml/LICENSEdiff --git a/crates/liteparse-docx/examples/layout_probe.rs b/crates/liteparse-ooxml/examples/layout_probe.rssimilarity index 94%rename from crates/liteparse-docx/examples/layout_probe.rsrename to crates/liteparse-ooxml/examples/layout_probe.rsindex 3ac8505..d333f85 100644--- a/crates/liteparse-docx/examples/layout_probe.rs+++ b/crates/liteparse-ooxml/examples/layout_probe.rs@@ -1,6 +1,6 @@//! Layout probe — the vendored (fontdb + skrifa) twin of spike 2's harness.//!-//! Taps `liteparse_docx::render::resolve_and_layout` and emits the same JSON+//! Taps `liteparse_ooxml::render::resolve_and_layout` and emits the same JSON//! Lines shape as `bench/docx_layout_spike` (which runs upstream dxpdf with//! Skia), so the two joins directly: same document in, page counts and//! command censuses out, one row per file. Divergence between the two is the@@ -8,13 +8,13 @@//! ~0 where the host has the fonts.//!//! ```text-//! cargo run --release -p liteparse-docx --example layout_probe -- <file.docx>...+//! cargo run --release -p liteparse-ooxml --example layout_probe -- <file.docx>...//! ```use std::time::Instant;-use liteparse_docx::render::layout::draw_command::DrawCommand;-use liteparse_docx::render::resolve_and_layout;+use liteparse_ooxml::render::layout::draw_command::DrawCommand;+use liteparse_ooxml::render::resolve_and_layout;use serde_json::json;/// Running min/max over text positions, so we can check the coordinate@@ -80,7 +80,7 @@ fn run_one(path: &str) -> serde_json::Value {// The vendored parser is fail-open (unknown elements, attribute values// and namespace collisions degrade instead of aborting), so parse// failures here are unexpected — report them loudly.- let doc = match liteparse_docx::docx::parse(&data) {+ let doc = match liteparse_ooxml::docx::parse(&data) {Ok(d) => d,Err(e) => {return json!({ "path": path, "ok": false, "stage": "parse", "error": e.to_string() });diff --git a/crates/liteparse-docx/examples/parse_probe.rs b/crates/liteparse-ooxml/examples/parse_probe.rssimilarity index 80%rename from crates/liteparse-docx/examples/parse_probe.rsrename to crates/liteparse-ooxml/examples/parse_probe.rsindex 8b0e419..157d2c3 100644--- a/crates/liteparse-docx/examples/parse_probe.rs+++ b/crates/liteparse-ooxml/examples/parse_probe.rs@@ -1,7 +1,7 @@fn main() {for path in std::env::args().skip(1) {let bytes = std::fs::read(&path).unwrap();- match liteparse_docx::docx::parse(&bytes) {+ match liteparse_ooxml::docx::parse(&bytes) {Ok(_) => println!("OK {path}"),Err(e) => println!("FAIL {path}: {e}"),}diff --git a/crates/liteparse-docx/src/docx/error.rs b/crates/liteparse-ooxml/src/docx/error.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/error.rsrename to crates/liteparse-ooxml/src/docx/error.rsdiff --git a/crates/liteparse-docx/src/docx/mod.rs b/crates/liteparse-ooxml/src/docx/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/mod.rsrename to crates/liteparse-ooxml/src/docx/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/body.rs b/crates/liteparse-ooxml/src/docx/parse/body.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/body.rsrename to crates/liteparse-ooxml/src/docx/parse/body.rsdiff --git a/crates/liteparse-docx/src/docx/parse/body_schema.rs b/crates/liteparse-ooxml/src/docx/parse/body_schema.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/body_schema.rsrename to crates/liteparse-ooxml/src/docx/parse/body_schema.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/mod.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/anchor.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/anchor.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/anchor.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/anchor.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/color.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/color.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/color.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/color.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/effect.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/effect.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/effect.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/effect.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/fill.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/fill.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/fill.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/fill.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/geometry.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/geometry.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/geometry.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/geometry.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/mod.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/picture.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/picture.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/picture.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/picture.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/shape.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/shape.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/shape.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/shape.rsdiff --git a/crates/liteparse-docx/src/docx/parse/drawing/schema/stroke.rs b/crates/liteparse-ooxml/src/docx/parse/drawing/schema/stroke.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/drawing/schema/stroke.rsrename to crates/liteparse-ooxml/src/docx/parse/drawing/schema/stroke.rsdiff --git a/crates/liteparse-docx/src/docx/parse/fonts.rs b/crates/liteparse-ooxml/src/docx/parse/fonts.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/fonts.rsrename to crates/liteparse-ooxml/src/docx/parse/fonts.rsdiff --git a/crates/liteparse-docx/src/docx/parse/mod.rs b/crates/liteparse-ooxml/src/docx/parse/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/notes.rs b/crates/liteparse-ooxml/src/docx/parse/notes.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/notes.rsrename to crates/liteparse-ooxml/src/docx/parse/notes.rsdiff --git a/crates/liteparse-docx/src/docx/parse/numbering.rs b/crates/liteparse-ooxml/src/docx/parse/numbering.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/numbering.rsrename to crates/liteparse-ooxml/src/docx/parse/numbering.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/colors.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/colors.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/colors.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/colors.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/integer_measure.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/integer_measure.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/integer_measure.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/integer_measure.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/lenient.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/lenient.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/lenient.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/lenient.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/mod.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/st_enums.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/st_enums.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/st_enums.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/st_enums.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/toggles.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/toggles.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/toggles.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/toggles.rsdiff --git a/crates/liteparse-docx/src/docx/parse/primitives/units.rs b/crates/liteparse-ooxml/src/docx/parse/primitives/units.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/primitives/units.rsrename to crates/liteparse-ooxml/src/docx/parse/primitives/units.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/mod.rs b/crates/liteparse-ooxml/src/docx/parse/properties/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/border.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/border.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/border.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/border.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/cnf_style.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/cnf_style.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/cnf_style.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/cnf_style.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/fonts.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/fonts.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/fonts.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/fonts.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/insets.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/insets.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/insets.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/insets.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/lang.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/lang.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/lang.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/lang.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/measure.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/measure.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/measure.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/measure.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/mod.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/paragraph.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/paragraph.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/paragraph.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/paragraph.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/run.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/run.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/run.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/run.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/section.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/section.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/section.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/section.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/shading.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/shading.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/shading.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/shading.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/table.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/table.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/table.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/table.rsdiff --git a/crates/liteparse-docx/src/docx/parse/properties/schema/tabs.rs b/crates/liteparse-ooxml/src/docx/parse/properties/schema/tabs.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/properties/schema/tabs.rsrename to crates/liteparse-ooxml/src/docx/parse/properties/schema/tabs.rsdiff --git a/crates/liteparse-docx/src/docx/parse/rel_rewrite.rs b/crates/liteparse-ooxml/src/docx/parse/rel_rewrite.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/rel_rewrite.rsrename to crates/liteparse-ooxml/src/docx/parse/rel_rewrite.rsdiff --git a/crates/liteparse-docx/src/docx/parse/serde_xml.rs b/crates/liteparse-ooxml/src/docx/parse/serde_xml.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/serde_xml.rsrename to crates/liteparse-ooxml/src/docx/parse/serde_xml.rsdiff --git a/crates/liteparse-docx/src/docx/parse/settings.rs b/crates/liteparse-ooxml/src/docx/parse/settings.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/settings.rsrename to crates/liteparse-ooxml/src/docx/parse/settings.rsdiff --git a/crates/liteparse-docx/src/docx/parse/styles.rs b/crates/liteparse-ooxml/src/docx/parse/styles.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/styles.rsrename to crates/liteparse-ooxml/src/docx/parse/styles.rsdiff --git a/crates/liteparse-docx/src/docx/parse/theme/mod.rs b/crates/liteparse-ooxml/src/docx/parse/theme/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/theme/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/theme/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/theme/script.rs b/crates/liteparse-ooxml/src/docx/parse/theme/script.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/theme/script.rsrename to crates/liteparse-ooxml/src/docx/parse/theme/script.rsdiff --git a/crates/liteparse-docx/src/docx/parse/vml/color.rs b/crates/liteparse-ooxml/src/docx/parse/vml/color.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/vml/color.rsrename to crates/liteparse-ooxml/src/docx/parse/vml/color.rsdiff --git a/crates/liteparse-docx/src/docx/parse/vml/formulas.rs b/crates/liteparse-ooxml/src/docx/parse/vml/formulas.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/vml/formulas.rsrename to crates/liteparse-ooxml/src/docx/parse/vml/formulas.rsdiff --git a/crates/liteparse-docx/src/docx/parse/vml/mod.rs b/crates/liteparse-ooxml/src/docx/parse/vml/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/vml/mod.rsrename to crates/liteparse-ooxml/src/docx/parse/vml/mod.rsdiff --git a/crates/liteparse-docx/src/docx/parse/vml/path_commands.rs b/crates/liteparse-ooxml/src/docx/parse/vml/path_commands.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/vml/path_commands.rsrename to crates/liteparse-ooxml/src/docx/parse/vml/path_commands.rsdiff --git a/crates/liteparse-docx/src/docx/parse/vml/schema.rs b/crates/liteparse-ooxml/src/docx/parse/vml/schema.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/vml/schema.rsrename to crates/liteparse-ooxml/src/docx/parse/vml/schema.rsdiff --git a/crates/liteparse-docx/src/docx/parse/vml/style.rs b/crates/liteparse-ooxml/src/docx/parse/vml/style.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/parse/vml/style.rsrename to crates/liteparse-ooxml/src/docx/parse/vml/style.rsdiff --git a/crates/liteparse-docx/src/docx/relationships.rs b/crates/liteparse-ooxml/src/docx/relationships.rssimilarity index 89%rename from crates/liteparse-docx/src/docx/relationships.rsrename to crates/liteparse-ooxml/src/docx/relationships.rsindex 7adf310..0842e62 100644--- a/crates/liteparse-docx/src/docx/relationships.rs+++ b/crates/liteparse-ooxml/src/docx/relationships.rs@@ -61,6 +61,18 @@ pub enum RelationshipType {StylesWithEffects,/// §11.3.8: glossary/building blocks document.GlossaryDocument,+ /// §13.3.8: a slide (PresentationML).+ Slide,+ /// §13.3.9: a slide layout (PresentationML).+ SlideLayout,+ /// §13.3.10: a slide master (PresentationML).+ SlideMaster,+ /// §13.3.5: a notes slide (PresentationML).+ NotesSlide,+ /// §13.3.4: the notes master (PresentationML).+ NotesMaster,+ /// §13.3.3: the handout master (PresentationML).+ HandoutMaster,/// Any relationship type not listed above.Unknown(String),}@@ -110,6 +122,22 @@ impl RelationshipType {Self::StylesWithEffects} else if uri.ends_with("/glossaryDocument") {Self::GlossaryDocument+ // PresentationML (§13.3). Order is not load-bearing here — no PPTX+ // type is a `/`-suffix of another (`/notesSlide` does not end with+ // `/slide`, `/slideLayout` does not end with `/slide`) — but keep the+ // longer names first anyway so a future addition cannot shadow.+ } else if uri.ends_with("/slideLayout") {+ Self::SlideLayout+ } else if uri.ends_with("/slideMaster") {+ Self::SlideMaster+ } else if uri.ends_with("/notesSlide") {+ Self::NotesSlide+ } else if uri.ends_with("/notesMaster") {+ Self::NotesMaster+ } else if uri.ends_with("/handoutMaster") {+ Self::HandoutMaster+ } else if uri.ends_with("/slide") {+ Self::Slide} else {warn!("unknown relationship type: {}", uri);Self::Unknown(uri.to_string())diff --git a/crates/liteparse-docx/src/docx/whitespace_workaround.rs b/crates/liteparse-ooxml/src/docx/whitespace_workaround.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/whitespace_workaround.rsrename to crates/liteparse-ooxml/src/docx/whitespace_workaround.rsdiff --git a/crates/liteparse-docx/src/docx/zip.rs b/crates/liteparse-ooxml/src/docx/zip.rssimilarity index 100%rename from crates/liteparse-docx/src/docx/zip.rsrename to crates/liteparse-ooxml/src/docx/zip.rsdiff --git a/crates/liteparse-docx/src/error.rs b/crates/liteparse-ooxml/src/error.rssimilarity index 100%rename from crates/liteparse-docx/src/error.rsrename to crates/liteparse-ooxml/src/error.rsdiff --git a/crates/liteparse-docx/src/field/ast.rs b/crates/liteparse-ooxml/src/field/ast.rssimilarity index 100%rename from crates/liteparse-docx/src/field/ast.rsrename to crates/liteparse-ooxml/src/field/ast.rsdiff --git a/crates/liteparse-docx/src/field/context.rs b/crates/liteparse-ooxml/src/field/context.rssimilarity index 100%rename from crates/liteparse-docx/src/field/context.rsrename to crates/liteparse-ooxml/src/field/context.rsdiff --git a/crates/liteparse-docx/src/field/error.rs b/crates/liteparse-ooxml/src/field/error.rssimilarity index 100%rename from crates/liteparse-docx/src/field/error.rsrename to crates/liteparse-ooxml/src/field/error.rsdiff --git a/crates/liteparse-docx/src/field/eval.rs b/crates/liteparse-ooxml/src/field/eval.rssimilarity index 100%rename from crates/liteparse-docx/src/field/eval.rsrename to crates/liteparse-ooxml/src/field/eval.rsdiff --git a/crates/liteparse-docx/src/field/format.rs b/crates/liteparse-ooxml/src/field/format.rssimilarity index 100%rename from crates/liteparse-docx/src/field/format.rsrename to crates/liteparse-ooxml/src/field/format.rsdiff --git a/crates/liteparse-docx/src/field/mod.rs b/crates/liteparse-ooxml/src/field/mod.rssimilarity index 95%rename from crates/liteparse-docx/src/field/mod.rsrename to crates/liteparse-ooxml/src/field/mod.rsindex c26264d..a6565e9 100644--- a/crates/liteparse-docx/src/field/mod.rs+++ b/crates/liteparse-ooxml/src/field/mod.rs@@ -6,7 +6,7 @@//! # Examples//!//! ```-//! use liteparse_docx::field::{parse, evaluate, FieldContext};+//! use liteparse_ooxml::field::{parse, evaluate, FieldContext};//!//! // Parse a PAGE field//! let instr = parse(" PAGE ").unwrap();diff --git a/crates/liteparse-docx/src/field/parse.rs b/crates/liteparse-ooxml/src/field/parse.rssimilarity index 100%rename from crates/liteparse-docx/src/field/parse.rsrename to crates/liteparse-ooxml/src/field/parse.rsdiff --git a/crates/liteparse-docx/src/field/switches.rs b/crates/liteparse-ooxml/src/field/switches.rssimilarity index 100%rename from crates/liteparse-docx/src/field/switches.rsrename to crates/liteparse-ooxml/src/field/switches.rsdiff --git a/crates/liteparse-docx/src/lib.rs b/crates/liteparse-ooxml/src/lib.rssimilarity index 61%rename from crates/liteparse-docx/src/lib.rsrename to crates/liteparse-ooxml/src/lib.rsindex d88a529..52d6a36 100644--- a/crates/liteparse-docx/src/lib.rs+++ b/crates/liteparse-ooxml/src/lib.rs@@ -1,10 +1,15 @@-//! Native DOCX structure reader.+//! Native OOXML structure reader.//!//! Vendored, Skia-free subset of [dxpdf](https://github.com/nerdy-pro/dxpdf)//! 0.4.0 (MIT — see `LICENSE` and `ATTRIBUTION.md`). Upstream is a DOCX→PDF//! engine; this crate keeps only `parse → resolve`, which is where the//! document's *structure* lives, and drops the Skia-bound layout/paint half.//!+//! Named `-ooxml` rather than `-docx` because much of the vendored code is+//! format-neutral OOXML — ZIP packaging, relationships, DrawingML, theme,+//! line breaking, measurement — and is shared with the PPTX reader landing+//! alongside it. `docx` is the DOCX entry point.+//!//! The whole point is that a DOCX already states, explicitly, everything the//! LibreOffice→PDF→projection path has to reverse-engineer from coordinates://! heading levels (`outlineLvl`), list numbering (including `startOverride`),@@ -12,15 +17,16 @@//!//! ```no_run//! let bytes = std::fs::read("report.docx")?;-//! let doc = liteparse_docx::docx::parse(&bytes)?;-//! let resolved = liteparse_docx::render::resolve::resolve(doc);-//! # Ok::<(), liteparse_docx::Error>(())+//! let doc = liteparse_ooxml::docx::parse(&bytes)?;+//! let resolved = liteparse_ooxml::render::resolve::resolve(doc);+//! # Ok::<(), liteparse_ooxml::Error>(())//! ```pub mod docx;pub mod error;pub mod field;pub mod model;+pub mod pptx;pub mod render;pub use error::Error;diff --git a/crates/liteparse-docx/src/model/dimension.rs b/crates/liteparse-ooxml/src/model/dimension.rssimilarity index 100%rename from crates/liteparse-docx/src/model/dimension.rsrename to crates/liteparse-ooxml/src/model/dimension.rsdiff --git a/crates/liteparse-docx/src/model/geometry.rs b/crates/liteparse-ooxml/src/model/geometry.rssimilarity index 100%rename from crates/liteparse-docx/src/model/geometry.rsrename to crates/liteparse-ooxml/src/model/geometry.rsdiff --git a/crates/liteparse-docx/src/model/mod.rs b/crates/liteparse-ooxml/src/model/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/model/mod.rsrename to crates/liteparse-ooxml/src/model/mod.rsdiff --git a/crates/liteparse-docx/src/model/types/color.rs b/crates/liteparse-ooxml/src/model/types/color.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/color.rsrename to crates/liteparse-ooxml/src/model/types/color.rsdiff --git a/crates/liteparse-docx/src/model/types/content.rs b/crates/liteparse-ooxml/src/model/types/content.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/content.rsrename to crates/liteparse-ooxml/src/model/types/content.rsdiff --git a/crates/liteparse-docx/src/model/types/document.rs b/crates/liteparse-ooxml/src/model/types/document.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/document.rsrename to crates/liteparse-ooxml/src/model/types/document.rsdiff --git a/crates/liteparse-docx/src/model/types/drawing.rs b/crates/liteparse-ooxml/src/model/types/drawing.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/drawing.rsrename to crates/liteparse-ooxml/src/model/types/drawing.rsdiff --git a/crates/liteparse-docx/src/model/types/drawing_color.rs b/crates/liteparse-ooxml/src/model/types/drawing_color.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/drawing_color.rsrename to crates/liteparse-ooxml/src/model/types/drawing_color.rsdiff --git a/crates/liteparse-docx/src/model/types/formatting.rs b/crates/liteparse-ooxml/src/model/types/formatting.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/formatting.rsrename to crates/liteparse-ooxml/src/model/types/formatting.rsdiff --git a/crates/liteparse-docx/src/model/types/identifiers.rs b/crates/liteparse-ooxml/src/model/types/identifiers.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/identifiers.rsrename to crates/liteparse-ooxml/src/model/types/identifiers.rsdiff --git a/crates/liteparse-docx/src/model/types/mod.rs b/crates/liteparse-ooxml/src/model/types/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/mod.rsrename to crates/liteparse-ooxml/src/model/types/mod.rsdiff --git a/crates/liteparse-docx/src/model/types/numbering.rs b/crates/liteparse-ooxml/src/model/types/numbering.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/numbering.rsrename to crates/liteparse-ooxml/src/model/types/numbering.rsdiff --git a/crates/liteparse-docx/src/model/types/paragraph.rs b/crates/liteparse-ooxml/src/model/types/paragraph.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/paragraph.rsrename to crates/liteparse-ooxml/src/model/types/paragraph.rsdiff --git a/crates/liteparse-docx/src/model/types/run_properties.rs b/crates/liteparse-ooxml/src/model/types/run_properties.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/run_properties.rsrename to crates/liteparse-ooxml/src/model/types/run_properties.rsdiff --git a/crates/liteparse-docx/src/model/types/section.rs b/crates/liteparse-ooxml/src/model/types/section.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/section.rsrename to crates/liteparse-ooxml/src/model/types/section.rsdiff --git a/crates/liteparse-docx/src/model/types/settings.rs b/crates/liteparse-ooxml/src/model/types/settings.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/settings.rsrename to crates/liteparse-ooxml/src/model/types/settings.rsdiff --git a/crates/liteparse-docx/src/model/types/styles.rs b/crates/liteparse-ooxml/src/model/types/styles.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/styles.rsrename to crates/liteparse-ooxml/src/model/types/styles.rsdiff --git a/crates/liteparse-docx/src/model/types/table.rs b/crates/liteparse-ooxml/src/model/types/table.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/table.rsrename to crates/liteparse-ooxml/src/model/types/table.rsdiff --git a/crates/liteparse-docx/src/model/types/theme.rs b/crates/liteparse-ooxml/src/model/types/theme.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/theme.rsrename to crates/liteparse-ooxml/src/model/types/theme.rsdiff --git a/crates/liteparse-docx/src/model/types/vml.rs b/crates/liteparse-ooxml/src/model/types/vml.rssimilarity index 100%rename from crates/liteparse-docx/src/model/types/vml.rsrename to crates/liteparse-ooxml/src/model/types/vml.rsdiff --git a/crates/liteparse-ooxml/src/pptx/mod.rs b/crates/liteparse-ooxml/src/pptx/mod.rsnew file mode 100644index 0000000..1fa2563--- /dev/null+++ b/crates/liteparse-ooxml/src/pptx/mod.rs@@ -0,0 +1,15 @@+//! Native PresentationML (`.pptx`) reader.+//!+//! Shares the OOXML packaging, relationships, DrawingML schema, theme,+//! measurement and line-breaking layers with [`crate::docx`] — see+//! `ATTRIBUTION.md` for what is vendored and what is ours.+//!+//! Unlike DOCX, PPTX **carries its own geometry**: every shape declares+//! `<a:off>`/`<a:ext>` in EMU against a fixed `<p:sldSz>`. So the hard part+//! here is not layout, it is the placeholder cascade — a shape that omits+//! `<a:xfrm>` inherits position and size from its layout, which inherits+//! from its master, and the match rule differs at each rung.++pub mod package;++pub use package::{EMU_PER_POINT, Part, PresentationInfo, PresentationPackage, SlideParts, walk};diff --git a/crates/liteparse-ooxml/src/pptx/package.rs b/crates/liteparse-ooxml/src/pptx/package.rsnew file mode 100644index 0000000..3364c57--- /dev/null+++ b/crates/liteparse-ooxml/src/pptx/package.rs@@ -0,0 +1,427 @@+//! PresentationML package walk: `ppt/presentation.xml` → ordered slides,+//! each joined to its layout, master and notes part.+//!+//! This stage is deliberately *byte-level*. It resolves the part graph and+//! hands back raw XML plus the relationships needed to resolve `r:embed` /+//! `r:id` references later. Nothing here understands a shape. Keeping the+//! graph walk separate from the schema layer is what makes it testable+//! against a corpus without a working reader.+//!+//! Everything it stands on — [`PackageContents`], [`resolve_target`],+//! [`rels_path_for`], [`Relationships`] — is the OOXML packaging layer+//! vendored for DOCX, reused here unchanged. Only [`RelationshipType`]'s+//! PresentationML variants were added.++use crate::docx::error::{ParseError, Result};+use crate::docx::relationships::{RelationshipType, Relationships};+use crate::docx::zip::{PackageContents, part_directory, rels_path_for, resolve_target};++/// EMU per point (§20.1.2.1: 914400 EMU per inch, 72 pt per inch).+pub const EMU_PER_POINT: f64 = 12700.0;++/// The presentation-level facts every slide is laid out against.+#[derive(Clone, Debug)]+pub struct PresentationInfo {+ /// `<p:sldSz>` in EMU. Every slide in a deck shares one size.+ pub slide_width_emu: i64,+ pub slide_height_emu: i64,+ /// `<p:notesSz>` in EMU, when declared.+ pub notes_width_emu: Option<i64>,+ pub notes_height_emu: Option<i64>,+}++impl PresentationInfo {+ /// Slide size in points, the unit the layout engine and `TextItem` use.+ pub fn slide_size_pt(&self) -> (f64, f64) {+ (+ self.slide_width_emu as f64 / EMU_PER_POINT,+ self.slide_height_emu as f64 / EMU_PER_POINT,+ )+ }+}++/// One part's raw bytes plus the relationships declared *by that part*.+///+/// The rels travel with the bytes because `r:id` values are scoped to the+/// part that uses them: a slide's `rId2` and its layout's `rId2` are+/// unrelated. Resolving an image or hyperlink requires knowing which part+/// the reference came from.+#[derive(Clone, Debug)]+pub struct Part {+ /// Package-normalized path (lowercased, no leading `/`).+ pub path: String,+ pub xml: Vec<u8>,+ pub rels: Relationships,+}++impl Part {+ /// Resolve an `r:id` declared by this part to an absolute package path.+ ///+ /// Returns `None` for external targets (hyperlinks), which have no part.+ pub fn resolve_rel(&self, rel_id: &str) -> Option<String> {+ let rel = self.rels.find_by_id(rel_id)?;+ if rel.target_mode == crate::docx::relationships::TargetMode::External {+ return None;+ }+ Some(resolve_target(part_directory(&self.path), &rel.target))+ }+}++/// A slide joined to the parts it inherits from.+///+/// `layout` and `master` are `Option` because the cascade must degrade+/// rather than fail: a slide with no reachable layout still has its own+/// directly-applied text and geometry, and refusing to parse it would be+/// the fail-closed behaviour this vendor has already had to retire four+/// times (see `ATTRIBUTION.md`).+#[derive(Clone, Debug)]+pub struct SlideParts {+ pub slide: Part,+ pub layout: Option<Part>,+ pub master: Option<Part>,+ pub notes: Option<Part>,+}++/// The whole deck, walked but not yet understood.+///+/// Deliberately neither `Clone` nor `Debug`: it owns every media part, so a+/// clone copies the whole deck's images (390 MB across the corpus) and a+/// debug-print dumps them.+pub struct PresentationPackage {+ pub info: PresentationInfo,+ /// Slides in **presentation order** — `<p:sldIdLst>`, not part order.+ pub slides: Vec<SlideParts>,+ /// `ppt/theme/themeN.xml` for the first master, when present.+ pub theme: Option<Vec<u8>>,+ /// The notes master, shared by every notes slide.+ pub notes_master: Option<Part>,+ /// Raw media parts, keyed by normalized package path.+ pub package: PackageContents,+}++/// Walk a `.pptx` container into its part graph.+pub fn walk(data: &[u8]) -> Result<PresentationPackage> {+ let package = PackageContents::from_bytes(data)?;++ // The presentation part is reached through the package root rels rather+ // than assumed to be `ppt/presentation.xml`. The path is conventional,+ // not mandated, and the 9 docProps-less decks in the corpus are already+ // proof that "every producer follows convention" is a bad bet.+ let root_rels = load_rels(&package, "");+ let pres_path = root_rels+ .find_by_type(&RelationshipType::OfficeDocument)+ .map(|r| resolve_target("", &r.target))+ .unwrap_or_else(|| "ppt/presentation.xml".to_string());++ let pres_xml = package+ .get_part(&pres_path)+ .ok_or_else(|| ParseError::MissingPart(pres_path.clone()))?+ .to_vec();+ let pres_rels = load_rels(&package, &pres_path);+ let pres = Part {+ path: pres_path,+ xml: pres_xml,+ rels: pres_rels,+ };++ let parsed = parse_presentation(&pres.xml)?;+ let info = PresentationInfo {+ // §19.2.1.39 makes sldSz optional in schema terms; default to 4:3+ // (9144000 × 6858000 EMU) rather than error, so a malformed deck+ // still yields text at a plausible scale.+ slide_width_emu: parsed.slide_size.map_or(9_144_000, |s| s.0),+ slide_height_emu: parsed.slide_size.map_or(6_858_000, |s| s.1),+ notes_width_emu: parsed.notes_size.map(|s| s.0),+ notes_height_emu: parsed.notes_size.map(|s| s.1),+ };++ let notes_master = pres+ .resolve_rel_of_type(&RelationshipType::NotesMaster)+ .and_then(|p| load_part(&package, &p));++ let mut slides = Vec::new();+ for rel_id in parsed.slide_rel_ids {+ // Order is driven by sldIdLst. Part names are NOT a valid ordering:+ // `slide10.xml` sorts before `slide2.xml` lexically, and hidden or+ // deleted slides leave gaps in the numbering.+ let Some(path) = pres.resolve_rel(&rel_id) else {+ log::warn!("slide r:id {} does not resolve to a part", rel_id);+ continue;+ };+ let Some(slide) = load_part(&package, &path) else {+ log::warn!("slide part missing: {}", path);+ continue;+ };++ let layout = slide+ .resolve_rel_of_type(&RelationshipType::SlideLayout)+ .and_then(|p| load_part(&package, &p));+ // The master hangs off the *layout*, not the slide — a slide has no+ // direct master relationship.+ let master = layout+ .as_ref()+ .and_then(|l| l.resolve_rel_of_type(&RelationshipType::SlideMaster))+ .and_then(|p| load_part(&package, &p));+ let notes = slide+ .resolve_rel_of_type(&RelationshipType::NotesSlide)+ .and_then(|p| load_part(&package, &p));++ slides.push(SlideParts {+ slide,+ layout,+ master,+ notes,+ });+ }++ // Theme comes off the first master. Decks with multiple masters can+ // carry multiple themes; resolving per-master is a colour-fidelity+ // concern deferred until `phClr` substitution lands.+ let theme = slides+ .iter()+ .find_map(|s| s.master.as_ref())+ .and_then(|m| m.resolve_rel_of_type(&RelationshipType::Theme))+ .and_then(|p| package.get_part(&p).map(|b| b.to_vec()));++ Ok(PresentationPackage {+ info,+ slides,+ theme,+ notes_master,+ package,+ })+}++impl Part {+ fn resolve_rel_of_type(&self, ty: &RelationshipType) -> Option<String> {+ let rel = self.rels.find_by_type(ty)?;+ Some(resolve_target(part_directory(&self.path), &rel.target))+ }+}++/// Load a part plus its own `.rels`. A part with no `.rels` file is normal+/// (most layouts have one, many slides do not), so an absent rels file+/// yields an empty set rather than an error.+fn load_part(package: &PackageContents, path: &str) -> Option<Part> {+ let xml = package.get_part(path)?.to_vec();+ let rels = load_rels(package, path);+ Some(Part {+ path: path.to_string(),+ xml,+ rels,+ })+}++fn load_rels(package: &PackageContents, part_path: &str) -> Relationships {+ let rels_path = if part_path.is_empty() {+ "_rels/.rels".to_string()+ } else {+ rels_path_for(part_path)+ };+ package+ .get_part(&rels_path)+ .and_then(|b| match Relationships::parse(b) {+ Ok(r) => Some(r),+ Err(e) => {+ // A malformed rels part costs us image/hyperlink/layout+ // resolution for one part, not the deck.+ log::warn!("failed to parse {}: {}", rels_path, e);+ None+ }+ })+ .unwrap_or_default()+}++// ---------------------------------------------------------------------------+// The presentation part is parsed by hand, NOT with serde. This is the one+// place in the vendor that departs from the serde-schema convention, and the+// reason is a hard limitation rather than taste:+//+// quick-xml's serde layer matches attributes on their **local name with the+// namespace prefix dropped** (the same property `serde_xml.rs` documents for+// *elements*). `<p:sldId id="322" r:id="rId2"/>` therefore presents two+// attributes both named `id`, and deserializing it fails with+// `duplicate field @id` — which is exactly what the corpus reported, 45/45.+//+// There is no serde spelling that distinguishes them: `#[serde(rename =+// "@r:id")]` never matches because the prefix is already gone, and+// `alias = "@id"` would bind the *numeric slide id* to the relationship id —+// silent corruption, the class `ATTRIBUTION.md` records as this vendor's+// recurring trap. (`blip@r:embed` gets away with its alias only because no+// competing `@embed` exists on that element.)+//+// So the r:id-bearing lists are read with a namespace-aware reader that+// compares the *qualified* name. The presentation part is small and flat, so+// the cost is ~50 lines and it stays confined to this module.+//+// The same collision exists on `p:sldMasterId` and `p:sldLayoutId`; anything+// added later that reads those must come through here, not through serde.+// ---------------------------------------------------------------------------++#[derive(Default)]+struct PresentationXml {+ slide_rel_ids: Vec<String>,+ slide_size: Option<(i64, i64)>,+ notes_size: Option<(i64, i64)>,+}++fn parse_presentation(data: &[u8]) -> Result<PresentationXml> {+ use quick_xml::Reader;+ use quick_xml::events::Event;++ let mut reader = Reader::from_reader(data);+ let mut out = PresentationXml::default();+ let mut buf = Vec::new();+ // `sldId` also appears inside `<p:custShowLst>`, whose entries point at+ // slides already listed in sldIdLst. Tracking the enclosing list keeps a+ // custom show from duplicating or reordering the deck.+ let mut in_slide_id_lst = false;++ loop {+ let ev = reader+ .read_event_into(&mut buf)+ .map_err(quick_xml::DeError::from)?;+ match ev {+ Event::Eof => break,+ Event::Start(ref e) | Event::Empty(ref e) => match local_name(e.name().as_ref()) {+ b"sldIdLst" => in_slide_id_lst = !matches!(ev, Event::Empty(_)),+ b"sldId" if in_slide_id_lst => {+ if let Some(id) = qualified_attr(e, b"r:id") {+ out.slide_rel_ids.push(id);+ } else {+ log::warn!("p:sldId without r:id; slide skipped");+ }+ }+ b"sldSz" => out.slide_size = size_attrs(e),+ b"notesSz" => out.notes_size = size_attrs(e),+ _ => {}+ },+ Event::End(ref e) => {+ if local_name(e.name().as_ref()) == b"sldIdLst" {+ in_slide_id_lst = false;+ }+ }+ _ => {}+ }+ buf.clear();+ }+ Ok(out)+}++/// Strip a namespace prefix from a qualified name (`p:sldId` → `sldId`).+fn local_name(qname: &[u8]) -> &[u8] {+ match qname.iter().position(|&b| b == b':') {+ Some(i) => &qname[i + 1..],+ None => qname,+ }+}++/// Read an attribute by its **qualified** name, so `r:id` and `id` stay+/// distinct. Malformed attributes are skipped rather than fatal, matching+/// the fail-open posture of `docx/parse/primitives/lenient.rs`.+fn qualified_attr(e: &quick_xml::events::BytesStart<'_>, want: &[u8]) -> Option<String> {+ e.attributes().flatten().find_map(|a| {+ (a.key.as_ref() == want).then(|| String::from_utf8_lossy(&a.value).into_owned())+ })+}++fn size_attrs(e: &quick_xml::events::BytesStart<'_>) -> Option<(i64, i64)> {+ let cx = qualified_attr(e, b"cx")?.parse().ok()?;+ let cy = qualified_attr(e, b"cy")?.parse().ok()?;+ Some((cx, cy))+}++#[cfg(test)]+mod tests {+ use super::*;++ const PRES: &str = r#"<?xml version="1.0"?>+<p:presentation xmlns:p="p" xmlns:r="r">+ <p:sldMasterIdLst><p:sldMasterId id="2147483660" r:id="rId1"/></p:sldMasterIdLst>+ <p:sldIdLst>+ <p:sldId id="322" r:id="rId2"/>+ <p:sldId id="260" r:id="rId3"/>+ </p:sldIdLst>+ <p:sldSz cx="12192000" cy="6858000"/>+ <p:notesSz cx="6858000" cy="9144000"/>+</p:presentation>"#;++ /// The regression this module exists for. `p:sldId` carries both `@id`+ /// and `@r:id`; quick-xml's serde layer drops namespace prefixes on+ /// attributes, so a serde schema sees `duplicate field @id` and the+ /// whole deck fails to parse (observed: 45/45 of the corpus).+ ///+ /// Two things must hold, and the second is the one that matters: the+ /// r:id must be read, AND the numeric `@id` must never stand in for it.+ #[test]+ fn slide_ids_read_r_id_not_the_numeric_id() {+ let p = parse_presentation(PRES.as_bytes()).unwrap();+ assert_eq!(p.slide_rel_ids, vec!["rId2", "rId3"]);+ // If `@id` ever leaks into this list, resolution silently yields no+ // part and the deck comes out empty rather than erroring.+ assert!(!p.slide_rel_ids.iter().any(|s| s == "322" || s == "260"));+ }++ /// The master list has the same `@id`/`@r:id` shape and sits directly+ /// above sldIdLst. Its entries must not be mistaken for slides.+ #[test]+ fn master_ids_do_not_leak_into_the_slide_list() {+ let p = parse_presentation(PRES.as_bytes()).unwrap();+ assert_eq!(p.slide_rel_ids.len(), 2);+ assert!(!p.slide_rel_ids.iter().any(|s| s == "rId1"));+ }++ /// A custom show references slides already in sldIdLst; counting its+ /// entries would duplicate and reorder the deck.+ #[test]+ fn custom_show_slide_ids_are_ignored() {+ let xml = r#"<p:presentation xmlns:p="p" xmlns:r="r">+ <p:sldIdLst><p:sldId id="1" r:id="rId2"/></p:sldIdLst>+ <p:custShowLst><p:custShow name="s" id="0"><p:sldLst>+ <p:sldId id="1" r:id="rId2"/><p:sldId id="1" r:id="rId2"/>+ </p:sldLst></p:custShow></p:custShowLst>+</p:presentation>"#;+ assert_eq!(+ parse_presentation(xml.as_bytes()).unwrap().slide_rel_ids,+ vec!["rId2"]+ );+ }++ #[test]+ fn sizes_are_read_and_converted() {+ let p = parse_presentation(PRES.as_bytes()).unwrap();+ assert_eq!(p.slide_size, Some((12_192_000, 6_858_000)));+ assert_eq!(p.notes_size, Some((6_858_000, 9_144_000)));+ let info = PresentationInfo {+ slide_width_emu: 12_192_000,+ slide_height_emu: 6_858_000,+ notes_width_emu: None,+ notes_height_emu: None,+ };+ // 12192000 / 12700 = 960 pt, the 16:9 widescreen default.+ assert_eq!(info.slide_size_pt(), (960.0, 540.0));+ }++ /// A deck with no `sldSz` still parses, at a plausible scale, rather+ /// than erroring — the fail-open posture the rest of the vendor uses.+ #[test]+ fn missing_slide_size_falls_back_rather_than_failing() {+ let xml = r#"<p:presentation xmlns:p="p" xmlns:r="r"><p:sldIdLst/></p:presentation>"#;+ let p = parse_presentation(xml.as_bytes()).unwrap();+ assert_eq!(p.slide_size, None);+ assert!(p.slide_rel_ids.is_empty());+ }++ /// An `sldId` missing its r:id is skipped, not fatal, and does not+ /// shift the positions of the slides around it.+ #[test]+ fn slide_without_rel_id_is_skipped() {+ let xml = r#"<p:presentation xmlns:p="p" xmlns:r="r"><p:sldIdLst>+ <p:sldId id="1" r:id="rId2"/><p:sldId id="2"/><p:sldId id="3" r:id="rId4"/>+</p:sldIdLst></p:presentation>"#;+ assert_eq!(+ parse_presentation(xml.as_bytes()).unwrap().slide_rel_ids,+ vec!["rId2", "rId4"]+ );+ }+}diff --git a/crates/liteparse-docx/src/render/dimension.rs b/crates/liteparse-ooxml/src/render/dimension.rssimilarity index 100%rename from crates/liteparse-docx/src/render/dimension.rsrename to crates/liteparse-ooxml/src/render/dimension.rsdiff --git a/crates/liteparse-docx/src/render/emoji/cluster.rs b/crates/liteparse-ooxml/src/render/emoji/cluster.rssimilarity index 100%rename from crates/liteparse-docx/src/render/emoji/cluster.rsrename to crates/liteparse-ooxml/src/render/emoji/cluster.rsdiff --git a/crates/liteparse-docx/src/render/emoji/mod.rs b/crates/liteparse-ooxml/src/render/emoji/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/emoji/mod.rsrename to crates/liteparse-ooxml/src/render/emoji/mod.rsdiff --git a/crates/liteparse-docx/src/render/emoji/resolve.rs b/crates/liteparse-ooxml/src/render/emoji/resolve.rssimilarity index 100%rename from crates/liteparse-docx/src/render/emoji/resolve.rsrename to crates/liteparse-ooxml/src/render/emoji/resolve.rsdiff --git a/crates/liteparse-docx/src/render/error.rs b/crates/liteparse-ooxml/src/render/error.rssimilarity index 100%rename from crates/liteparse-docx/src/render/error.rsrename to crates/liteparse-ooxml/src/render/error.rsdiff --git a/crates/liteparse-docx/src/render/fonts.rs b/crates/liteparse-ooxml/src/render/fonts.rssimilarity index 100%rename from crates/liteparse-docx/src/render/fonts.rsrename to crates/liteparse-ooxml/src/render/fonts.rsdiff --git a/crates/liteparse-docx/src/render/geometry.rs b/crates/liteparse-ooxml/src/render/geometry.rssimilarity index 100%rename from crates/liteparse-docx/src/render/geometry.rsrename to crates/liteparse-ooxml/src/render/geometry.rsdiff --git a/crates/liteparse-docx/src/render/layout/build/block.rs b/crates/liteparse-ooxml/src/render/layout/build/block.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/build/block.rsrename to crates/liteparse-ooxml/src/render/layout/build/block.rsdiff --git a/crates/liteparse-docx/src/render/layout/build/convert.rs b/crates/liteparse-ooxml/src/render/layout/build/convert.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/build/convert.rsrename to crates/liteparse-ooxml/src/render/layout/build/convert.rsdiff --git a/crates/liteparse-docx/src/render/layout/build/floating.rs b/crates/liteparse-ooxml/src/render/layout/build/floating.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/build/floating.rsrename to crates/liteparse-ooxml/src/render/layout/build/floating.rsdiff --git a/crates/liteparse-docx/src/render/layout/build/list_label.rs b/crates/liteparse-ooxml/src/render/layout/build/list_label.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/build/list_label.rsrename to crates/liteparse-ooxml/src/render/layout/build/list_label.rsdiff --git a/crates/liteparse-docx/src/render/layout/build/mod.rs b/crates/liteparse-ooxml/src/render/layout/build/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/build/mod.rsrename to crates/liteparse-ooxml/src/render/layout/build/mod.rsdiff --git a/crates/liteparse-docx/src/render/layout/build/table.rs b/crates/liteparse-ooxml/src/render/layout/build/table.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/build/table.rsrename to crates/liteparse-ooxml/src/render/layout/build/table.rsdiff --git a/crates/liteparse-docx/src/render/layout/cell.rs b/crates/liteparse-ooxml/src/render/layout/cell.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/cell.rsrename to crates/liteparse-ooxml/src/render/layout/cell.rsdiff --git a/crates/liteparse-docx/src/render/layout/draw_command.rs b/crates/liteparse-ooxml/src/render/layout/draw_command.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/draw_command.rsrename to crates/liteparse-ooxml/src/render/layout/draw_command.rsdiff --git a/crates/liteparse-docx/src/render/layout/float.rs b/crates/liteparse-ooxml/src/render/layout/float.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/float.rsrename to crates/liteparse-ooxml/src/render/layout/float.rsdiff --git a/crates/liteparse-docx/src/render/layout/fragment/collect.rs b/crates/liteparse-ooxml/src/render/layout/fragment/collect.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/fragment/collect.rsrename to crates/liteparse-ooxml/src/render/layout/fragment/collect.rsdiff --git a/crates/liteparse-docx/src/render/layout/fragment/mod.rs b/crates/liteparse-ooxml/src/render/layout/fragment/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/fragment/mod.rsrename to crates/liteparse-ooxml/src/render/layout/fragment/mod.rsdiff --git a/crates/liteparse-docx/src/render/layout/fragment/segment.rs b/crates/liteparse-ooxml/src/render/layout/fragment/segment.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/fragment/segment.rsrename to crates/liteparse-ooxml/src/render/layout/fragment/segment.rsdiff --git a/crates/liteparse-docx/src/render/layout/fragment/split.rs b/crates/liteparse-ooxml/src/render/layout/fragment/split.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/fragment/split.rsrename to crates/liteparse-ooxml/src/render/layout/fragment/split.rsdiff --git a/crates/liteparse-docx/src/render/layout/fragment/text.rs b/crates/liteparse-ooxml/src/render/layout/fragment/text.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/fragment/text.rsrename to crates/liteparse-ooxml/src/render/layout/fragment/text.rsdiff --git a/crates/liteparse-docx/src/render/layout/header_footer.rs b/crates/liteparse-ooxml/src/render/layout/header_footer.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/header_footer.rsrename to crates/liteparse-ooxml/src/render/layout/header_footer.rsdiff --git a/crates/liteparse-docx/src/render/layout/line.rs b/crates/liteparse-ooxml/src/render/layout/line.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/line.rsrename to crates/liteparse-ooxml/src/render/layout/line.rsdiff --git a/crates/liteparse-docx/src/render/layout/measurer.rs b/crates/liteparse-ooxml/src/render/layout/measurer.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/measurer.rsrename to crates/liteparse-ooxml/src/render/layout/measurer.rsdiff --git a/crates/liteparse-docx/src/render/layout/mod.rs b/crates/liteparse-ooxml/src/render/layout/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/mod.rsrename to crates/liteparse-ooxml/src/render/layout/mod.rsdiff --git a/crates/liteparse-docx/src/render/layout/page.rs b/crates/liteparse-ooxml/src/render/layout/page.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/page.rsrename to crates/liteparse-ooxml/src/render/layout/page.rsdiff --git a/crates/liteparse-docx/src/render/layout/paragraph/borders.rs b/crates/liteparse-ooxml/src/render/layout/paragraph/borders.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/paragraph/borders.rsrename to crates/liteparse-ooxml/src/render/layout/paragraph/borders.rsdiff --git a/crates/liteparse-docx/src/render/layout/paragraph/line_emit.rs b/crates/liteparse-ooxml/src/render/layout/paragraph/line_emit.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/paragraph/line_emit.rsrename to crates/liteparse-ooxml/src/render/layout/paragraph/line_emit.rsdiff --git a/crates/liteparse-docx/src/render/layout/paragraph/mod.rs b/crates/liteparse-ooxml/src/render/layout/paragraph/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/paragraph/mod.rsrename to crates/liteparse-ooxml/src/render/layout/paragraph/mod.rsdiff --git a/crates/liteparse-docx/src/render/layout/paragraph/types.rs b/crates/liteparse-ooxml/src/render/layout/paragraph/types.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/paragraph/types.rsrename to crates/liteparse-ooxml/src/render/layout/paragraph/types.rsdiff --git a/crates/liteparse-docx/src/render/layout/section/floating_table.rs b/crates/liteparse-ooxml/src/render/layout/section/floating_table.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/section/floating_table.rsrename to crates/liteparse-ooxml/src/render/layout/section/floating_table.rsdiff --git a/crates/liteparse-docx/src/render/layout/section/helpers.rs b/crates/liteparse-ooxml/src/render/layout/section/helpers.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/section/helpers.rsrename to crates/liteparse-ooxml/src/render/layout/section/helpers.rsdiff --git a/crates/liteparse-docx/src/render/layout/section/layout.rs b/crates/liteparse-ooxml/src/render/layout/section/layout.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/section/layout.rsrename to crates/liteparse-ooxml/src/render/layout/section/layout.rsdiff --git a/crates/liteparse-docx/src/render/layout/section/mod.rs b/crates/liteparse-ooxml/src/render/layout/section/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/section/mod.rsrename to crates/liteparse-ooxml/src/render/layout/section/mod.rsdiff --git a/crates/liteparse-docx/src/render/layout/section/stacker.rs b/crates/liteparse-ooxml/src/render/layout/section/stacker.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/section/stacker.rsrename to crates/liteparse-ooxml/src/render/layout/section/stacker.rsdiff --git a/crates/liteparse-docx/src/render/layout/section/types.rs b/crates/liteparse-ooxml/src/render/layout/section/types.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/section/types.rsrename to crates/liteparse-ooxml/src/render/layout/section/types.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/borders.rs b/crates/liteparse-ooxml/src/render/layout/table/borders.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/borders.rsrename to crates/liteparse-ooxml/src/render/layout/table/borders.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/emit.rs b/crates/liteparse-ooxml/src/render/layout/table/emit.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/emit.rsrename to crates/liteparse-ooxml/src/render/layout/table/emit.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/grid.rs b/crates/liteparse-ooxml/src/render/layout/table/grid.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/grid.rsrename to crates/liteparse-ooxml/src/render/layout/table/grid.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/measure.rs b/crates/liteparse-ooxml/src/render/layout/table/measure.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/measure.rsrename to crates/liteparse-ooxml/src/render/layout/table/measure.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/mod.rs b/crates/liteparse-ooxml/src/render/layout/table/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/mod.rsrename to crates/liteparse-ooxml/src/render/layout/table/mod.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/split.rs b/crates/liteparse-ooxml/src/render/layout/table/split.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/split.rsrename to crates/liteparse-ooxml/src/render/layout/table/split.rsdiff --git a/crates/liteparse-docx/src/render/layout/table/types.rs b/crates/liteparse-ooxml/src/render/layout/table/types.rssimilarity index 100%rename from crates/liteparse-docx/src/render/layout/table/types.rsrename to crates/liteparse-ooxml/src/render/layout/table/types.rsdiff --git a/crates/liteparse-docx/src/render/mod.rs b/crates/liteparse-ooxml/src/render/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/mod.rsrename to crates/liteparse-ooxml/src/render/mod.rsdiff --git a/crates/liteparse-docx/src/render/raster.rs b/crates/liteparse-ooxml/src/render/raster.rssimilarity index 100%rename from crates/liteparse-docx/src/render/raster.rsrename to crates/liteparse-ooxml/src/render/raster.rsdiff --git a/crates/liteparse-docx/src/render/resolve/color.rs b/crates/liteparse-ooxml/src/render/resolve/color.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/color.rsrename to crates/liteparse-ooxml/src/render/resolve/color.rsdiff --git a/crates/liteparse-docx/src/render/resolve/conditional.rs b/crates/liteparse-ooxml/src/render/resolve/conditional.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/conditional.rsrename to crates/liteparse-ooxml/src/render/resolve/conditional.rsdiff --git a/crates/liteparse-docx/src/render/resolve/drawing_color.rs b/crates/liteparse-ooxml/src/render/resolve/drawing_color.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/drawing_color.rsrename to crates/liteparse-ooxml/src/render/resolve/drawing_color.rsdiff --git a/crates/liteparse-docx/src/render/resolve/fonts.rs b/crates/liteparse-ooxml/src/render/resolve/fonts.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/fonts.rsrename to crates/liteparse-ooxml/src/render/resolve/fonts.rsdiff --git a/crates/liteparse-docx/src/render/resolve/header_footer.rs b/crates/liteparse-ooxml/src/render/resolve/header_footer.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/header_footer.rsrename to crates/liteparse-ooxml/src/render/resolve/header_footer.rsdiff --git a/crates/liteparse-docx/src/render/resolve/images.rs b/crates/liteparse-ooxml/src/render/resolve/images.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/images.rsrename to crates/liteparse-ooxml/src/render/resolve/images.rsdiff --git a/crates/liteparse-docx/src/render/resolve/locale.rs b/crates/liteparse-ooxml/src/render/resolve/locale.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/locale.rsrename to crates/liteparse-ooxml/src/render/resolve/locale.rsdiff --git a/crates/liteparse-docx/src/render/resolve/mod.rs b/crates/liteparse-ooxml/src/render/resolve/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/mod.rsrename to crates/liteparse-ooxml/src/render/resolve/mod.rsdiff --git a/crates/liteparse-docx/src/render/resolve/numbering.rs b/crates/liteparse-ooxml/src/render/resolve/numbering.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/numbering.rsrename to crates/liteparse-ooxml/src/render/resolve/numbering.rsdiff --git a/crates/liteparse-docx/src/render/resolve/properties.rs b/crates/liteparse-ooxml/src/render/resolve/properties.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/properties.rsrename to crates/liteparse-ooxml/src/render/resolve/properties.rsdiff --git a/crates/liteparse-docx/src/render/resolve/sections.rs b/crates/liteparse-ooxml/src/render/resolve/sections.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/sections.rsrename to crates/liteparse-ooxml/src/render/resolve/sections.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_geometry/custom.rs b/crates/liteparse-ooxml/src/render/resolve/shape_geometry/custom.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_geometry/custom.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_geometry/custom.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_geometry/guides.rs b/crates/liteparse-ooxml/src/render/resolve/shape_geometry/guides.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_geometry/guides.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_geometry/guides.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_geometry/mod.rs b/crates/liteparse-ooxml/src/render/resolve/shape_geometry/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_geometry/mod.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_geometry/mod.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_geometry/presets/line.rs b/crates/liteparse-ooxml/src/render/resolve/shape_geometry/presets/line.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_geometry/presets/line.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_geometry/presets/line.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_geometry/presets/mod.rs b/crates/liteparse-ooxml/src/render/resolve/shape_geometry/presets/mod.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_geometry/presets/mod.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_geometry/presets/mod.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_geometry/presets/rect.rs b/crates/liteparse-ooxml/src/render/resolve/shape_geometry/presets/rect.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_geometry/presets/rect.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_geometry/presets/rect.rsdiff --git a/crates/liteparse-docx/src/render/resolve/shape_visuals.rs b/crates/liteparse-ooxml/src/render/resolve/shape_visuals.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/shape_visuals.rsrename to crates/liteparse-ooxml/src/render/resolve/shape_visuals.rsdiff --git a/crates/liteparse-docx/src/render/resolve/styles.rs b/crates/liteparse-ooxml/src/render/resolve/styles.rssimilarity index 100%rename from crates/liteparse-docx/src/render/resolve/styles.rsrename to crates/liteparse-ooxml/src/render/resolve/styles.rsdiff --git a/crates/liteparse/Cargo.toml b/crates/liteparse/Cargo.tomlindex e575716..5b95cbb 100644--- a/crates/liteparse/Cargo.toml+++ b/crates/liteparse/Cargo.toml@@ -30,13 +30,13 @@ oar-ocr-webgpu = ["oar-ocr", "oar-ocr/webgpu"]oar-ocr-openvino = ["oar-ocr", "oar-ocr/openvino"]tesseract = ["dep:tesseract-rs"]# Native DOCX structure reading (no LibreOffice, no projection).-docx-native = ["dep:liteparse-docx", "liteparse-docx/raster"]+docx-native = ["dep:liteparse-ooxml", "liteparse-ooxml/raster"][dependencies]blake3 = "1"clap = { version = "4.5.55", features = ["derive"] }file-format = { version = "0.29.0", features = ["reader"] }-liteparse-docx = { version = "0.1.0", path = "../liteparse-docx", optional = true }+liteparse-ooxml = { version = "0.1.0", path = "../liteparse-ooxml", optional = true }image = { version = "0.25", default-features = false, features = ["default-formats"] }memchr = "2"ordered-float = "5.3.0"diff --git a/crates/liteparse/src/office/docx.rs b/crates/liteparse/src/office/docx.rsindex 56647d6..a7e25bf 100644--- a/crates/liteparse/src/office/docx.rs+++ b/crates/liteparse/src/office/docx.rs@@ -1,4 +1,4 @@-//! DOCX → [`Block`] using only `liteparse-docx`'s `parse` + `resolve` stages.+//! DOCX → [`Block`] using only `liteparse-ooxml`'s `parse` + `resolve` stages.//!//! Deliberately avoids the vendored crate's `render::layout` stage: structure//! alone — headings, lists, emphasis, merged cells, notes — is recoverable@@ -12,13 +12,13 @@use std::collections::{HashMap, VecDeque};-use liteparse_docx::field::FieldInstruction;-use liteparse_docx::model::{+use liteparse_ooxml::field::FieldInstruction;+use liteparse_ooxml::model::{Block as DocxBlock, HyperlinkTarget, Inline, NoteId, NumId, NumberFormat, OutlineLevel,Paragraph, ParagraphProperties, RunElement, RunProperties, StrikeStyle, StyleId, Table,VerticalMerge,};-use liteparse_docx::render::resolve::ResolvedDocument;+use liteparse_ooxml::render::resolve::ResolvedDocument;use crate::error::LiteParseError;use crate::markdown_layout::{Block, Cell, apply_link, escape_inline};@@ -51,9 +51,9 @@ pub struct EmitOptions {/// fail-open on unknown elements, unknown attribute values and malformed/// scalars, so a document with unmodeled markup still yields blocks.pub fn docx_to_blocks(data: &[u8], extract_links: bool) -> Result<Vec<Block>, LiteParseError> {- let parsed = liteparse_docx::docx::parse(data)+ let parsed = liteparse_ooxml::docx::parse(data).map_err(|e| LiteParseError::Conversion(format!("docx parse failed: {e}")))?;- let resolved = liteparse_docx::render::resolve::resolve(parsed);+ let resolved = liteparse_ooxml::render::resolve::resolve(parsed);Ok(emit(&resolved, extract_links))}@@ -347,7 +347,7 @@ impl<'a> Emitter<'a> {// than a dangling reference.if let Some(queues) = self.figures.as_mut()&& let Some(rel) =- liteparse_docx::render::resolve::images::extract_image_rel_id(img)+ liteparse_ooxml::render::resolve::images::extract_image_rel_id(img)&& let Some(media) = self.doc.media.get(rel)&& let Some(fig) = queues.get_mut(&(media.data.as_ptr() as usize))@@ -818,8 +818,8 @@ mod tests {"/../../docx_files/legal/courts_3rd_circuit_ch4.docx")).expect("corpus fixture");- let parsed = liteparse_docx::docx::parse(&data).expect("fixture parses");- let doc = liteparse_docx::render::resolve::resolve(parsed);+ let parsed = liteparse_ooxml::docx::parse(&data).expect("fixture parses");+ let doc = liteparse_ooxml::render::resolve::resolve(parsed);let tagged = emit_with_sources(&doc,diff --git a/crates/liteparse/src/office/docx_layout.rs b/crates/liteparse/src/office/docx_layout.rsindex 328422d..32a807d 100644--- a/crates/liteparse/src/office/docx_layout.rs+++ b/crates/liteparse/src/office/docx_layout.rs@@ -18,10 +18,10 @@use std::collections::{HashMap, VecDeque};-use liteparse_docx::render::fonts::FontRegistry;-use liteparse_docx::render::layout::draw_command::{DrawCommand, LayoutedPage, OutlineMark};-use liteparse_docx::render::layout::fragment::FontProps;-use liteparse_docx::render::layout::measurer::TextMeasurer;+use liteparse_ooxml::render::fonts::FontRegistry;+use liteparse_ooxml::render::layout::draw_command::{DrawCommand, LayoutedPage, OutlineMark};+use liteparse_ooxml::render::layout::fragment::FontProps;+use liteparse_ooxml::render::layout::measurer::TextMeasurer;use crate::types::{DocumentAnnotation, ExtractedImage, OutlineTarget, Page, Rect, TextItem, WordBox,@@ -97,8 +97,8 @@ pub fn layout_to_pages(underline: false,char_spacing: *char_spacing,text_scale: *text_scale,- underline_position: liteparse_docx::render::dimension::Pt::ZERO,- underline_thickness: liteparse_docx::render::dimension::Pt::ZERO,+ underline_position: liteparse_ooxml::render::dimension::Pt::ZERO,+ underline_thickness: liteparse_ooxml::render::dimension::Pt::ZERO,};let (advance, metrics) = measurer.measure(text, &props);let ascent = metrics.ascent.raw();@@ -406,8 +406,8 @@ pub struct NativeImages {/// everything), so surfacing bytes most consumers cannot decode would be a/// worse contract than omitting them. Word's SVG embeds normally carry a PNG/// fallback blip, which is the one the layout draws.-fn media_extension(format: liteparse_docx::model::ImageFormat) -> Option<&'static str> {- use liteparse_docx::model::ImageFormat as F;+fn media_extension(format: liteparse_ooxml::model::ImageFormat) -> Option<&'static str> {+ use liteparse_ooxml::model::ImageFormat as F;match format {F::Png => Some("png"),F::Jpeg => Some("jpg"),@@ -561,7 +561,7 @@ pub fn image_rects_per_page(layouted: &[LayoutedPage]) -> Vec<Vec<Rect>> {/// continuation pages — inherit the previous page's count, and anything/// before the first anchored block falls back to 1.pub fn page_column_counts(- resolved: &liteparse_docx::render::resolve::ResolvedDocument,+ resolved: &liteparse_ooxml::render::resolve::ResolvedDocument,block_pages: &HashMap<usize, usize>,n_pages: usize,) -> Vec<usize> {@@ -638,10 +638,10 @@ fn union_bounds(items: &[TextItem]) -> Option<Rect> {#[cfg(test)]mod tests {use super::*;- use liteparse_docx::render::dimension::Pt;- use liteparse_docx::render::geometry::{PtOffset, PtRect, PtSize};- use liteparse_docx::render::layout::draw_command::OutlineHeading;- use liteparse_docx::render::resolve::color::RgbColor;+ use liteparse_ooxml::render::dimension::Pt;+ use liteparse_ooxml::render::geometry::{PtOffset, PtRect, PtSize};+ use liteparse_ooxml::render::layout::draw_command::OutlineHeading;+ use liteparse_ooxml::render::resolve::color::RgbColor;use std::rc::Rc;fn registry() -> FontRegistry {@@ -776,7 +776,7 @@ mod tests {&[page(vec![DrawCommand::Outline(OutlineMark::Begin(OutlineHeading {node_id: 1,- level: liteparse_docx::model::OutlineLevel::new(2),+ level: liteparse_ooxml::model::OutlineLevel::new(2),title: Rc::from("Title"),})),text_cmd(72.0, 100.0, "Title", 12.0),diff --git a/crates/liteparse/src/parser.rs b/crates/liteparse/src/parser.rsindex 1d764b7..a894b0d 100644--- a/crates/liteparse/src/parser.rs+++ b/crates/liteparse/src/parser.rs@@ -816,18 +816,18 @@ impl LiteParse {fn parse_docx_native_inner(&self, data: &[u8]) -> Result<Option<ParseResult>, LiteParseError> {use crate::office::{docx, docx_layout};- let parsed = liteparse_docx::docx::parse(data)+ let parsed = liteparse_ooxml::docx::parse(data).map_err(|e| LiteParseError::Conversion(format!("docx parse failed: {e}")))?;- let resolved = liteparse_docx::render::resolve::resolve(parsed);+ let resolved = liteparse_ooxml::render::resolve::resolve(parsed);// Build the registry directly rather than via `resolve_and_layout`,// whose `.expect` panics on a font-less host; here that is a clean// fallback to the conversion path instead.- let registry = liteparse_docx::render::fonts::FontRegistry::build(+ let registry = liteparse_ooxml::render::fonts::FontRegistry::build(&resolved.embedded_fonts,&resolved.font_families,).map_err(|e| LiteParseError::Conversion(format!("font registry: {e}")))?;- let layouted = liteparse_docx::render::layout_document(&resolved, ®istry);+ let layouted = liteparse_ooxml::render::layout_document(&resolved, ®istry);let native = docx_layout::layout_to_pages(&layouted,®istry,@@ -994,15 +994,15 @@ impl LiteParse {data: &[u8],page_numbers: Option<&[u32]>,) -> Result<Vec<ScreenshotResult>, LiteParseError> {- let parsed = liteparse_docx::docx::parse(data)+ let parsed = liteparse_ooxml::docx::parse(data).map_err(|e| LiteParseError::Conversion(format!("docx parse failed: {e}")))?;- let resolved = liteparse_docx::render::resolve::resolve(parsed);- let registry = liteparse_docx::render::fonts::FontRegistry::build(+ let resolved = liteparse_ooxml::render::resolve::resolve(parsed);+ let registry = liteparse_ooxml::render::fonts::FontRegistry::build(&resolved.embedded_fonts,&resolved.font_families,).map_err(|e| LiteParseError::Conversion(format!("font registry: {e}")))?;- let layouted = liteparse_docx::render::layout_document(&resolved, ®istry);+ let layouted = liteparse_ooxml::render::layout_document(&resolved, ®istry);let page_count = layouted.len() as u32;let pages: Vec<u32> = match page_numbers {@@ -1017,7 +1017,7 @@ impl LiteParse {"page {page_num} out of range (document has {page_count} pages)")));}- let raster = liteparse_docx::render::raster::rasterize_page(+ let raster = liteparse_ooxml::render::raster::rasterize_page(&layouted[(page_num - 1) as usize],®istry,scale,