bobzhang/docx2html/batch does not have a README file

BatchError

pub(all) suberror BatchError {
BatchError(String)
} derive(Eq)

A script that cannot be parsed or applied. Messages are agent-facing and name the op index and key.
impl Show for BatchError

BatchError::equal

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn BatchError::equal(BatchError, BatchError) -> Bool

BatchError::not_equal

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn BatchError::not_equal(x : BatchError, y : BatchError) -> Bool

BatchError::output

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn BatchError::output(self : BatchError, logger : &Logger) -> Unit

BatchError::to_string

#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn BatchError::to_string(self : BatchError) -> String

AnnotateEnvelope

pub struct AnnotateEnvelope {
// private fields
}

A parsed docx.annotate/1 envelope: WHO plus the plain-content body. Anchors are CLI flags (--at/--to), never envelope keys.

AnnotateEnvelope::author

fn AnnotateEnvelope::author(self : AnnotateEnvelope) -> String

The comment author, verbatim.

AnnotateEnvelope::build_body

Builds the plain-content body paragraphs.

AnnotateEnvelope::date

fn AnnotateEnvelope::date(self : AnnotateEnvelope) -> String?

The lexical timestamp, when given (validated by the writer layer).

AnnotateEnvelope::initials

fn AnnotateEnvelope::initials(self : AnnotateEnvelope) -> String?

The author initials, when given.

BatchComment

pub struct BatchComment {
// private fields
}

One built comment, ready for the writer: metadata verbatim, anchors as 0-based body BLOCK indexes (comment ops produce no blocks, so these are NOT op indexes), and the built plain-content body. at() is the op address ("ops[4]") so callers can attribute writer-side failures — the date's lexical xsd:dateTime check happens there — to the exact script op.

BatchComment::at

fn BatchComment::at(self : BatchComment) -> String

The op address ("ops[4]") for error attribution.

BatchComment::author

fn BatchComment::author(self : BatchComment) -> String

The comment author, verbatim.

BatchComment::body

The built plain-content body paragraphs (a fresh copy).

BatchComment::date

fn BatchComment::date(self : BatchComment) -> String?

The lexical timestamp, when given (validated by the writer).

BatchComment::done

fn BatchComment::done(self : BatchComment) -> Bool?

The resolution flag, when the op set one.

BatchComment::from_block

fn BatchComment::from_block(self : BatchComment) -> Int?

First anchored body block (0-based block index, not op index), or None for a reply (replies are anchorless).

BatchComment::initials

fn BatchComment::initials(self : BatchComment) -> String?

The author initials, when given.

BatchComment::reply_to

fn BatchComment::reply_to(self : BatchComment) -> Int?

The dense comment index (= writer id) this reply answers, or None for an anchored comment.

BatchComment::to_block

fn BatchComment::to_block(self : BatchComment) -> Int?

Last anchored body block (inclusive), or None for a reply.

BatchNote

pub struct BatchNote {
// private fields
}

One built note body plus its script address for error attribution.

BatchNote::at

fn BatchNote::at(self : BatchNote) -> String

The script address ("ops[2].params.runs[1].footnote") of this note.

BatchNote::body

The built plain-content body paragraphs (a fresh copy).

BatchScript

pub struct BatchScript {
// private fields
}

A parsed, validated batch script.

BatchScript::block_op

fn BatchScript::block_op(self : BatchScript, block : Int) -> Int?

The script op index that produced body block block (what build_body returns at that position), or None out of range. Comment ops produce no blocks, so this is NOT the identity once a script holds comments — writer failures on dynamic content must be attributed through this mapping.

BatchScript::build_body

Builds writer input from the parsed script and the loaded image bytes (keyed by the exact paths image_paths returned).

BatchScript::build_comments

fn BatchScript::build_comments(self : BatchScript) -> Array[BatchComment] raise BatchError

Builds the writer-facing comment list, in op order (which is also the dense-id order the writer assigns). Comment bodies are plain content, so unlike build_body no image bytes are needed.

BatchScript::build_endnotes

fn BatchScript::build_endnotes(self : BatchScript) -> Array[BatchNote] raise BatchError

Builds the writer-facing endnote bodies (see build_footnotes).

BatchScript::build_footers

fn BatchScript::build_footers(self : BatchScript) -> Array[BatchStory] raise BatchError

Builds the writer-facing footer stories, in op order.

BatchScript::build_footnotes

fn BatchScript::build_footnotes(self : BatchScript) -> Array[BatchNote] raise BatchError

Builds the writer-facing footnote bodies, in first-reference order (the dense per-kind index the body's note references name).

BatchScript::build_headers

fn BatchScript::build_headers(self : BatchScript) -> Array[BatchStory] raise BatchError

Builds the writer-facing header stories, in op order.

BatchScript::comment_count

fn BatchScript::comment_count(self : BatchScript) -> Int

Number of comment ops in the script.

BatchScript::image_occurrences

fn BatchScript::image_occurrences(self : BatchScript) -> Array[String]

Every image reference in document order, INCLUDING duplicates — one entry per media part the writer will emit (image_paths() deduplicates for loading, but each occurrence becomes a distinct part). Fresh-authoring callers bound this against their emitted-media ceilings BEFORE building the writer graph, so a script with thousands of references to one asset is refused cheaply rather than after materializing every part.

BatchScript::image_paths

fn BatchScript::image_paths(self : BatchScript) -> Array[String]

The image files the script references, in first-use order (deduplicated). The caller loads them and passes the bytes to build_body.

BatchScript::image_reference

fn BatchScript::image_reference(self : BatchScript, path : String) -> String?

The script address (ops[i]...image) that first references path, so callers can attribute file-loading failures to the exact op.

BatchScript::note_counts

fn BatchScript::note_counts(self : BatchScript) -> (Int, Int)

Number of footnotes and endnotes in the script.

BatchScript::op_count

fn BatchScript::op_count(self : BatchScript) -> Int

Number of ops in the script, comment ops included.

BatchScript::story_counts

fn BatchScript::story_counts(self : BatchScript) -> (Int, Int)

Number of header and footer ops in the script.

BatchStory

pub struct BatchStory {
// private fields
}

One built header/footer story: its OOXML variant, its script address for error attribution, and the built block content.

BatchStory::at

fn BatchStory::at(self : BatchStory) -> String

The op address ("ops[4]") for error attribution.

BatchStory::body

The built story paragraphs (a fresh copy).

BatchStory::variant

fn BatchStory::variant(self : BatchStory) -> String

The OOXML reference type: default, first, or even.

MAX_BATCH_OPS

let MAX_BATCH_OPS : Int

Maximum number of operations in one DOCX authoring script.

MAX_FONT_SIZE_POINTS

let MAX_FONT_SIZE_POINTS : Int

Bounds mirroring the writer's fail-closed guards, enforced here too so violations are reported with the exact ops[i] address instead of a whole-document writer error: Word's font-size cap (write_document.mbt) and Word's 63-column table limit (write_tables.mbt). Row spans are bounded by the table's remaining rows, exactly like the writer.

MAX_GRID_COLUMNS

let MAX_GRID_COLUMNS : Int

Maximum grid-column count accepted by the DOCX table writer.

SCHEMA_ANNOTATE

let SCHEMA_ANNOTATE : String

The consumed schema behind docx annotate add: one comment for an existing document. Same STRICT discipline as the batch scripts — run check_script_text on the raw text first (duplicate keys, integer lexemes), then this parser rejects unknown keys and wrong types with addressed errors.

SCHEMA_BATCH

let SCHEMA_BATCH : String

The original schema identifier accepted by docx batch scripts: paragraph and table ops only.

SCHEMA_BATCH_V2

let SCHEMA_BATCH_V2 : String

The current major: everything in docx.batch/1 plus comment ops. Consumed schemas widen by new major (the roadmap's rule) — scripts declaring either version parse, but comment needs /2.

check_script_text

fn check_script_text(text : String) -> Unit raise BatchError

Strict lexical validation of the raw script text, run BEFORE @json.parse (the CLI always does; programmatic parse_batch(Json) callers holding original text should too). Two rules the parsed Json tree cannot express:

  • Duplicate keys are refused, addressed with the object's path. @json.parse is last-wins per ECMA-404, which would let {"op": "table", "op": "paragraph"} silently drop half an op. Keys compare DECODED, so "op" duplicates "op".
  • Numbers must be plain decimal integers. Every numeric field in docx.batch/1 is an integer, and a Json Double cannot distinguish 1 from 0.999999999999999999999999 — fractions and exponents are rejected at the lexeme, before precision is lost.

Structure is tracked per {/[ frame; malformed JSON is left for @json.parse to diagnose.

operation_names

fn operation_names() -> Array[String]

Returns the operation discriminator vocabulary in stable order.

parse_annotate

fn parse_annotate(json : Json) -> AnnotateEnvelope raise BatchError

Parses and strictly validates a docx.annotate/1 envelope.

parse_batch

fn parse_batch(script : Json) -> BatchScript raise BatchError

Parses and strictly validates a docx.batch/1 or docx.batch/2 script (comment ops need the /2 declaration).