Skip to main content

jubarte_opc/
lib.rs

1// SPDX-FileCopyrightText: 2026 Jandira Technologies, LLC
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! # jubarte-opc
6//!
7//! The package floor of the jubarte redline engine: the OPC adapter
8//! (`opc::PartFs`), input admission with its budgets and refusals
9//! (`admission`), markup simplification and strict-to-transitional
10//! normalization (`markup_simplifier`, `strict_translation`), settings
11//! application (`settings`), and the shared Word tables every layer above
12//! reads (default theme, built-in styles, borders, data stores, numbering,
13//! table DOM questions, Word-validity predicates, and the pure render
14//! option types).
15//!
16//! Everything here speaks packages and parts; document comparison,
17//! rendering, editing and the CLI live in the higher jubarte crates.
18//!
19//! # Example
20//!
21//! ```rust,no_run
22//! use jubarte_opc::admission::{InputLimits, admit};
23//! use jubarte_opc::opc::PartFs;
24//!
25//! fn main() -> Result<(), Box<dyn std::error::Error>> {
26//!     let bytes = std::fs::read("contract.docx")?;
27//!     // Bound the ZIP before anything inflates it.
28//!     admit(&bytes, InputLimits::default())?;
29//!     let package = PartFs::open(&bytes)?;
30//!     let main = package.main_document_part().ok_or("no main document part")?;
31//!     println!("main document: {main}");
32//!     for part in package.parts() {
33//!         println!("{part}");
34//!     }
35//!     Ok(())
36//! }
37//! ```
38
39#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
40#![forbid(unsafe_code)]
41#![warn(missing_docs)]
42
43// Shims (plan A5): the dom layer's modules under the names the moved code
44// already uses, so `crate::<module>::…` paths compile unchanged.
45pub(crate) use jubarte_dom::limits;
46pub use jubarte_dom::{ids, namespaces, perf, unid, util, xmllinq};
47
48/// Input admission: budgets, refusal reasons, and the limits types the
49/// bindings and CLI expose.
50pub mod admission;
51/// Word table border aliases and the borders part of `w:tblPr`
52/// normalization. Private in the facade.
53#[doc(hidden)]
54pub mod borders;
55/// Word's built-in style ids and names. Private in the facade.
56#[doc(hidden)]
57pub mod builtin_styles;
58/// Custom XML data-store lookup and the writer's missing-store builder.
59/// Private in the facade.
60#[doc(hidden)]
61pub mod data_stores;
62/// Markup simplification (PowerTools `MarkupSimplifier` port).
63pub mod markup_simplifier;
64/// List numbering shared by every layer above the package floor.
65/// Private in the facade.
66#[doc(hidden)]
67pub mod numbering;
68/// Open Packaging Conventions adapter (`PartFs`).
69pub mod opc;
70/// The pure option types of a DOCX -> PDF conversion. Private in the
71/// facade; the renderer re-exports its types publicly.
72#[doc(hidden)]
73pub mod render_options;
74/// Settings application (`w:settings`).
75pub mod settings;
76/// ISO Strict → Transitional package normalization.
77pub mod strict_translation;
78/// Word table structure questions a DOM walk answers. Private in the
79/// facade.
80#[doc(hidden)]
81pub mod table_dom;
82/// Pure DOM structural predicates shared by validate and the comparers.
83/// Private in the facade.
84#[doc(hidden)]
85pub mod validate_dom;
86/// Word's default theme part, for originals without one. Private in the
87/// facade.
88#[doc(hidden)]
89pub mod word_default_theme;