Skip to main content

Crate jubarte_opc

Crate jubarte_opc 

Source
Expand description

§jubarte-opc

The package floor of the jubarte redline engine: the OPC adapter (opc::PartFs), input admission with its budgets and refusals (admission), markup simplification and strict-to-transitional normalization (markup_simplifier, strict_translation), settings application (settings), and the shared Word tables every layer above reads (default theme, built-in styles, borders, data stores, numbering, table DOM questions, Word-validity predicates, and the pure render option types).

Everything here speaks packages and parts; document comparison, rendering, editing and the CLI live in the higher jubarte crates.

§Example

use jubarte_opc::admission::{InputLimits, admit};
use jubarte_opc::opc::PartFs;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let bytes = std::fs::read("contract.docx")?;
    // Bound the ZIP before anything inflates it.
    admit(&bytes, InputLimits::default())?;
    let package = PartFs::open(&bytes)?;
    let main = package.main_document_part().ok_or("no main document part")?;
    println!("main document: {main}");
    for part in package.parts() {
        println!("{part}");
    }
    Ok(())
}

Modules§

admission
Input admission: budgets, refusal reasons, and the limits types the bindings and CLI expose. Resource admission for untrusted DOCX input: bound the ZIP container before anything inflates it without limits.
ids
The one grammar of the ids jubarte prints and reads: ShortId (src/ids/short.rs, spec 2026-10-13 §2 and §2.1). The functions here are the options’ views of it: a change (r12, r1+2, header1.r1), a comment (c27), the text a comment covers (c27.text), and what -p takes (a paragraph p12, a story header1 or its paragraph header1.p2, a cell t0.row1.cell2[.p1], a comment, or changes).
markup_simplifier
Markup simplification (PowerTools MarkupSimplifier port). MarkupSimplifier comparison subset (M2).
namespaces
WordprocessingML and related namespace / XName constants. WordprocessingML and related namespace / XName constants ported from PtOpenXmlUtil.ts (the subset the comparer references) — M1.7.
opc
Open Packaging Conventions adapter (PartFs). OPC (Open Packaging Conventions) layer — M1.5.
perf
P0-LAB-01 stage counters/timers — no-ops unless perf-profile is enabled. P0-LAB-01 — feature-gated stage counters and coarse timers.
settings
Settings application (w:settings). Document settings an edit plan writes into word/settings.xml: Track Changes on or off, updateFields on open, and editing restrictions.
strict_translation
ISO Strict → Transitional package normalization. ISO/IEC 29500 Strict → Transitional namespace normalization (M8).
unid
Port of UnidHelper (UnidHelper.ts) — M1.7.
util
Shared small utilities. Small shared utilities, ported from PtUtil.ts (M1.6).
xmllinq
Arena DOM (xmllinq) used by the comparer. LINQ-to-XML-style mutable XML tree, ported from lib/xml-linq.ts.