jubarte/lib.rs
1// SPDX-FileCopyrightText: 2026 Jandira Technologies, LLC
2//
3// SPDX-License-Identifier: AGPL-3.0-only
4
5//! # jubarte
6//!
7//! Lossless DOCX redline engine: compare two Word documents and produce a
8//! tracked-changes (redline) `.docx` — the original document with every
9//! difference against the modified one expressed as Word revisions
10//! (insertions, deletions, moves, and format changes) — that opens cleanly
11//! in Microsoft Word. Also lists, accepts, and rejects tracked revisions.
12//!
13//! ## Example
14//!
15//! ```no_run
16//! let original = std::fs::read("original.docx").unwrap();
17//! let modified = std::fs::read("modified.docx").unwrap();
18//! let redline =
19//! jubarte::document_comparer::compare_documents(&original, &modified, "Reviewer")
20//! .expect("compare");
21//! std::fs::write("original_v_modified.docx", &redline).unwrap();
22//! ```
23//!
24//! For author/date/detail-threshold control, build a
25//! [`comparer::WmlComparerSettings`] and call
26//! [`document_comparer::compare_documents_with_settings`]. To inspect a
27//! redline, use [`document_comparer::get_revisions`]; to flatten one, use
28//! [`document_comparer::accept_revisions`] / [`document_comparer::reject_revisions`].
29//! Convert a document to PDF with [`convert::docx_to_pdf`].
30//!
31#![warn(missing_docs)]
32//! ## Provenance
33//!
34//! The comparer is a Rust port of the `WmlComparer`/`DocumentComparer` engine
35//! from [Docxodus](https://github.com/JSv4/Docxodus) (MIT), itself a fork of
36//! Microsoft's [Open-Xml-PowerTools](https://github.com/OfficeDev/Open-Xml-PowerTools)
37//! (MIT). The repository itself is AGPL-3.0-only; `LICENSES/` preserves those
38//! upstream attribution texts without changing the repository license.
39
40/// Core WmlComparer engine (atomize → LCS → produce → finalize).
41pub mod comparer;
42/// Structured comparison log (info / warning / error entries).
43pub mod comparison_log;
44/// Independent DOCX → PDF conversion (not LibreOffice).
45pub mod convert;
46/// Byte-level package API: compare, list, accept, and reject revisions.
47pub mod document_comparer;
48/// Markup simplification (PowerTools `MarkupSimplifier` port).
49pub mod markup_simplifier;
50/// WordprocessingML and related namespace / `XName` constants.
51pub mod namespaces;
52/// Open Packaging Conventions adapter (`PartFs`).
53pub mod opc;
54/// P0-LAB-01 stage counters/timers — no-ops unless `perf-profile` is enabled.
55pub mod perf;
56/// Accept / reject tracked revisions across a package.
57pub mod revision_processor;
58/// ISO Strict → Transitional package normalization.
59pub mod strict_translation;
60/// Unique id helpers for revision markup.
61pub mod unid;
62/// Shared small utilities.
63pub mod util;
64/// `WmlDocument` — document bytes + lazily parsed main part.
65pub mod wml_document;
66/// Arena DOM (`xmllinq`) used by the comparer.
67pub mod xmllinq;
68
69/// [`WmlDocument`] re-export for the common library entry point.
70pub use wml_document::WmlDocument;
71
72#[cfg(test)]
73mod smoke {
74 #[test]
75 fn crate_builds() {
76 assert_eq!(2 + 2, 4);
77 }
78}