infrastructure capa

infrastructure-docx-merge

Search-and-replace text merge over .docx files (body, headers, footers), cross-run XML matching — harvested from nestorwheelock/docsed

Search-and-replace text merge over .docx files (body, headers, footers), cross-run XML matching — harvested from nestorwheelock/docsed

Tierinfrastructure
Roleunclassified (baselined)
Pathcrates/infrastructure/docx-merge
Edition2021
Targetsinfrastructure_docx_merge
Public items5 across 0 modules
Tests12

What it is for

Search-and-replace text merge over .docx files: body, headers, and footers, with cross-run XML matching so a search term split across Word's own <w:t> runs (which happens whenever the document was ever edited) still matches. Harvested from nestorwheelock/docsed (Alberto's PUMOT date-correction program, alberto-docsed) — proven in real use; this port adds the test coverage this framework requires (Gate 2.1), not a doubt about the original.

Verified against domain-legal-documents before this port (sprint 4.63, Consensus Log): that crate is record-keeping only (DocumentTemplate, GeneratedDocument — no substitution logic anywhere in it or in application-legal-documents), so this crate is the actual merge engine, not a duplicate of one.

Generalizes the original's single find/replace to an ordered list of replacements, so one call can fill every {{placeholder}} a mail-merge template needs, not just one search term per run.

Capabilities

crate root

Search-and-replace text merge over .docx files: body, headers, and

Item
fn replace_across_runs(run_texts : & String, search : & str, replace : & str,) -> Option <(Vec <String>, usize)>
fn replace_in_xml(xml : & str, search : & str, replace : & str) ->(String, usize)

DocxMergeError

Search-and-replace text merge over .docx files: body, headers, and

Item
pub enum DocxMergeError
DocxMergeError :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
fn merge_docx_bytes(input : & u8, replacements : & (String, String),) -> Result <(Vec <u8>, usize), DocxMergeError>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum DocxMergeError
DocxMergeError :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
fn replace_across_runs(run_texts : & String, search : & str, replace : & str,) -> Option <(Vec <String>, usize)>Given the visible-text runs of one <w:p> paragraph (already split by Word into however many <w:t> segments it happened to save), find every occurrence of search in the concatenated text — including one that spans a run boundary — and return each run's new text with search replaced by replace
fn replace_in_xml(xml : & str, search : & str, replace : & str) ->(String, usize)Runs replace_across_runs over every <w:p> paragraph in one XML part's content, applying a single (search, replace) pair
fn merge_docx_bytes(input : & u8, replacements : & (String, String),) -> Result <(Vec <u8>, usize), DocxMergeError>Merge an ordered list of (search, replace) pairs into a .docx's bytes, across body/headers/footers, applying each pair in sequence (so a mail-merge template's {{name}}, {{address}}, ..

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier infrastructure with 82 other crates: infrastructure-acquire, infrastructure-adapters-google-calendar, infrastructure-adapters-google-gmail, infrastructure-adapters-google-places, infrastructure-adapters-google-trends, infrastructure-adapters-shodan, infrastructure-adapters-yelp, infrastructure-agent, … (82 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)infrastructure
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/infrastructure/docx-merge
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
regex^1noalways
zip^2noalways

Development. None.

Build. None.

Depended on by. Nothing in this workspace.

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libinfrastructure_docx_merge`src/lib.rs`

Error model

Error typeNamed by
DocxMergeErrormerge_docx_bytes

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

No workspace crate depends on this one.

Verification

KindCount
Unit tests12
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root400

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc35
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 3
    "No rustdoc detected" : 2

Metrics

MetricValue
Rust source files1
Source lines370
Code lines299
Public API items5
Public modules0
Tests12
Examples0
Cargo features0
Direct runtime dependencies2
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "enum" : 1
    "function" : 3
    "method" : 1
pie showData
    title Rust source composition
    "Code" : 299
    "Blank or comment" : 71

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las infrastructure · Manual