Expand description
§jubarte-doc
The document operations of the jubarte engine above compare: listing
and settling changes (changes), comment threads (comments,
comment_settlement), Word-validity checks and repair (validate),
the accessibility and structure audit (audit), metadata scrubbing
(scrub), appending documents (append), field updates (fields)
and the maintainer views (debug, inspect). The CriticMarkup
reader (critic) lives here too: it is pure text, and the markdown
layer above re-exports it.
Layout needs the renderer: with the render feature off, the public
items that need layout (audit’s word_layout, the fields update
API, the debug render check) do not exist.
§Example
use jubarte_doc::{changes, comments, validate};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let docx = std::fs::read("redline.docx")?;
for change in changes::list_changes(&docx)? {
println!("{} {:?} by {:?}: {}", change.id, change.kind, change.author, change.text);
}
for comment in comments::list_comments(&docx)? {
println!("c{} {}: {}", comment.id, comment.author, comment.text);
}
for finding in validate::validate(&docx)? {
println!("{} {}: {}", finding.severity, finding.code, finding.message);
}
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.
- append
- Append one document after another. Append one document after another: B’s body follows A’s, and what B’s content refers to (images, links, styles, lists, notes, headers) is carried into A’s package under ids that do not collide with A’s.
- audit
- Accessibility, style and structure findings.
jubarte validate --rules a11y,style,structure: accessibility, style and structure findings with the paragraph id an agent can act on. - changes
- Tracked changes one at a time: list, accept or reject a selection. Tracked changes one at a time: list each with an id, accept or reject a selection and keep the rest tracked, as Word’s Accept/Reject This Change does.
- comments
- Comment threads across the parts that hold them. Comment threads: list every comment with its thread position and the text it is anchored to, and write the comment part family whole.
- comparer
- The comparison core: atomizing, matching, and the redline writer.
WmlComparer core (M4). Port of
WmlComparer.ts. - debug
- Maintainer triage views.
jubarte debug: triage a.docxthat Word refuses, or compare two builds of one. Every report is short on purpose. It counts findings by kind, shows a few examples of each (limit), and with two files prints only what differs. - document_
comparer - One-call document comparison and revision accept/reject.
DocumentComparer façade (M5). Port of
DocumentComparer.ts(compare path). - fields
- Refresh a table of contents and other fields (needs
render). Refresh the cached results of fields from jubarte’s own layout. - 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-ptakes (a paragraphp12, a storyheader1or its paragraphheader1.p2, a cellt0.row1.cell2[.p1], a comment, or changes). - inspect
- Read-only paragraph/package views and the Markdown projection. Read-only views of a DOCX for agents and tools: body paragraphs an edit can address, package facts, and a Markdown projection that carries paragraph ids so the reader’s coordinates are the editor’s coordinates.
- namespaces
- WordprocessingML and related namespace /
XNameconstants. WordprocessingML and related namespace /XNameconstants ported fromPtOpenXmlUtil.ts(the subset the comparer references) — M1.7. - opc
- Open Packaging Conventions adapter (
PartFs). OPC (Open Packaging Conventions) layer — M1.5. - revision_
processor - Accept and reject tracked revisions across a package. Revision accept / reject pipeline (M3).
- scrub
- Remove authors and metadata before sending. Remove who touched a document before it goes out, and find where a text still occurs in one.
- strict_
translation - ISO Strict → Transitional package normalization. ISO/IEC 29500 Strict → Transitional namespace normalization (M8).
- util
- Shared small utilities.
Small shared utilities, ported from
PtUtil.ts(M1.6). - validate
- Check that Word will open a package, and repair it. Word-validity findings beyond the schema: what makes Word refuse or repair a package, as data.
- xmllinq
- Arena DOM (
xmllinq) used by the comparer. LINQ-to-XML-style mutable XML tree, ported fromlib/xml-linq.ts.