bun-docx 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -43
- package/dist/index.js +478 -293
- package/package.json +11 -3
- package/skills/docx-cli/SKILL.md +125 -0
- package/skills/docx-cli/references/commands.md +53 -0
- package/skills/docx-cli/references/troubleshooting.md +61 -0
- package/skills/docx-cli/scripts/bootstrap.sh +107 -0
package/dist/index.js
CHANGED
|
@@ -91030,15 +91030,190 @@ var init_locators2 = __esm(() => {
|
|
|
91030
91030
|
];
|
|
91031
91031
|
});
|
|
91032
91032
|
|
|
91033
|
+
// src/cli/info/skill.ts
|
|
91034
|
+
var exports_skill = {};
|
|
91035
|
+
__export(exports_skill, {
|
|
91036
|
+
run: () => run33
|
|
91037
|
+
});
|
|
91038
|
+
function renderMarkdown() {
|
|
91039
|
+
return `---
|
|
91040
|
+
name: ${NAME}
|
|
91041
|
+
description: ${JSON.stringify(DESCRIPTION)}
|
|
91042
|
+
---
|
|
91043
|
+
|
|
91044
|
+
${BODY}`;
|
|
91045
|
+
}
|
|
91046
|
+
async function run33(args) {
|
|
91047
|
+
const parsed = await tryParseArgs(args, {
|
|
91048
|
+
json: { type: "boolean" },
|
|
91049
|
+
help: { type: "boolean", short: "h" }
|
|
91050
|
+
}, HELP29);
|
|
91051
|
+
if (typeof parsed === "number")
|
|
91052
|
+
return parsed;
|
|
91053
|
+
if (parsed.values.help) {
|
|
91054
|
+
await writeStdout(HELP29);
|
|
91055
|
+
return EXIT2.OK;
|
|
91056
|
+
}
|
|
91057
|
+
if (parsed.values.json) {
|
|
91058
|
+
await writeStdout(`${JSON.stringify({ name: NAME, description: DESCRIPTION, shortDescription: SHORT_DESCRIPTION, body: BODY }, null, 2)}
|
|
91059
|
+
`);
|
|
91060
|
+
return EXIT2.OK;
|
|
91061
|
+
}
|
|
91062
|
+
await writeStdout(renderMarkdown());
|
|
91063
|
+
return EXIT2.OK;
|
|
91064
|
+
}
|
|
91065
|
+
var HELP29 = `docx info skill \u2014 print the canonical Agent Skill (SKILL.md)
|
|
91066
|
+
|
|
91067
|
+
The binary is the source of truth for the skill. Regenerate the committed copy with:
|
|
91068
|
+
docx info skill > skills/docx-cli/SKILL.md
|
|
91069
|
+
A CI drift test fails if the committed SKILL.md no longer matches this output.
|
|
91070
|
+
|
|
91071
|
+
Usage:
|
|
91072
|
+
docx info skill [options]
|
|
91073
|
+
|
|
91074
|
+
Options:
|
|
91075
|
+
--json Emit { name, description, shortDescription, body } as JSON
|
|
91076
|
+
-h, --help Show this help
|
|
91077
|
+
|
|
91078
|
+
Examples:
|
|
91079
|
+
docx info skill
|
|
91080
|
+
docx info skill > skills/docx-cli/SKILL.md
|
|
91081
|
+
docx info skill --json | jq -r '.description'
|
|
91082
|
+
`, NAME = "docx-cli", DESCRIPTION, SHORT_DESCRIPTION = "Read, edit, redline, and comment on Microsoft Word .docx files from the command line \u2014 built for AI agents.", BODY = `# docx-cli
|
|
91083
|
+
|
|
91084
|
+
\`docx\` is a command-line tool for reading, editing, redlining, and commenting on
|
|
91085
|
+
Microsoft Word \`.docx\` files. It edits the underlying OOXML **in place** (it never
|
|
91086
|
+
rebuilds the document from a lossy view), addresses everything with **stable
|
|
91087
|
+
locators**, and signals success through an **exit code** plus a one-line
|
|
91088
|
+
confirmation \u2014 so even small, cheap models can drive it reliably.
|
|
91089
|
+
|
|
91090
|
+
## 0. Make sure the binary is on PATH
|
|
91091
|
+
|
|
91092
|
+
Run \`docx --version\`. If you get "command not found", install it:
|
|
91093
|
+
|
|
91094
|
+
\`\`\`sh
|
|
91095
|
+
curl -fsSL https://raw.githubusercontent.com/kklimuk/docx-cli/main/install.sh | sh
|
|
91096
|
+
\`\`\`
|
|
91097
|
+
|
|
91098
|
+
Or, from this skill folder, run \`bash scripts/bootstrap.sh\` \u2014 it checks the
|
|
91099
|
+
installed version against the latest release and self-updates. Every verb works
|
|
91100
|
+
against the \`.docx\` zip directly; only \`docx render\` needs Word (macOS/Windows)
|
|
91101
|
+
or LibreOffice installed.
|
|
91102
|
+
|
|
91103
|
+
## 1. The contract is \`--help\` / \`docx info\` \u2014 start there
|
|
91104
|
+
|
|
91105
|
+
The help text is authoritative and versioned with the binary. This skill is thin
|
|
91106
|
+
on purpose and defers to it. Before doing anything, run (none of these need a FILE):
|
|
91107
|
+
|
|
91108
|
+
\`\`\`sh
|
|
91109
|
+
docx --help # every command + a one-line capability hint each
|
|
91110
|
+
docx info locators # the addressing grammar \u2014 READ THIS, it is the backbone
|
|
91111
|
+
docx info schema # the JSON-AST shape that "docx read --ast" emits
|
|
91112
|
+
\`\`\`
|
|
91113
|
+
|
|
91114
|
+
Then \`docx <command> --help\` for any verb before you use it.
|
|
91115
|
+
|
|
91116
|
+
## 2. Locators \u2014 how you address things
|
|
91117
|
+
|
|
91118
|
+
- \`pN\` paragraph, \`tN\` table, \`sN\` section; \`p3:5-20\` = characters 5..19 of \`p3\`;
|
|
91119
|
+
\`pN-pM\` a block range; \`tN:rRcC\` a table cell.
|
|
91120
|
+
- Entities: \`cN\` comment, \`imgN\` image, \`linkN\` hyperlink, \`fnN\`/\`enN\`
|
|
91121
|
+
foot/endnote, \`tcN\` tracked change, \`eqN\` equation.
|
|
91122
|
+
- Get them from \`docx read FILE\` (locators ride the Markdown as \`<!-- pN -->\`
|
|
91123
|
+
comments) or \`docx read FILE --ast\` (lossless JSON).
|
|
91124
|
+
- **Ids are positional and SHIFT after structural edits.** Re-read between
|
|
91125
|
+
mutations \u2014 OR apply many changes from ONE read with \`--batch\` (below).
|
|
91126
|
+
- Pass a locator with \`--at\` (edit / delete / comments / footnotes / images /
|
|
91127
|
+
hyperlinks / tables / track-changes), \`--after\`/\`--before\` (insert), or
|
|
91128
|
+
\`--from\`/\`--to\` (read a slice).
|
|
91129
|
+
- Don't hand-count character offsets: \`docx find FILE "phrase"\` returns the exact
|
|
91130
|
+
span locator (e.g. \`p3:5-20\`) to paste into \`--at\`.
|
|
91131
|
+
|
|
91132
|
+
## 3. Golden workflows
|
|
91133
|
+
|
|
91134
|
+
### Fill out a form or contract (keeps formatting)
|
|
91135
|
+
\`docx replace\` swaps only the text and preserves the run's bold/font and any tab
|
|
91136
|
+
stops \u2014 so it fills bold, tabbed template lines without rebuilding runs.
|
|
91137
|
+
\`\`\`sh
|
|
91138
|
+
docx read contract.docx # see content + locators
|
|
91139
|
+
docx replace contract.docx "[Client Name]" "Acme, Inc." # one field
|
|
91140
|
+
docx replace contract.docx --batch fills.jsonl # many fields, one read/write
|
|
91141
|
+
\`\`\`
|
|
91142
|
+
|
|
91143
|
+
### Redline with tracked changes
|
|
91144
|
+
\`\`\`sh
|
|
91145
|
+
docx track-changes on contract.docx # turn tracking on (doc-level)
|
|
91146
|
+
docx replace contract.docx "Net 90" "Net 30" # now auto-emits <w:ins>/<w:del>
|
|
91147
|
+
docx edit --at p12:0-40 contract.docx --text "\u2026" --track # or redline one edit
|
|
91148
|
+
docx track-changes list contract.docx # the tcN handles
|
|
91149
|
+
docx read contract.docx --current # view redlines as CriticMarkup
|
|
91150
|
+
docx track-changes accept contract.docx --at tc3 # or --all / reject
|
|
91151
|
+
\`\`\`
|
|
91152
|
+
|
|
91153
|
+
### Comment on clauses
|
|
91154
|
+
\`\`\`sh
|
|
91155
|
+
docx comments add contract.docx --anchor "limitation of liability" --text "Cap is too low."
|
|
91156
|
+
docx comments list contract.docx
|
|
91157
|
+
docx comments reply contract.docx --at c0 --text "Agreed, raising to \\$5M."
|
|
91158
|
+
docx comments resolve contract.docx --at c0
|
|
91159
|
+
\`\`\`
|
|
91160
|
+
|
|
91161
|
+
### Read / extract
|
|
91162
|
+
\`\`\`sh
|
|
91163
|
+
docx read FILE # Markdown (default; tracked changes shown accepted-clean)
|
|
91164
|
+
docx read FILE --ast # lossless JSON AST
|
|
91165
|
+
docx wc FILE # word count (whole doc or a slice)
|
|
91166
|
+
docx outline FILE # headings as a locator tree
|
|
91167
|
+
\`\`\`
|
|
91168
|
+
|
|
91169
|
+
### Build from scratch / verify layout
|
|
91170
|
+
\`\`\`sh
|
|
91171
|
+
docx create out.docx --from draft.md # GFM + math + CriticMarkup + inline HTML
|
|
91172
|
+
docx render FILE --out pages/ # PNG per page \u2014 only when LAYOUT is the question
|
|
91173
|
+
\`\`\`
|
|
91174
|
+
|
|
91175
|
+
## 4. Apply many changes from one read \u2014 \`--batch\`
|
|
91176
|
+
|
|
91177
|
+
\`edit\`, \`insert\`, \`replace\`, \`delete\`, and the \`comments\` verbs take
|
|
91178
|
+
\`--batch FILE.jsonl\` (one JSON change per line; \`-\` reads stdin). Every locator
|
|
91179
|
+
in the batch addresses the document **as read**, so ids stay valid across the whole
|
|
91180
|
+
batch \u2014 one read, one write, no re-reading between changes. Keys mirror the
|
|
91181
|
+
command's flags. This is the right tool for filling a form or applying a review.
|
|
91182
|
+
|
|
91183
|
+
## 5. Output & safety contract
|
|
91184
|
+
|
|
91185
|
+
- **Exit code is the success signal:** \`0\` ok, \`1\` error, \`2\` usage, \`3\`
|
|
91186
|
+
not-found. Every command also prints a one-line text confirmation \u2014 you never
|
|
91187
|
+
have to re-read just to learn whether a mutation landed.
|
|
91188
|
+
- Mutators overwrite \`FILE\` **in place** (git is your history). \`-o/--output PATH\`
|
|
91189
|
+
writes a copy instead; \`--dry-run\` previews without writing.
|
|
91190
|
+
- A command that mints a new handle (\`comments add\`\u2192\`cN\`, \`insert\`\u2192\`pN\`,
|
|
91191
|
+
\`footnotes add\`\u2192\`fnN\`, \u2026) prints the bare locator(s), one per line.
|
|
91192
|
+
- Re-read after structural edits (ids shift), or batch from one read.
|
|
91193
|
+
- Need exact literal text in (a URL, prose GFM would mangle)? \`insert\` and
|
|
91194
|
+
\`create\` take \`--text-file PATH\` (\`-\` = stdin): every character lands verbatim,
|
|
91195
|
+
each newline a new paragraph. No escaping burden.
|
|
91196
|
+
|
|
91197
|
+
## 6. Going deeper
|
|
91198
|
+
|
|
91199
|
+
- \`references/commands.md\` \u2014 the full command surface at a glance.
|
|
91200
|
+
- \`references/troubleshooting.md\` \u2014 install, PATH, render runtime, common errors.
|
|
91201
|
+
- Or just run \`docx <command> --help\` \u2014 the authoritative, versioned contract.
|
|
91202
|
+
`;
|
|
91203
|
+
var init_skill = __esm(() => {
|
|
91204
|
+
init_respond();
|
|
91205
|
+
DESCRIPTION = "Read, edit, redline, comment on, and create Microsoft Word .docx files. " + "Use to fill out or edit a Word doc, redline a contract with tracked changes, " + "add/resolve comments, replace text keeping its formatting, restyle headings/fonts, " + "edit tables, or read/extract a .docx as Markdown or text. Also BUILD a new .docx \u2014 " + "from Markdown or programmatically (code that outputs a Word report with headings, " + "tables, images). Not for PDF, Google Docs, Excel, PowerPoint, or .doc.";
|
|
91206
|
+
});
|
|
91207
|
+
|
|
91033
91208
|
// src/cli/info/index.ts
|
|
91034
91209
|
var exports_info = {};
|
|
91035
91210
|
__export(exports_info, {
|
|
91036
|
-
run: () =>
|
|
91211
|
+
run: () => run34
|
|
91037
91212
|
});
|
|
91038
|
-
async function
|
|
91213
|
+
async function run34(args) {
|
|
91039
91214
|
const topic = args[0];
|
|
91040
91215
|
if (!topic || topic === "--help" || topic === "-h" || topic === "help") {
|
|
91041
|
-
await writeStdout(
|
|
91216
|
+
await writeStdout(HELP30);
|
|
91042
91217
|
return topic ? 0 : 2;
|
|
91043
91218
|
}
|
|
91044
91219
|
const loader = SUBCOMMANDS8[topic];
|
|
@@ -91048,7 +91223,7 @@ async function run33(args) {
|
|
|
91048
91223
|
const module_ = await loader();
|
|
91049
91224
|
return module_.run(args.slice(1));
|
|
91050
91225
|
}
|
|
91051
|
-
var SUBCOMMANDS8,
|
|
91226
|
+
var SUBCOMMANDS8, HELP30 = `docx info \u2014 print reference material about the CLI
|
|
91052
91227
|
|
|
91053
91228
|
Usage:
|
|
91054
91229
|
docx info <topic> [options]
|
|
@@ -91056,6 +91231,7 @@ Usage:
|
|
|
91056
91231
|
Topics:
|
|
91057
91232
|
schema Dump AST JSON Schema (or TS source via --ts)
|
|
91058
91233
|
locators Dump locator grammar reference
|
|
91234
|
+
skill Print the canonical Agent Skill (SKILL.md)
|
|
91059
91235
|
|
|
91060
91236
|
Run "docx info <topic> --help" for topic-specific help.
|
|
91061
91237
|
`;
|
|
@@ -91063,16 +91239,17 @@ var init_info = __esm(() => {
|
|
|
91063
91239
|
init_respond();
|
|
91064
91240
|
SUBCOMMANDS8 = {
|
|
91065
91241
|
schema: () => Promise.resolve().then(() => (init_schema(), exports_schema)),
|
|
91066
|
-
locators: () => Promise.resolve().then(() => (init_locators2(), exports_locators))
|
|
91242
|
+
locators: () => Promise.resolve().then(() => (init_locators2(), exports_locators)),
|
|
91243
|
+
skill: () => Promise.resolve().then(() => (init_skill(), exports_skill))
|
|
91067
91244
|
};
|
|
91068
91245
|
});
|
|
91069
91246
|
|
|
91070
91247
|
// src/cli/lists/set.ts
|
|
91071
91248
|
var exports_set = {};
|
|
91072
91249
|
__export(exports_set, {
|
|
91073
|
-
run: () =>
|
|
91250
|
+
run: () => run35
|
|
91074
91251
|
});
|
|
91075
|
-
async function
|
|
91252
|
+
async function run35(args) {
|
|
91076
91253
|
const parsed = await tryParseArgs(args, {
|
|
91077
91254
|
at: { type: "string" },
|
|
91078
91255
|
start: { type: "string" },
|
|
@@ -91080,20 +91257,20 @@ async function run34(args) {
|
|
|
91080
91257
|
restart: { type: "boolean" },
|
|
91081
91258
|
continue: { type: "boolean" },
|
|
91082
91259
|
...SAVE_FLAGS
|
|
91083
|
-
},
|
|
91260
|
+
}, HELP31);
|
|
91084
91261
|
if (typeof parsed === "number")
|
|
91085
91262
|
return parsed;
|
|
91086
91263
|
if (parsed.values.help) {
|
|
91087
|
-
await writeStdout(
|
|
91264
|
+
await writeStdout(HELP31);
|
|
91088
91265
|
return EXIT2.OK;
|
|
91089
91266
|
}
|
|
91090
91267
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
91091
91268
|
const path2 = parsed.positionals[0];
|
|
91092
91269
|
if (!path2)
|
|
91093
|
-
return fail("USAGE", "Missing FILE argument",
|
|
91270
|
+
return fail("USAGE", "Missing FILE argument", HELP31);
|
|
91094
91271
|
const at = parsed.values.at;
|
|
91095
91272
|
if (!at) {
|
|
91096
|
-
return fail("USAGE", "Missing --at LOCATOR (a list item, e.g. p5)",
|
|
91273
|
+
return fail("USAGE", "Missing --at LOCATOR (a list item, e.g. p5)", HELP31);
|
|
91097
91274
|
}
|
|
91098
91275
|
const plan = buildPlan(parsed.values);
|
|
91099
91276
|
if (typeof plan === "string")
|
|
@@ -91202,7 +91379,7 @@ function appliedList(plan) {
|
|
|
91202
91379
|
applied.push(`format=${plan.format}`);
|
|
91203
91380
|
return applied;
|
|
91204
91381
|
}
|
|
91205
|
-
var
|
|
91382
|
+
var HELP31 = `docx lists set \u2014 renumber a numbered list (start value, glyph format, restart/continue)
|
|
91206
91383
|
|
|
91207
91384
|
Usage:
|
|
91208
91385
|
docx lists set FILE --at pN [options]
|
|
@@ -91238,12 +91415,12 @@ var init_set2 = __esm(() => {
|
|
|
91238
91415
|
// src/cli/lists/index.ts
|
|
91239
91416
|
var exports_lists = {};
|
|
91240
91417
|
__export(exports_lists, {
|
|
91241
|
-
run: () =>
|
|
91418
|
+
run: () => run36
|
|
91242
91419
|
});
|
|
91243
|
-
async function
|
|
91420
|
+
async function run36(args) {
|
|
91244
91421
|
const verb = args[0];
|
|
91245
91422
|
if (!verb || verb === "--help" || verb === "-h" || verb === "help") {
|
|
91246
|
-
await writeStdout(
|
|
91423
|
+
await writeStdout(HELP32);
|
|
91247
91424
|
return verb ? 0 : 2;
|
|
91248
91425
|
}
|
|
91249
91426
|
const loader = SUBCOMMANDS9[verb];
|
|
@@ -91253,7 +91430,7 @@ async function run35(args) {
|
|
|
91253
91430
|
const module_ = await loader();
|
|
91254
91431
|
return module_.run(args.slice(1));
|
|
91255
91432
|
}
|
|
91256
|
-
var SUBCOMMANDS9,
|
|
91433
|
+
var SUBCOMMANDS9, HELP32 = `docx lists \u2014 control list numbering (start value, glyph format, restart/continue)
|
|
91257
91434
|
|
|
91258
91435
|
Usage:
|
|
91259
91436
|
docx lists set FILE --at pN [options]
|
|
@@ -91338,23 +91515,23 @@ var init_build = __esm(() => {
|
|
|
91338
91515
|
// src/cli/outline/index.ts
|
|
91339
91516
|
var exports_outline = {};
|
|
91340
91517
|
__export(exports_outline, {
|
|
91341
|
-
run: () =>
|
|
91518
|
+
run: () => run37
|
|
91342
91519
|
});
|
|
91343
|
-
async function
|
|
91520
|
+
async function run37(args) {
|
|
91344
91521
|
const parsed = await tryParseArgs(args, {
|
|
91345
91522
|
"style-prefix": { type: "string" },
|
|
91346
91523
|
json: { type: "boolean" },
|
|
91347
91524
|
help: { type: "boolean", short: "h" }
|
|
91348
|
-
},
|
|
91525
|
+
}, HELP33);
|
|
91349
91526
|
if (typeof parsed === "number")
|
|
91350
91527
|
return parsed;
|
|
91351
91528
|
if (parsed.values.help) {
|
|
91352
|
-
await writeStdout(
|
|
91529
|
+
await writeStdout(HELP33);
|
|
91353
91530
|
return EXIT2.OK;
|
|
91354
91531
|
}
|
|
91355
91532
|
const path2 = parsed.positionals[0];
|
|
91356
91533
|
if (!path2)
|
|
91357
|
-
return fail("USAGE", "Missing FILE argument",
|
|
91534
|
+
return fail("USAGE", "Missing FILE argument", HELP33);
|
|
91358
91535
|
const stylePrefix = parsed.values["style-prefix"] ?? "Heading";
|
|
91359
91536
|
if (stylePrefix.length === 0) {
|
|
91360
91537
|
return fail("USAGE", "--style-prefix cannot be empty");
|
|
@@ -91382,7 +91559,7 @@ function renderOutlineText(entries, depth = 0) {
|
|
|
91382
91559
|
}
|
|
91383
91560
|
return lines;
|
|
91384
91561
|
}
|
|
91385
|
-
var
|
|
91562
|
+
var HELP33 = `docx outline \u2014 list headings as a hierarchical tree
|
|
91386
91563
|
|
|
91387
91564
|
Usage:
|
|
91388
91565
|
docx outline FILE [options]
|
|
@@ -91440,7 +91617,7 @@ function emuToInches(emu) {
|
|
|
91440
91617
|
function deviation(value, def) {
|
|
91441
91618
|
return value !== undefined && value !== def ? value : undefined;
|
|
91442
91619
|
}
|
|
91443
|
-
function
|
|
91620
|
+
function renderMarkdown2(doc, options = {}) {
|
|
91444
91621
|
const blocks = sliceBlocks(doc.blocks, options.from, options.to);
|
|
91445
91622
|
const dominant = detectFormatBaseline(blocks);
|
|
91446
91623
|
const baseline = {
|
|
@@ -91550,17 +91727,17 @@ function detectFormatBaseline(blocks) {
|
|
|
91550
91727
|
const sizeChars = new Map;
|
|
91551
91728
|
let total = 0;
|
|
91552
91729
|
for (const paragraph2 of flattenParagraphs(blocks)) {
|
|
91553
|
-
for (const
|
|
91554
|
-
if (
|
|
91730
|
+
for (const run38 of paragraph2.runs) {
|
|
91731
|
+
if (run38.type !== "text")
|
|
91555
91732
|
continue;
|
|
91556
|
-
const length =
|
|
91733
|
+
const length = run38.text.length;
|
|
91557
91734
|
if (length === 0)
|
|
91558
91735
|
continue;
|
|
91559
91736
|
total += length;
|
|
91560
|
-
if (
|
|
91561
|
-
fontChars.set(
|
|
91562
|
-
if (
|
|
91563
|
-
sizeChars.set(
|
|
91737
|
+
if (run38.font)
|
|
91738
|
+
fontChars.set(run38.font, (fontChars.get(run38.font) ?? 0) + length);
|
|
91739
|
+
if (run38.sizeHalfPoints !== undefined) {
|
|
91740
|
+
sizeChars.set(run38.sizeHalfPoints, (sizeChars.get(run38.sizeHalfPoints) ?? 0) + length);
|
|
91564
91741
|
}
|
|
91565
91742
|
}
|
|
91566
91743
|
}
|
|
@@ -91594,8 +91771,8 @@ function emptyCommentIndex() {
|
|
|
91594
91771
|
orderedIds: []
|
|
91595
91772
|
};
|
|
91596
91773
|
}
|
|
91597
|
-
function isRunVisible(
|
|
91598
|
-
const kind =
|
|
91774
|
+
function isRunVisible(run38, view) {
|
|
91775
|
+
const kind = run38.trackedChange?.kind;
|
|
91599
91776
|
if (!kind)
|
|
91600
91777
|
return true;
|
|
91601
91778
|
if (view === "accepted" && (kind === "del" || kind === "moveFrom"))
|
|
@@ -91610,13 +91787,13 @@ function buildCommentIndex(blocks, options) {
|
|
|
91610
91787
|
const spanText = new Map;
|
|
91611
91788
|
const orderedIds = [];
|
|
91612
91789
|
for (const paragraph2 of flattenParagraphs(blocks)) {
|
|
91613
|
-
paragraph2.runs.forEach((
|
|
91614
|
-
const comments = runComments(
|
|
91790
|
+
paragraph2.runs.forEach((run38, index2) => {
|
|
91791
|
+
const comments = runComments(run38);
|
|
91615
91792
|
if (!comments)
|
|
91616
91793
|
return;
|
|
91617
|
-
if (
|
|
91794
|
+
if (run38.type === "text" && !isRunVisible(run38, view))
|
|
91618
91795
|
return;
|
|
91619
|
-
const spanContribution =
|
|
91796
|
+
const spanContribution = run38.type === "text" ? run38.text : run38.type === "equation" ? run38.text : "";
|
|
91620
91797
|
for (const commentId of comments) {
|
|
91621
91798
|
if (!spanText.has(commentId))
|
|
91622
91799
|
orderedIds.push(commentId);
|
|
@@ -91636,11 +91813,11 @@ function buildCommentIndex(blocks, options) {
|
|
|
91636
91813
|
}
|
|
91637
91814
|
return { endingsByRun, spanText, orderedIds };
|
|
91638
91815
|
}
|
|
91639
|
-
function runComments(
|
|
91640
|
-
if (
|
|
91641
|
-
return
|
|
91642
|
-
if (
|
|
91643
|
-
return
|
|
91816
|
+
function runComments(run38) {
|
|
91817
|
+
if (run38.type === "text")
|
|
91818
|
+
return run38.comments;
|
|
91819
|
+
if (run38.type === "equation")
|
|
91820
|
+
return run38.comments;
|
|
91644
91821
|
return;
|
|
91645
91822
|
}
|
|
91646
91823
|
function slotKey(paragraphId, runIndex) {
|
|
@@ -91713,7 +91890,7 @@ function tabCureRange(ids) {
|
|
|
91713
91890
|
return min === max ? `p${min}` : `p${min}-p${max}`;
|
|
91714
91891
|
}
|
|
91715
91892
|
function layoutHazardNote(paragraph2, ctx) {
|
|
91716
|
-
if (!paragraph2.runs.some((
|
|
91893
|
+
if (!paragraph2.runs.some((run38) => run38.type === "tab"))
|
|
91717
91894
|
return "";
|
|
91718
91895
|
const cols = ctx.governingColumns.get(paragraph2.id) ?? 1;
|
|
91719
91896
|
if (cols > 1) {
|
|
@@ -91786,25 +91963,25 @@ function contentWidthEmu(geometry) {
|
|
|
91786
91963
|
const fallback = (DEFAULT_PAGE.width - 2 * DEFAULT_PAGE.margin) * EMU_PER_TWIP2;
|
|
91787
91964
|
return contentTwips > 0 ? contentTwips * EMU_PER_TWIP2 : fallback;
|
|
91788
91965
|
}
|
|
91789
|
-
function formatImageNote(
|
|
91966
|
+
function formatImageNote(run38, contentEmu) {
|
|
91790
91967
|
const pairs = [];
|
|
91791
|
-
if (
|
|
91968
|
+
if (run38.widthEmu && run38.heightEmu) {
|
|
91792
91969
|
pairs.push([
|
|
91793
91970
|
"size",
|
|
91794
|
-
`${emuToInches(
|
|
91971
|
+
`${emuToInches(run38.widthEmu)}x${emuToInches(run38.heightEmu)}in`
|
|
91795
91972
|
]);
|
|
91796
91973
|
}
|
|
91797
|
-
if (
|
|
91974
|
+
if (run38.floating)
|
|
91798
91975
|
pairs.push(["float", "yes"]);
|
|
91799
|
-
if (
|
|
91800
|
-
pairs.push(["wrap",
|
|
91801
|
-
if (
|
|
91802
|
-
pairs.push(["align",
|
|
91803
|
-
if (
|
|
91976
|
+
if (run38.wrap)
|
|
91977
|
+
pairs.push(["wrap", run38.wrap]);
|
|
91978
|
+
if (run38.align)
|
|
91979
|
+
pairs.push(["align", run38.align]);
|
|
91980
|
+
if (run38.widthEmu && run38.widthEmu > contentEmu)
|
|
91804
91981
|
pairs.push(["overflow", "yes"]);
|
|
91805
91982
|
if (pairs.length === 0)
|
|
91806
91983
|
return "";
|
|
91807
|
-
return ` ${formatNote("image", pairs, [
|
|
91984
|
+
return ` ${formatNote("image", pairs, [run38.id])}`;
|
|
91808
91985
|
}
|
|
91809
91986
|
function documentGeometry(blocks) {
|
|
91810
91987
|
const geometric = blocks.filter((block) => block.type === "sectionBreak" && hasGeometry(block));
|
|
@@ -91910,14 +92087,14 @@ function isCodeBlockParagraph(block) {
|
|
|
91910
92087
|
function renderCodeBlockGroup(paragraphs, ctx) {
|
|
91911
92088
|
if (ctx.options.view !== "baseline" && ctx.options.view !== "accepted") {
|
|
91912
92089
|
for (const paragraph2 of paragraphs) {
|
|
91913
|
-
for (const
|
|
91914
|
-
if (
|
|
91915
|
-
ctx.referencedTrackedChanges.set(
|
|
92090
|
+
for (const run38 of paragraph2.runs) {
|
|
92091
|
+
if (run38.type === "text" && run38.trackedChange) {
|
|
92092
|
+
ctx.referencedTrackedChanges.set(run38.trackedChange.id, run38.trackedChange);
|
|
91916
92093
|
}
|
|
91917
92094
|
}
|
|
91918
92095
|
}
|
|
91919
92096
|
}
|
|
91920
|
-
const lines = paragraphs.map((paragraph2) => paragraph2.runs.filter((
|
|
92097
|
+
const lines = paragraphs.map((paragraph2) => paragraph2.runs.filter((run38) => run38.type === "text" && typeof run38.text === "string").map((run38) => run38.text).join(""));
|
|
91921
92098
|
const firstId = paragraphs[0]?.id ?? "";
|
|
91922
92099
|
const lastId = paragraphs[paragraphs.length - 1]?.id ?? firstId;
|
|
91923
92100
|
const language = codeBlockLanguageFromStyleId(paragraphs[0]?.style) ?? "";
|
|
@@ -92070,10 +92247,10 @@ function headingLevelFor(style) {
|
|
|
92070
92247
|
function renderRuns(paragraphId, runs, ctx, mask, baseOffset) {
|
|
92071
92248
|
const view = ctx.options.view ?? "accepted";
|
|
92072
92249
|
const visibleEntries = [];
|
|
92073
|
-
runs.forEach((
|
|
92074
|
-
if (
|
|
92250
|
+
runs.forEach((run38, index2) => {
|
|
92251
|
+
if (run38.type === "text" && !isRunVisible(run38, view))
|
|
92075
92252
|
return;
|
|
92076
|
-
visibleEntries.push({ run:
|
|
92253
|
+
visibleEntries.push({ run: run38, originalIndex: index2 });
|
|
92077
92254
|
});
|
|
92078
92255
|
let out = "";
|
|
92079
92256
|
let cursor = 0;
|
|
@@ -92084,14 +92261,14 @@ function renderRuns(paragraphId, runs, ctx, mask, baseOffset) {
|
|
|
92084
92261
|
cursor++;
|
|
92085
92262
|
continue;
|
|
92086
92263
|
}
|
|
92087
|
-
const { run:
|
|
92088
|
-
if (
|
|
92264
|
+
const { run: run38 } = entry;
|
|
92265
|
+
if (run38.type === "text") {
|
|
92089
92266
|
let lookahead2 = cursor + 1;
|
|
92090
92267
|
while (lookahead2 < visibleEntries.length) {
|
|
92091
92268
|
const next = visibleEntries[lookahead2];
|
|
92092
92269
|
if (!next || next.run.type !== "text")
|
|
92093
92270
|
break;
|
|
92094
|
-
if (!sameDecoration(
|
|
92271
|
+
if (!sameDecoration(run38, next.run))
|
|
92095
92272
|
break;
|
|
92096
92273
|
lookahead2++;
|
|
92097
92274
|
}
|
|
@@ -92112,29 +92289,29 @@ function renderRuns(paragraphId, runs, ctx, mask, baseOffset) {
|
|
|
92112
92289
|
cursor = lookahead2;
|
|
92113
92290
|
continue;
|
|
92114
92291
|
}
|
|
92115
|
-
if (
|
|
92116
|
-
const alt = sanitizeAltText(
|
|
92117
|
-
const extension2 = extensionForImageMime(
|
|
92118
|
-
out += ` {
|
|
92293
|
+
const alt = sanitizeAltText(run38.alt ?? run38.id);
|
|
92294
|
+
const extension2 = extensionForImageMime(run38.contentType) ?? "bin";
|
|
92295
|
+
out += ``;
|
|
92296
|
+
out += formatImageNote(run38, ctx.contentWidthEmu);
|
|
92297
|
+
} else if (run38.type === "break") {
|
|
92298
|
+
if (run38.kind === "line")
|
|
92122
92299
|
out += `
|
|
92123
92300
|
`;
|
|
92124
|
-
} else if (
|
|
92301
|
+
} else if (run38.type === "tab") {
|
|
92125
92302
|
out += "\t";
|
|
92126
|
-
} else if (
|
|
92127
|
-
const body =
|
|
92128
|
-
out +=
|
|
92303
|
+
} else if (run38.type === "equation") {
|
|
92304
|
+
const body = run38.latex.length > 0 ? run38.latex : run38.text;
|
|
92305
|
+
out += run38.display ? `$$${body}$$` : `$${body}$`;
|
|
92129
92306
|
out += commentEndingsFor(paragraphId, [{ originalIndex: cursor }], ctx.commentIndex);
|
|
92130
|
-
} else if (
|
|
92131
|
-
if (
|
|
92132
|
-
ctx.referencedFootnoteIds.add(
|
|
92307
|
+
} else if (run38.type === "noteRef") {
|
|
92308
|
+
if (run38.kind === "footnote")
|
|
92309
|
+
ctx.referencedFootnoteIds.add(run38.id);
|
|
92133
92310
|
else
|
|
92134
|
-
ctx.referencedEndnoteIds.add(
|
|
92135
|
-
out += `[^${
|
|
92136
|
-
} else if (
|
|
92137
|
-
out += `\`[${
|
|
92311
|
+
ctx.referencedEndnoteIds.add(run38.id);
|
|
92312
|
+
out += `[^${run38.id}]`;
|
|
92313
|
+
} else if (run38.type === "chart") {
|
|
92314
|
+
out += `\`[${run38.kind}]\``;
|
|
92138
92315
|
}
|
|
92139
92316
|
cursor++;
|
|
92140
92317
|
}
|
|
@@ -92168,7 +92345,7 @@ function sameCommentSet(left, right) {
|
|
|
92168
92345
|
return true;
|
|
92169
92346
|
}
|
|
92170
92347
|
function renderTextSegment(runs, view, baseline, mask, offset2) {
|
|
92171
|
-
const text6 = runs.map((
|
|
92348
|
+
const text6 = runs.map((run38) => run38.text).join("");
|
|
92172
92349
|
if (text6.length === 0)
|
|
92173
92350
|
return "";
|
|
92174
92351
|
const first = runs[0];
|
|
@@ -92212,33 +92389,33 @@ function criticMarkerFor(kind) {
|
|
|
92212
92389
|
return "++";
|
|
92213
92390
|
return "--";
|
|
92214
92391
|
}
|
|
92215
|
-
function needsHtmlWrap(
|
|
92216
|
-
return Boolean(
|
|
92392
|
+
function needsHtmlWrap(run38, baseline) {
|
|
92393
|
+
return Boolean(run38.color && !isDefaultColor(run38.color) || run38.colorTheme && !isDefaultThemeColor(run38) || run38.shade || run38.font && run38.font !== baseline.font || run38.sizeHalfPoints !== undefined && run38.sizeHalfPoints !== baseline.sizeHalfPoints || run38.smallCaps || run38.allCaps || run38.underline || run38.vertAlign === "superscript" || run38.vertAlign === "subscript" || run38.highlight);
|
|
92217
92394
|
}
|
|
92218
|
-
function wrapRunFormatting(body,
|
|
92395
|
+
function wrapRunFormatting(body, run38, baseline) {
|
|
92219
92396
|
const styles = [];
|
|
92220
92397
|
const attrs = [];
|
|
92221
|
-
if (
|
|
92222
|
-
styles.push(`color:#${
|
|
92223
|
-
if (
|
|
92224
|
-
styles.push(`background-color:#${
|
|
92225
|
-
if (
|
|
92226
|
-
styles.push(`font-family:${cssFontFamily(
|
|
92398
|
+
if (run38.color && !isDefaultColor(run38.color))
|
|
92399
|
+
styles.push(`color:#${run38.color}`);
|
|
92400
|
+
if (run38.shade)
|
|
92401
|
+
styles.push(`background-color:#${run38.shade}`);
|
|
92402
|
+
if (run38.font && run38.font !== baseline.font) {
|
|
92403
|
+
styles.push(`font-family:${cssFontFamily(run38.font)}`);
|
|
92227
92404
|
}
|
|
92228
|
-
if (
|
|
92229
|
-
styles.push(`font-size:${
|
|
92405
|
+
if (run38.sizeHalfPoints !== undefined && run38.sizeHalfPoints !== baseline.sizeHalfPoints) {
|
|
92406
|
+
styles.push(`font-size:${run38.sizeHalfPoints / 2}pt`);
|
|
92230
92407
|
}
|
|
92231
|
-
if (
|
|
92408
|
+
if (run38.smallCaps)
|
|
92232
92409
|
styles.push("font-variant:small-caps");
|
|
92233
|
-
if (
|
|
92410
|
+
if (run38.allCaps)
|
|
92234
92411
|
styles.push("text-transform:uppercase");
|
|
92235
|
-
if (
|
|
92236
|
-
attrs.push(htmlAttr("data-color-theme",
|
|
92237
|
-
if (
|
|
92238
|
-
attrs.push(htmlAttr("data-color-theme-tint",
|
|
92412
|
+
if (run38.colorTheme && !isDefaultThemeColor(run38)) {
|
|
92413
|
+
attrs.push(htmlAttr("data-color-theme", run38.colorTheme));
|
|
92414
|
+
if (run38.colorThemeTint) {
|
|
92415
|
+
attrs.push(htmlAttr("data-color-theme-tint", run38.colorThemeTint));
|
|
92239
92416
|
}
|
|
92240
|
-
if (
|
|
92241
|
-
attrs.push(htmlAttr("data-color-theme-shade",
|
|
92417
|
+
if (run38.colorThemeShade) {
|
|
92418
|
+
attrs.push(htmlAttr("data-color-theme-shade", run38.colorThemeShade));
|
|
92242
92419
|
}
|
|
92243
92420
|
}
|
|
92244
92421
|
let out = body;
|
|
@@ -92247,18 +92424,18 @@ function wrapRunFormatting(body, run37, baseline) {
|
|
|
92247
92424
|
const attrPart = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
92248
92425
|
out = `<span${stylePart}${attrPart}>${out}</span>`;
|
|
92249
92426
|
}
|
|
92250
|
-
if (
|
|
92427
|
+
if (run38.underline === "single") {
|
|
92251
92428
|
out = `<u>${out}</u>`;
|
|
92252
|
-
} else if (
|
|
92253
|
-
const color2 =
|
|
92254
|
-
out = `<u ${htmlAttr("data-underline",
|
|
92429
|
+
} else if (run38.underline) {
|
|
92430
|
+
const color2 = run38.underlineColor ? ` ${htmlAttr("data-underline-color", run38.underlineColor)}` : "";
|
|
92431
|
+
out = `<u ${htmlAttr("data-underline", run38.underline)}${color2}>${out}</u>`;
|
|
92255
92432
|
}
|
|
92256
|
-
if (
|
|
92433
|
+
if (run38.vertAlign === "superscript")
|
|
92257
92434
|
out = `<sup>${out}</sup>`;
|
|
92258
|
-
else if (
|
|
92435
|
+
else if (run38.vertAlign === "subscript")
|
|
92259
92436
|
out = `<sub>${out}</sub>`;
|
|
92260
|
-
if (
|
|
92261
|
-
const named =
|
|
92437
|
+
if (run38.highlight) {
|
|
92438
|
+
const named = run38.highlight === "yellow" ? "" : ` ${htmlAttr("data-highlight", run38.highlight)}`;
|
|
92262
92439
|
out = `<mark${named}>${out}</mark>`;
|
|
92263
92440
|
}
|
|
92264
92441
|
return out;
|
|
@@ -92267,8 +92444,8 @@ function isDefaultColor(color2) {
|
|
|
92267
92444
|
const normalized = color2.toLowerCase();
|
|
92268
92445
|
return normalized === "000000" || normalized === "auto";
|
|
92269
92446
|
}
|
|
92270
|
-
function isDefaultThemeColor(
|
|
92271
|
-
return (
|
|
92447
|
+
function isDefaultThemeColor(run38) {
|
|
92448
|
+
return (run38.colorTheme === "text1" || run38.colorTheme === "dark1") && !run38.colorThemeTint && !run38.colorThemeShade;
|
|
92272
92449
|
}
|
|
92273
92450
|
function cssFontFamily(font) {
|
|
92274
92451
|
return /\s/.test(font) ? `'${font}'` : font;
|
|
@@ -92285,19 +92462,19 @@ function applyEscapeMask(text6, mask, offset2) {
|
|
|
92285
92462
|
}
|
|
92286
92463
|
function paragraphContent(runs, view) {
|
|
92287
92464
|
let content3 = "";
|
|
92288
|
-
for (const
|
|
92289
|
-
if (
|
|
92465
|
+
for (const run38 of runs) {
|
|
92466
|
+
if (run38.type !== "text")
|
|
92290
92467
|
continue;
|
|
92291
|
-
if (
|
|
92468
|
+
if (run38.runStyle === "Code")
|
|
92292
92469
|
continue;
|
|
92293
|
-
if (!isRunVisible(
|
|
92470
|
+
if (!isRunVisible(run38, view))
|
|
92294
92471
|
continue;
|
|
92295
|
-
content3 +=
|
|
92472
|
+
content3 += run38.text;
|
|
92296
92473
|
}
|
|
92297
92474
|
return content3;
|
|
92298
92475
|
}
|
|
92299
92476
|
function hasEquationRun(runs) {
|
|
92300
|
-
return runs.some((
|
|
92477
|
+
return runs.some((run38) => run38.type === "equation");
|
|
92301
92478
|
}
|
|
92302
92479
|
function renderTable(table, ctx) {
|
|
92303
92480
|
const view = ctx.options.view ?? "accepted";
|
|
@@ -92613,9 +92790,9 @@ var init_markdown3 = __esm(() => {
|
|
|
92613
92790
|
// src/cli/read/index.ts
|
|
92614
92791
|
var exports_read = {};
|
|
92615
92792
|
__export(exports_read, {
|
|
92616
|
-
run: () =>
|
|
92793
|
+
run: () => run38
|
|
92617
92794
|
});
|
|
92618
|
-
async function
|
|
92795
|
+
async function run38(args) {
|
|
92619
92796
|
const parsed = await tryParseArgs(args, {
|
|
92620
92797
|
ast: { type: "boolean" },
|
|
92621
92798
|
from: { type: "string" },
|
|
@@ -92625,16 +92802,16 @@ async function run37(args) {
|
|
|
92625
92802
|
current: { type: "boolean" },
|
|
92626
92803
|
comments: { type: "boolean" },
|
|
92627
92804
|
help: { type: "boolean", short: "h" }
|
|
92628
|
-
},
|
|
92805
|
+
}, HELP34);
|
|
92629
92806
|
if (typeof parsed === "number")
|
|
92630
92807
|
return parsed;
|
|
92631
92808
|
if (parsed.values.help) {
|
|
92632
|
-
await writeStdout(
|
|
92809
|
+
await writeStdout(HELP34);
|
|
92633
92810
|
return EXIT2.OK;
|
|
92634
92811
|
}
|
|
92635
92812
|
const path2 = parsed.positionals[0];
|
|
92636
92813
|
if (!path2)
|
|
92637
|
-
return fail("USAGE", "Missing FILE argument",
|
|
92814
|
+
return fail("USAGE", "Missing FILE argument", HELP34);
|
|
92638
92815
|
const ast = Boolean(parsed.values.ast);
|
|
92639
92816
|
const from = parsed.values.from;
|
|
92640
92817
|
const to = parsed.values.to;
|
|
@@ -92643,11 +92820,11 @@ async function run37(args) {
|
|
|
92643
92820
|
const current = Boolean(parsed.values.current);
|
|
92644
92821
|
const showComments = Boolean(parsed.values.comments);
|
|
92645
92822
|
if (ast && (from || to || accepted || baseline || current || showComments)) {
|
|
92646
|
-
return fail("USAGE", "--from, --to, --accepted, --baseline, --current, and --comments are Markdown-only and cannot be combined with --ast",
|
|
92823
|
+
return fail("USAGE", "--from, --to, --accepted, --baseline, --current, and --comments are Markdown-only and cannot be combined with --ast", HELP34);
|
|
92647
92824
|
}
|
|
92648
92825
|
const view = resolveView({ accepted, baseline, current });
|
|
92649
92826
|
if (!view) {
|
|
92650
|
-
return fail("USAGE", "--accepted, --baseline, and --current are mutually exclusive",
|
|
92827
|
+
return fail("USAGE", "--accepted, --baseline, and --current are mutually exclusive", HELP34);
|
|
92651
92828
|
}
|
|
92652
92829
|
const docView = await openOrFail(path2);
|
|
92653
92830
|
if (typeof docView === "number")
|
|
@@ -92658,7 +92835,7 @@ async function run37(args) {
|
|
|
92658
92835
|
return EXIT2.OK;
|
|
92659
92836
|
}
|
|
92660
92837
|
try {
|
|
92661
|
-
const rendered =
|
|
92838
|
+
const rendered = renderMarkdown2(docView.body, {
|
|
92662
92839
|
from,
|
|
92663
92840
|
to,
|
|
92664
92841
|
view,
|
|
@@ -92676,7 +92853,7 @@ async function run37(args) {
|
|
|
92676
92853
|
throw err;
|
|
92677
92854
|
}
|
|
92678
92855
|
}
|
|
92679
|
-
var
|
|
92856
|
+
var HELP34 = `docx read \u2014 render document body as Markdown, or print AST as JSON
|
|
92680
92857
|
|
|
92681
92858
|
Usage:
|
|
92682
92859
|
docx read FILE [options]
|
|
@@ -92766,20 +92943,20 @@ function parsePagesSpec(spec) {
|
|
|
92766
92943
|
// src/cli/render/index.ts
|
|
92767
92944
|
var exports_render = {};
|
|
92768
92945
|
__export(exports_render, {
|
|
92769
|
-
run: () =>
|
|
92946
|
+
run: () => run39
|
|
92770
92947
|
});
|
|
92771
92948
|
import { basename as basename2, extname as extname2, resolve as resolve2 } from "path";
|
|
92772
|
-
async function
|
|
92773
|
-
const parsed = await tryParseArgs(args, OPTION_SPEC6,
|
|
92949
|
+
async function run39(args) {
|
|
92950
|
+
const parsed = await tryParseArgs(args, OPTION_SPEC6, HELP35);
|
|
92774
92951
|
if (typeof parsed === "number")
|
|
92775
92952
|
return parsed;
|
|
92776
92953
|
if (parsed.values.help) {
|
|
92777
|
-
await writeStdout(
|
|
92954
|
+
await writeStdout(HELP35);
|
|
92778
92955
|
return EXIT2.OK;
|
|
92779
92956
|
}
|
|
92780
92957
|
const filePath = parsed.positionals[0];
|
|
92781
92958
|
if (!filePath)
|
|
92782
|
-
return fail("USAGE", "Missing FILE argument",
|
|
92959
|
+
return fail("USAGE", "Missing FILE argument", HELP35);
|
|
92783
92960
|
if (!await Bun.file(filePath).exists()) {
|
|
92784
92961
|
return fail("FILE_NOT_FOUND", `File not found: ${filePath}`);
|
|
92785
92962
|
}
|
|
@@ -92859,7 +93036,7 @@ function availabilityHint(installed) {
|
|
|
92859
93036
|
}
|
|
92860
93037
|
return `Detected engines: ${installed.join(", ")} \u2014 but none chose auto-select; pass --engine explicitly.`;
|
|
92861
93038
|
}
|
|
92862
|
-
var
|
|
93039
|
+
var HELP35 = `docx render \u2014 render each page of a .docx as a PNG/JPG image
|
|
92863
93040
|
|
|
92864
93041
|
Usage:
|
|
92865
93042
|
docx render FILE [options]
|
|
@@ -93148,9 +93325,9 @@ var init_batch4 = __esm(() => {
|
|
|
93148
93325
|
// src/cli/replace/index.ts
|
|
93149
93326
|
var exports_replace3 = {};
|
|
93150
93327
|
__export(exports_replace3, {
|
|
93151
|
-
run: () =>
|
|
93328
|
+
run: () => run40
|
|
93152
93329
|
});
|
|
93153
|
-
async function
|
|
93330
|
+
async function run40(args) {
|
|
93154
93331
|
const parsed = await tryParseArgs(args, {
|
|
93155
93332
|
batch: { type: "string" },
|
|
93156
93333
|
at: { type: "string" },
|
|
@@ -93164,33 +93341,33 @@ async function run39(args) {
|
|
|
93164
93341
|
baseline: { type: "boolean" },
|
|
93165
93342
|
exact: { type: "boolean" },
|
|
93166
93343
|
...SAVE_FLAGS
|
|
93167
|
-
},
|
|
93344
|
+
}, HELP36);
|
|
93168
93345
|
if (typeof parsed === "number")
|
|
93169
93346
|
return parsed;
|
|
93170
93347
|
if (parsed.values.help) {
|
|
93171
|
-
await writeStdout(
|
|
93348
|
+
await writeStdout(HELP36);
|
|
93172
93349
|
return EXIT2.OK;
|
|
93173
93350
|
}
|
|
93174
93351
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
93175
93352
|
const path2 = parsed.positionals[0];
|
|
93176
93353
|
if (!path2)
|
|
93177
|
-
return fail("USAGE", "Missing FILE argument",
|
|
93354
|
+
return fail("USAGE", "Missing FILE argument", HELP36);
|
|
93178
93355
|
const batchInput = parsed.values.batch;
|
|
93179
93356
|
if (batchInput !== undefined) {
|
|
93180
93357
|
if (parsed.positionals.length > 1) {
|
|
93181
|
-
return fail("USAGE", "--batch reads pattern/replacement from the JSONL file; don't also pass them as positionals",
|
|
93358
|
+
return fail("USAGE", "--batch reads pattern/replacement from the JSONL file; don't also pass them as positionals", HELP36);
|
|
93182
93359
|
}
|
|
93183
93360
|
if (parsed.values.at !== undefined) {
|
|
93184
|
-
return fail("USAGE", '--at is per-entry in batch mode: put "at" on each JSONL line, not on the command',
|
|
93361
|
+
return fail("USAGE", '--at is per-entry in batch mode: put "at" on each JSONL line, not on the command', HELP36);
|
|
93185
93362
|
}
|
|
93186
93363
|
return runReplaceBatch(path2, batchInput, parsed.values);
|
|
93187
93364
|
}
|
|
93188
93365
|
const pattern = parsed.positionals[1];
|
|
93189
93366
|
const replacement = parsed.positionals[2];
|
|
93190
93367
|
if (pattern == null)
|
|
93191
|
-
return fail("USAGE", "Missing PATTERN argument",
|
|
93368
|
+
return fail("USAGE", "Missing PATTERN argument", HELP36);
|
|
93192
93369
|
if (replacement == null) {
|
|
93193
|
-
return fail("USAGE", "Missing REPLACEMENT argument",
|
|
93370
|
+
return fail("USAGE", "Missing REPLACEMENT argument", HELP36);
|
|
93194
93371
|
}
|
|
93195
93372
|
const ignoreCase = Boolean(parsed.values["ignore-case"]);
|
|
93196
93373
|
const useRegex = Boolean(parsed.values.regex);
|
|
@@ -93327,7 +93504,7 @@ async function run39(args) {
|
|
|
93327
93504
|
}, partialHint);
|
|
93328
93505
|
return EXIT2.OK;
|
|
93329
93506
|
}
|
|
93330
|
-
var
|
|
93507
|
+
var HELP36 = `docx replace \u2014 substitute text spans (sed for docx)
|
|
93331
93508
|
|
|
93332
93509
|
Usage:
|
|
93333
93510
|
docx replace FILE PATTERN REPLACEMENT [options]
|
|
@@ -93421,23 +93598,23 @@ var init_replace4 = __esm(() => {
|
|
|
93421
93598
|
// src/cli/sections/index.tsx
|
|
93422
93599
|
var exports_sections = {};
|
|
93423
93600
|
__export(exports_sections, {
|
|
93424
|
-
run: () =>
|
|
93601
|
+
run: () => run41
|
|
93425
93602
|
});
|
|
93426
93603
|
function hasPageGeometry(flags) {
|
|
93427
93604
|
return flags.pageSize !== undefined || flags.orientation !== undefined || flags.margins !== undefined;
|
|
93428
93605
|
}
|
|
93429
|
-
async function
|
|
93430
|
-
const parsed = await tryParseArgs(args, OPTION_SPEC7,
|
|
93606
|
+
async function run41(args) {
|
|
93607
|
+
const parsed = await tryParseArgs(args, OPTION_SPEC7, HELP37);
|
|
93431
93608
|
if (typeof parsed === "number")
|
|
93432
93609
|
return parsed;
|
|
93433
93610
|
if (parsed.values.help) {
|
|
93434
|
-
await writeStdout(
|
|
93611
|
+
await writeStdout(HELP37);
|
|
93435
93612
|
return EXIT2.OK;
|
|
93436
93613
|
}
|
|
93437
93614
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
93438
93615
|
const filePath = parsed.positionals[0];
|
|
93439
93616
|
if (!filePath)
|
|
93440
|
-
return fail("USAGE", "Missing FILE argument",
|
|
93617
|
+
return fail("USAGE", "Missing FILE argument", HELP37);
|
|
93441
93618
|
const at = parsed.values.at;
|
|
93442
93619
|
const flags = await parseSectionFlags(parsed.values);
|
|
93443
93620
|
if (typeof flags === "number")
|
|
@@ -93457,22 +93634,22 @@ async function run40(args) {
|
|
|
93457
93634
|
if (hasPageGeometry(flags) && flags.columns === undefined && flags.sectionType === undefined) {
|
|
93458
93635
|
return editAllSections(document4, opts);
|
|
93459
93636
|
}
|
|
93460
|
-
return fail("USAGE", "Missing --at LOCATOR (a section sN, or a range pN-pM to wrap in columns). To set PAGE GEOMETRY for the whole document, omit --at and pass only --margins/--orientation/--size.",
|
|
93637
|
+
return fail("USAGE", "Missing --at LOCATOR (a section sN, or a range pN-pM to wrap in columns). To set PAGE GEOMETRY for the whole document, omit --at and pass only --margins/--orientation/--size.", HELP37);
|
|
93461
93638
|
}
|
|
93462
93639
|
let locator;
|
|
93463
93640
|
try {
|
|
93464
93641
|
locator = parseLocator(at);
|
|
93465
93642
|
} catch (error) {
|
|
93466
93643
|
if (error instanceof LocatorParseError) {
|
|
93467
|
-
return fail("INVALID_LOCATOR", error.message,
|
|
93644
|
+
return fail("INVALID_LOCATOR", error.message, HELP37);
|
|
93468
93645
|
}
|
|
93469
93646
|
throw error;
|
|
93470
93647
|
}
|
|
93471
93648
|
if (locator.kind === "blockRange") {
|
|
93472
93649
|
if (hasPageGeometry(flags))
|
|
93473
|
-
return fail("USAGE", WRAP_REJECTS_GEOMETRY,
|
|
93650
|
+
return fail("USAGE", WRAP_REJECTS_GEOMETRY, HELP37);
|
|
93474
93651
|
if (flags.columns === undefined) {
|
|
93475
|
-
return fail("USAGE", "Wrapping a range in a section needs --columns N",
|
|
93652
|
+
return fail("USAGE", "Wrapping a range in a section needs --columns N", HELP37);
|
|
93476
93653
|
}
|
|
93477
93654
|
const range = await resolveBlockRangeOrFail(document4, at);
|
|
93478
93655
|
if (typeof range === "number")
|
|
@@ -93484,20 +93661,20 @@ async function run40(args) {
|
|
|
93484
93661
|
return blockRef;
|
|
93485
93662
|
if (blockRef.node.tag === "w:sectPr") {
|
|
93486
93663
|
if (flags.columns === undefined && flags.sectionType === undefined && !hasPageGeometry(flags)) {
|
|
93487
|
-
return fail("USAGE", "Section edit needs --columns, --type, --orientation, --size, or --margins",
|
|
93664
|
+
return fail("USAGE", "Section edit needs --columns, --type, --orientation, --size, or --margins", HELP37);
|
|
93488
93665
|
}
|
|
93489
93666
|
return editSection(document4, blockRef, at, opts);
|
|
93490
93667
|
}
|
|
93491
93668
|
if (blockRef.node.tag === "w:p") {
|
|
93492
93669
|
if (hasPageGeometry(flags))
|
|
93493
|
-
return fail("USAGE", WRAP_REJECTS_GEOMETRY,
|
|
93670
|
+
return fail("USAGE", WRAP_REJECTS_GEOMETRY, HELP37);
|
|
93494
93671
|
if (flags.columns === undefined) {
|
|
93495
|
-
return fail("USAGE", "Wrapping a paragraph in a section needs --columns N",
|
|
93672
|
+
return fail("USAGE", "Wrapping a paragraph in a section needs --columns N", HELP37);
|
|
93496
93673
|
}
|
|
93497
93674
|
const index2 = blockRef.parent.indexOf(blockRef.node);
|
|
93498
93675
|
return wrapRange(document4, blockRef.parent, index2, index2, at, opts);
|
|
93499
93676
|
}
|
|
93500
|
-
return fail("INVALID_LOCATOR", `--at needs a section (sN) or a paragraph range (pN-pM); ${at} is neither`,
|
|
93677
|
+
return fail("INVALID_LOCATOR", `--at needs a section (sN) or a paragraph range (pN-pM); ${at} is neither`, HELP37);
|
|
93501
93678
|
}
|
|
93502
93679
|
async function editSection(document4, blockRef, at, opts) {
|
|
93503
93680
|
const track = resolveTracked(document4, opts.trackFlag);
|
|
@@ -93750,7 +93927,7 @@ async function commit(document4, opts, meta) {
|
|
|
93750
93927
|
}, realignedNote + renderVerifyHint(destination));
|
|
93751
93928
|
return EXIT2.OK;
|
|
93752
93929
|
}
|
|
93753
|
-
var
|
|
93930
|
+
var HELP37 = `docx sections \u2014 multi-column layout, section breaks & page setup
|
|
93754
93931
|
|
|
93755
93932
|
Usage:
|
|
93756
93933
|
docx sections FILE --at LOCATOR (--columns N | page setup) [options]
|
|
@@ -94243,9 +94420,9 @@ function appliedStyleIds(document4) {
|
|
|
94243
94420
|
continue;
|
|
94244
94421
|
if (block.style)
|
|
94245
94422
|
used.add(block.style);
|
|
94246
|
-
for (const
|
|
94247
|
-
if (
|
|
94248
|
-
used.add(
|
|
94423
|
+
for (const run42 of block.runs) {
|
|
94424
|
+
if (run42.type === "text" && run42.runStyle)
|
|
94425
|
+
used.add(run42.runStyle);
|
|
94249
94426
|
}
|
|
94250
94427
|
}
|
|
94251
94428
|
return used;
|
|
@@ -94401,8 +94578,8 @@ function countStyleUsage(document4, styleId) {
|
|
|
94401
94578
|
continue;
|
|
94402
94579
|
if (block.style === styleId)
|
|
94403
94580
|
count++;
|
|
94404
|
-
for (const
|
|
94405
|
-
if (
|
|
94581
|
+
for (const run42 of block.runs) {
|
|
94582
|
+
if (run42.type === "text" && run42.runStyle === styleId)
|
|
94406
94583
|
count++;
|
|
94407
94584
|
}
|
|
94408
94585
|
}
|
|
@@ -94568,18 +94745,18 @@ var init_set_default_font = __esm(() => {
|
|
|
94568
94745
|
// src/cli/styles/index.ts
|
|
94569
94746
|
var exports_styles = {};
|
|
94570
94747
|
__export(exports_styles, {
|
|
94571
|
-
run: () =>
|
|
94748
|
+
run: () => run42
|
|
94572
94749
|
});
|
|
94573
|
-
async function
|
|
94750
|
+
async function run42(args) {
|
|
94574
94751
|
if (args[0] === "set-default-font")
|
|
94575
94752
|
return runSetDefaultFont(args.slice(1));
|
|
94576
94753
|
if (args[0] === "set")
|
|
94577
94754
|
return runStylesSet(args.slice(1));
|
|
94578
94755
|
if (args[0] === "create")
|
|
94579
94756
|
return runStylesCreate(args.slice(1));
|
|
94580
|
-
return runStylesRead(args,
|
|
94757
|
+
return runStylesRead(args, HELP38);
|
|
94581
94758
|
}
|
|
94582
|
-
var
|
|
94759
|
+
var HELP38 = `docx styles \u2014 inspect, edit, and create the styles a document can apply
|
|
94583
94760
|
|
|
94584
94761
|
Usage:
|
|
94585
94762
|
docx styles FILE [--used] [--at STYLEID] [--json] # list / describe (read)
|
|
@@ -94629,9 +94806,9 @@ var init_styles2 = __esm(() => {
|
|
|
94629
94806
|
// src/cli/tables/insert-row.tsx
|
|
94630
94807
|
var exports_insert_row = {};
|
|
94631
94808
|
__export(exports_insert_row, {
|
|
94632
|
-
run: () =>
|
|
94809
|
+
run: () => run43
|
|
94633
94810
|
});
|
|
94634
|
-
async function
|
|
94811
|
+
async function run43(args) {
|
|
94635
94812
|
const parsed = await tryParseArgs(args, {
|
|
94636
94813
|
at: { type: "string" },
|
|
94637
94814
|
position: { type: "string" },
|
|
@@ -94639,20 +94816,20 @@ async function run42(args) {
|
|
|
94639
94816
|
author: { type: "string" },
|
|
94640
94817
|
track: { type: "boolean" },
|
|
94641
94818
|
...SAVE_FLAGS
|
|
94642
|
-
},
|
|
94819
|
+
}, HELP39);
|
|
94643
94820
|
if (typeof parsed === "number")
|
|
94644
94821
|
return parsed;
|
|
94645
94822
|
if (parsed.values.help) {
|
|
94646
|
-
await writeStdout(
|
|
94823
|
+
await writeStdout(HELP39);
|
|
94647
94824
|
return EXIT2.OK;
|
|
94648
94825
|
}
|
|
94649
94826
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
94650
94827
|
const path2 = parsed.positionals[0];
|
|
94651
94828
|
if (!path2)
|
|
94652
|
-
return fail("USAGE", "Missing FILE argument",
|
|
94829
|
+
return fail("USAGE", "Missing FILE argument", HELP39);
|
|
94653
94830
|
const at = parsed.values.at;
|
|
94654
94831
|
if (!at)
|
|
94655
|
-
return fail("USAGE", "Missing --at tN",
|
|
94832
|
+
return fail("USAGE", "Missing --at tN", HELP39);
|
|
94656
94833
|
const tableId = parseTableAt(at);
|
|
94657
94834
|
if (!tableId) {
|
|
94658
94835
|
return fail("INVALID_LOCATOR", `--at must be a table id like t0 (got ${at})`);
|
|
@@ -94673,7 +94850,7 @@ async function run42(args) {
|
|
|
94673
94850
|
}
|
|
94674
94851
|
const cellTexts = parsed.values.cells ? parsed.values.cells.split(",") : [];
|
|
94675
94852
|
for (const cell of cellTexts) {
|
|
94676
|
-
const mangled = await rejectShellMangledValue(cell,
|
|
94853
|
+
const mangled = await rejectShellMangledValue(cell, HELP39, "--cells");
|
|
94677
94854
|
if (typeof mangled === "number")
|
|
94678
94855
|
return mangled;
|
|
94679
94856
|
}
|
|
@@ -94774,7 +94951,7 @@ function rowChildIndex(table, grid, position2) {
|
|
|
94774
94951
|
const lastRow = grid.rows[grid.rows.length - 1]?.node;
|
|
94775
94952
|
return lastRow ? table.children.indexOf(lastRow) + 1 : table.children.length;
|
|
94776
94953
|
}
|
|
94777
|
-
var AT_FORMS6,
|
|
94954
|
+
var AT_FORMS6, HELP39;
|
|
94778
94955
|
var init_insert_row = __esm(() => {
|
|
94779
94956
|
init_core2();
|
|
94780
94957
|
init_blocks();
|
|
@@ -94785,7 +94962,7 @@ var init_insert_row = __esm(() => {
|
|
|
94785
94962
|
init_respond();
|
|
94786
94963
|
init_jsx_dev_runtime();
|
|
94787
94964
|
AT_FORMS6 = describeForms(["table"], " ");
|
|
94788
|
-
|
|
94965
|
+
HELP39 = `docx tables insert-row \u2014 insert a table row
|
|
94789
94966
|
|
|
94790
94967
|
Usage:
|
|
94791
94968
|
docx tables insert-row FILE --at tN [options]
|
|
@@ -94834,28 +95011,28 @@ Examples:
|
|
|
94834
95011
|
// src/cli/tables/delete-row.ts
|
|
94835
95012
|
var exports_delete_row = {};
|
|
94836
95013
|
__export(exports_delete_row, {
|
|
94837
|
-
run: () =>
|
|
95014
|
+
run: () => run44
|
|
94838
95015
|
});
|
|
94839
|
-
async function
|
|
95016
|
+
async function run44(args) {
|
|
94840
95017
|
const parsed = await tryParseArgs(args, {
|
|
94841
95018
|
at: { type: "string" },
|
|
94842
95019
|
author: { type: "string" },
|
|
94843
95020
|
track: { type: "boolean" },
|
|
94844
95021
|
...SAVE_FLAGS
|
|
94845
|
-
},
|
|
95022
|
+
}, HELP40);
|
|
94846
95023
|
if (typeof parsed === "number")
|
|
94847
95024
|
return parsed;
|
|
94848
95025
|
if (parsed.values.help) {
|
|
94849
|
-
await writeStdout(
|
|
95026
|
+
await writeStdout(HELP40);
|
|
94850
95027
|
return EXIT2.OK;
|
|
94851
95028
|
}
|
|
94852
95029
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
94853
95030
|
const path2 = parsed.positionals[0];
|
|
94854
95031
|
if (!path2)
|
|
94855
|
-
return fail("USAGE", "Missing FILE argument",
|
|
95032
|
+
return fail("USAGE", "Missing FILE argument", HELP40);
|
|
94856
95033
|
const at = parsed.values.at;
|
|
94857
95034
|
if (!at)
|
|
94858
|
-
return fail("USAGE", "Missing --at tN:rR",
|
|
95035
|
+
return fail("USAGE", "Missing --at tN:rR", HELP40);
|
|
94859
95036
|
const target = parseRowAt(at);
|
|
94860
95037
|
if (!target) {
|
|
94861
95038
|
return fail("INVALID_LOCATOR", `--at must be a row locator like t0:r1 (got ${at})`);
|
|
@@ -94922,14 +95099,14 @@ function findVMergeOrphan(grid, rowIndex) {
|
|
|
94922
95099
|
}
|
|
94923
95100
|
return null;
|
|
94924
95101
|
}
|
|
94925
|
-
var AT_FORMS7,
|
|
95102
|
+
var AT_FORMS7, HELP40;
|
|
94926
95103
|
var init_delete_row = __esm(() => {
|
|
94927
95104
|
init_core2();
|
|
94928
95105
|
init_locators();
|
|
94929
95106
|
init_table();
|
|
94930
95107
|
init_respond();
|
|
94931
95108
|
AT_FORMS7 = describeForms(["tableRow"], " ");
|
|
94932
|
-
|
|
95109
|
+
HELP40 = `docx tables delete-row \u2014 delete a table row
|
|
94933
95110
|
|
|
94934
95111
|
Usage:
|
|
94935
95112
|
docx tables delete-row FILE --at tN:rR [options]
|
|
@@ -94965,9 +95142,9 @@ Examples:
|
|
|
94965
95142
|
// src/cli/tables/insert-column.tsx
|
|
94966
95143
|
var exports_insert_column = {};
|
|
94967
95144
|
__export(exports_insert_column, {
|
|
94968
|
-
run: () =>
|
|
95145
|
+
run: () => run45
|
|
94969
95146
|
});
|
|
94970
|
-
async function
|
|
95147
|
+
async function run45(args) {
|
|
94971
95148
|
const parsed = await tryParseArgs(args, {
|
|
94972
95149
|
at: { type: "string" },
|
|
94973
95150
|
position: { type: "string" },
|
|
@@ -94975,20 +95152,20 @@ async function run44(args) {
|
|
|
94975
95152
|
author: { type: "string" },
|
|
94976
95153
|
track: { type: "boolean" },
|
|
94977
95154
|
...SAVE_FLAGS
|
|
94978
|
-
},
|
|
95155
|
+
}, HELP41);
|
|
94979
95156
|
if (typeof parsed === "number")
|
|
94980
95157
|
return parsed;
|
|
94981
95158
|
if (parsed.values.help) {
|
|
94982
|
-
await writeStdout(
|
|
95159
|
+
await writeStdout(HELP41);
|
|
94983
95160
|
return EXIT2.OK;
|
|
94984
95161
|
}
|
|
94985
95162
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
94986
95163
|
const path2 = parsed.positionals[0];
|
|
94987
95164
|
if (!path2)
|
|
94988
|
-
return fail("USAGE", "Missing FILE argument",
|
|
95165
|
+
return fail("USAGE", "Missing FILE argument", HELP41);
|
|
94989
95166
|
const at = parsed.values.at;
|
|
94990
95167
|
if (!at)
|
|
94991
|
-
return fail("USAGE", "Missing --at tN",
|
|
95168
|
+
return fail("USAGE", "Missing --at tN", HELP41);
|
|
94992
95169
|
const tableId = parseTableAt(at);
|
|
94993
95170
|
if (!tableId) {
|
|
94994
95171
|
return fail("INVALID_LOCATOR", `--at must be a table id like t0 (got ${at})`);
|
|
@@ -95103,14 +95280,14 @@ function insertCellAtColumn(row, position2, cell) {
|
|
|
95103
95280
|
const at = lastCell ? row.node.children.indexOf(lastCell.node) + 1 : row.node.children.length;
|
|
95104
95281
|
row.node.children.splice(at, 0, cell);
|
|
95105
95282
|
}
|
|
95106
|
-
var AT_FORMS8,
|
|
95283
|
+
var AT_FORMS8, HELP41;
|
|
95107
95284
|
var init_insert_column = __esm(() => {
|
|
95108
95285
|
init_core2();
|
|
95109
95286
|
init_locators();
|
|
95110
95287
|
init_table();
|
|
95111
95288
|
init_respond();
|
|
95112
95289
|
AT_FORMS8 = describeForms(["table"], " ");
|
|
95113
|
-
|
|
95290
|
+
HELP41 = `docx tables insert-column \u2014 insert a table column
|
|
95114
95291
|
|
|
95115
95292
|
Usage:
|
|
95116
95293
|
docx tables insert-column FILE --at tN [options]
|
|
@@ -95148,28 +95325,28 @@ Examples:
|
|
|
95148
95325
|
// src/cli/tables/delete-column.ts
|
|
95149
95326
|
var exports_delete_column = {};
|
|
95150
95327
|
__export(exports_delete_column, {
|
|
95151
|
-
run: () =>
|
|
95328
|
+
run: () => run46
|
|
95152
95329
|
});
|
|
95153
|
-
async function
|
|
95330
|
+
async function run46(args) {
|
|
95154
95331
|
const parsed = await tryParseArgs(args, {
|
|
95155
95332
|
at: { type: "string" },
|
|
95156
95333
|
author: { type: "string" },
|
|
95157
95334
|
track: { type: "boolean" },
|
|
95158
95335
|
...SAVE_FLAGS
|
|
95159
|
-
},
|
|
95336
|
+
}, HELP42);
|
|
95160
95337
|
if (typeof parsed === "number")
|
|
95161
95338
|
return parsed;
|
|
95162
95339
|
if (parsed.values.help) {
|
|
95163
|
-
await writeStdout(
|
|
95340
|
+
await writeStdout(HELP42);
|
|
95164
95341
|
return EXIT2.OK;
|
|
95165
95342
|
}
|
|
95166
95343
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
95167
95344
|
const path2 = parsed.positionals[0];
|
|
95168
95345
|
if (!path2)
|
|
95169
|
-
return fail("USAGE", "Missing FILE argument",
|
|
95346
|
+
return fail("USAGE", "Missing FILE argument", HELP42);
|
|
95170
95347
|
const at = parsed.values.at;
|
|
95171
95348
|
if (!at)
|
|
95172
|
-
return fail("USAGE", "Missing --at tN:cC",
|
|
95349
|
+
return fail("USAGE", "Missing --at tN:cC", HELP42);
|
|
95173
95350
|
const target = parseColumnAt(at);
|
|
95174
95351
|
if (!target) {
|
|
95175
95352
|
return fail("INVALID_LOCATOR", `--at must be a column locator like t0:c2 (got ${at})`);
|
|
@@ -95253,14 +95430,14 @@ function removeGridColumn(tblGrid, col) {
|
|
|
95253
95430
|
if (index2 !== -1)
|
|
95254
95431
|
tblGrid.children.splice(index2, 1);
|
|
95255
95432
|
}
|
|
95256
|
-
var AT_FORMS9,
|
|
95433
|
+
var AT_FORMS9, HELP42;
|
|
95257
95434
|
var init_delete_column = __esm(() => {
|
|
95258
95435
|
init_core2();
|
|
95259
95436
|
init_locators();
|
|
95260
95437
|
init_table();
|
|
95261
95438
|
init_respond();
|
|
95262
95439
|
AT_FORMS9 = describeForms(["tableColumn"], " ");
|
|
95263
|
-
|
|
95440
|
+
HELP42 = `docx tables delete-column \u2014 delete a table column
|
|
95264
95441
|
|
|
95265
95442
|
Usage:
|
|
95266
95443
|
docx tables delete-column FILE --at tN:cC [options]
|
|
@@ -95295,36 +95472,36 @@ Examples:
|
|
|
95295
95472
|
// src/cli/tables/set-widths.ts
|
|
95296
95473
|
var exports_set_widths = {};
|
|
95297
95474
|
__export(exports_set_widths, {
|
|
95298
|
-
run: () =>
|
|
95475
|
+
run: () => run47
|
|
95299
95476
|
});
|
|
95300
|
-
async function
|
|
95477
|
+
async function run47(args) {
|
|
95301
95478
|
const parsed = await tryParseArgs(args, {
|
|
95302
95479
|
at: { type: "string" },
|
|
95303
95480
|
widths: { type: "string" },
|
|
95304
95481
|
author: { type: "string" },
|
|
95305
95482
|
track: { type: "boolean" },
|
|
95306
95483
|
...SAVE_FLAGS
|
|
95307
|
-
},
|
|
95484
|
+
}, HELP43);
|
|
95308
95485
|
if (typeof parsed === "number")
|
|
95309
95486
|
return parsed;
|
|
95310
95487
|
if (parsed.values.help) {
|
|
95311
|
-
await writeStdout(
|
|
95488
|
+
await writeStdout(HELP43);
|
|
95312
95489
|
return EXIT2.OK;
|
|
95313
95490
|
}
|
|
95314
95491
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
95315
95492
|
const path2 = parsed.positionals[0];
|
|
95316
95493
|
if (!path2)
|
|
95317
|
-
return fail("USAGE", "Missing FILE argument",
|
|
95494
|
+
return fail("USAGE", "Missing FILE argument", HELP43);
|
|
95318
95495
|
const at = parsed.values.at;
|
|
95319
95496
|
if (!at)
|
|
95320
|
-
return fail("USAGE", "Missing --at tN",
|
|
95497
|
+
return fail("USAGE", "Missing --at tN", HELP43);
|
|
95321
95498
|
const tableId = parseTableAt(at);
|
|
95322
95499
|
if (!tableId) {
|
|
95323
95500
|
return fail("INVALID_LOCATOR", `--at must be a table id like t0 (got ${at})`);
|
|
95324
95501
|
}
|
|
95325
95502
|
const widthsSpec = parsed.values.widths;
|
|
95326
95503
|
if (!widthsSpec)
|
|
95327
|
-
return fail("USAGE", "Missing --widths",
|
|
95504
|
+
return fail("USAGE", "Missing --widths", HELP43);
|
|
95328
95505
|
const document4 = await openOrFail(path2);
|
|
95329
95506
|
if (typeof document4 === "number")
|
|
95330
95507
|
return document4;
|
|
@@ -95473,14 +95650,14 @@ function describeColumnWidths(twips) {
|
|
|
95473
95650
|
const cells = twips.map((value, index2) => `g${index2}=${twipsToInches(value)}in`);
|
|
95474
95651
|
return `widths: ${cells.join(" ")}`;
|
|
95475
95652
|
}
|
|
95476
|
-
var AT_FORMS10,
|
|
95653
|
+
var AT_FORMS10, HELP43, MIN_COL_TWIPS = 288;
|
|
95477
95654
|
var init_set_widths = __esm(() => {
|
|
95478
95655
|
init_core2();
|
|
95479
95656
|
init_locators();
|
|
95480
95657
|
init_table();
|
|
95481
95658
|
init_respond();
|
|
95482
95659
|
AT_FORMS10 = describeForms(["table"], " ");
|
|
95483
|
-
|
|
95660
|
+
HELP43 = `docx tables set-widths \u2014 set column widths
|
|
95484
95661
|
|
|
95485
95662
|
Usage:
|
|
95486
95663
|
docx tables set-widths FILE --at tN --widths SPEC [options]
|
|
@@ -95549,28 +95726,28 @@ var init_common2 = __esm(() => {
|
|
|
95549
95726
|
// src/cli/tables/merge.tsx
|
|
95550
95727
|
var exports_merge = {};
|
|
95551
95728
|
__export(exports_merge, {
|
|
95552
|
-
run: () =>
|
|
95729
|
+
run: () => run48
|
|
95553
95730
|
});
|
|
95554
|
-
async function
|
|
95731
|
+
async function run48(args) {
|
|
95555
95732
|
const parsed = await tryParseArgs(args, {
|
|
95556
95733
|
at: { type: "string" },
|
|
95557
95734
|
author: { type: "string" },
|
|
95558
95735
|
track: { type: "boolean" },
|
|
95559
95736
|
...SAVE_FLAGS
|
|
95560
|
-
},
|
|
95737
|
+
}, HELP44);
|
|
95561
95738
|
if (typeof parsed === "number")
|
|
95562
95739
|
return parsed;
|
|
95563
95740
|
if (parsed.values.help) {
|
|
95564
|
-
await writeStdout(
|
|
95741
|
+
await writeStdout(HELP44);
|
|
95565
95742
|
return EXIT2.OK;
|
|
95566
95743
|
}
|
|
95567
95744
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
95568
95745
|
const path2 = parsed.positionals[0];
|
|
95569
95746
|
if (!path2)
|
|
95570
|
-
return fail("USAGE", "Missing FILE argument",
|
|
95747
|
+
return fail("USAGE", "Missing FILE argument", HELP44);
|
|
95571
95748
|
const at = parsed.values.at;
|
|
95572
95749
|
if (!at)
|
|
95573
|
-
return fail("USAGE", "Missing --at tN:rR1cC1-rR2cC2",
|
|
95750
|
+
return fail("USAGE", "Missing --at tN:rR1cC1-rR2cC2", HELP44);
|
|
95574
95751
|
const region = parseCellRangeAt(at);
|
|
95575
95752
|
if (!region) {
|
|
95576
95753
|
return fail("INVALID_LOCATOR", `--at must be a cell-range locator like t0:r0c0-r1c1 (got ${at})`);
|
|
@@ -95663,7 +95840,7 @@ function mergeRow(row, c1, c2, width, isTop, vertical) {
|
|
|
95663
95840
|
if (vertical && !isTop)
|
|
95664
95841
|
clearCellContent(anchor.node);
|
|
95665
95842
|
}
|
|
95666
|
-
var AT_FORMS11,
|
|
95843
|
+
var AT_FORMS11, HELP44;
|
|
95667
95844
|
var init_merge = __esm(() => {
|
|
95668
95845
|
init_core2();
|
|
95669
95846
|
init_locators();
|
|
@@ -95671,7 +95848,7 @@ var init_merge = __esm(() => {
|
|
|
95671
95848
|
init_respond();
|
|
95672
95849
|
init_common2();
|
|
95673
95850
|
AT_FORMS11 = describeForms(["cellRange"], " ");
|
|
95674
|
-
|
|
95851
|
+
HELP44 = `docx tables merge \u2014 merge a rectangular cell region
|
|
95675
95852
|
|
|
95676
95853
|
Usage:
|
|
95677
95854
|
docx tables merge FILE --at tN:rR1cC1-rR2cC2 [options]
|
|
@@ -95710,28 +95887,28 @@ Examples:
|
|
|
95710
95887
|
// src/cli/tables/unmerge.tsx
|
|
95711
95888
|
var exports_unmerge = {};
|
|
95712
95889
|
__export(exports_unmerge, {
|
|
95713
|
-
run: () =>
|
|
95890
|
+
run: () => run49
|
|
95714
95891
|
});
|
|
95715
|
-
async function
|
|
95892
|
+
async function run49(args) {
|
|
95716
95893
|
const parsed = await tryParseArgs(args, {
|
|
95717
95894
|
at: { type: "string" },
|
|
95718
95895
|
author: { type: "string" },
|
|
95719
95896
|
track: { type: "boolean" },
|
|
95720
95897
|
...SAVE_FLAGS
|
|
95721
|
-
},
|
|
95898
|
+
}, HELP45);
|
|
95722
95899
|
if (typeof parsed === "number")
|
|
95723
95900
|
return parsed;
|
|
95724
95901
|
if (parsed.values.help) {
|
|
95725
|
-
await writeStdout(
|
|
95902
|
+
await writeStdout(HELP45);
|
|
95726
95903
|
return EXIT2.OK;
|
|
95727
95904
|
}
|
|
95728
95905
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
95729
95906
|
const path2 = parsed.positionals[0];
|
|
95730
95907
|
if (!path2)
|
|
95731
|
-
return fail("USAGE", "Missing FILE argument",
|
|
95908
|
+
return fail("USAGE", "Missing FILE argument", HELP45);
|
|
95732
95909
|
const at = parsed.values.at;
|
|
95733
95910
|
if (!at)
|
|
95734
|
-
return fail("USAGE", "Missing --at tN:rRcC",
|
|
95911
|
+
return fail("USAGE", "Missing --at tN:rRcC", HELP45);
|
|
95735
95912
|
const target = parseCellAt(at);
|
|
95736
95913
|
if (!target) {
|
|
95737
95914
|
return fail("INVALID_LOCATOR", `--at must be a cell locator like t0:r0c0 (got ${at})`);
|
|
@@ -95806,7 +95983,7 @@ function verticalSpanRows(grid, row, col, vertical) {
|
|
|
95806
95983
|
}
|
|
95807
95984
|
return rows;
|
|
95808
95985
|
}
|
|
95809
|
-
var AT_FORMS12,
|
|
95986
|
+
var AT_FORMS12, HELP45;
|
|
95810
95987
|
var init_unmerge = __esm(() => {
|
|
95811
95988
|
init_core2();
|
|
95812
95989
|
init_locators();
|
|
@@ -95814,7 +95991,7 @@ var init_unmerge = __esm(() => {
|
|
|
95814
95991
|
init_respond();
|
|
95815
95992
|
init_common2();
|
|
95816
95993
|
AT_FORMS12 = describeForms(["cell"], " ");
|
|
95817
|
-
|
|
95994
|
+
HELP45 = `docx tables unmerge \u2014 split a merged cell back into individual cells
|
|
95818
95995
|
|
|
95819
95996
|
Usage:
|
|
95820
95997
|
docx tables unmerge FILE --at tN:rRcC [options]
|
|
@@ -95851,9 +96028,9 @@ Examples:
|
|
|
95851
96028
|
// src/cli/tables/borders.tsx
|
|
95852
96029
|
var exports_borders = {};
|
|
95853
96030
|
__export(exports_borders, {
|
|
95854
|
-
run: () =>
|
|
96031
|
+
run: () => run50
|
|
95855
96032
|
});
|
|
95856
|
-
async function
|
|
96033
|
+
async function run50(args) {
|
|
95857
96034
|
const parsed = await tryParseArgs(args, {
|
|
95858
96035
|
at: { type: "string" },
|
|
95859
96036
|
style: { type: "string" },
|
|
@@ -95862,20 +96039,20 @@ async function run49(args) {
|
|
|
95862
96039
|
author: { type: "string" },
|
|
95863
96040
|
track: { type: "boolean" },
|
|
95864
96041
|
...SAVE_FLAGS
|
|
95865
|
-
},
|
|
96042
|
+
}, HELP46);
|
|
95866
96043
|
if (typeof parsed === "number")
|
|
95867
96044
|
return parsed;
|
|
95868
96045
|
if (parsed.values.help) {
|
|
95869
|
-
await writeStdout(
|
|
96046
|
+
await writeStdout(HELP46);
|
|
95870
96047
|
return EXIT2.OK;
|
|
95871
96048
|
}
|
|
95872
96049
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
95873
96050
|
const path2 = parsed.positionals[0];
|
|
95874
96051
|
if (!path2)
|
|
95875
|
-
return fail("USAGE", "Missing FILE argument",
|
|
96052
|
+
return fail("USAGE", "Missing FILE argument", HELP46);
|
|
95876
96053
|
const at = parsed.values.at;
|
|
95877
96054
|
if (!at)
|
|
95878
|
-
return fail("USAGE", "Missing --at tN",
|
|
96055
|
+
return fail("USAGE", "Missing --at tN", HELP46);
|
|
95879
96056
|
const tableId = parseTableAt(at);
|
|
95880
96057
|
if (!tableId) {
|
|
95881
96058
|
return fail("INVALID_LOCATOR", `--at must be a table id like t0 (got ${at})`);
|
|
@@ -95952,7 +96129,7 @@ function buildBorders(style, sizeEighths, color2) {
|
|
|
95952
96129
|
]
|
|
95953
96130
|
}, undefined, true, undefined, this);
|
|
95954
96131
|
}
|
|
95955
|
-
var STYLES, AT_FORMS13,
|
|
96132
|
+
var STYLES, AT_FORMS13, HELP46;
|
|
95956
96133
|
var init_borders = __esm(() => {
|
|
95957
96134
|
init_core2();
|
|
95958
96135
|
init_jsx();
|
|
@@ -95963,7 +96140,7 @@ var init_borders = __esm(() => {
|
|
|
95963
96140
|
init_jsx_dev_runtime();
|
|
95964
96141
|
STYLES = new Set(["single", "double", "none"]);
|
|
95965
96142
|
AT_FORMS13 = describeForms(["table"], " ");
|
|
95966
|
-
|
|
96143
|
+
HELP46 = `docx tables borders \u2014 set table borders
|
|
95967
96144
|
|
|
95968
96145
|
Usage:
|
|
95969
96146
|
docx tables borders FILE --at tN [options]
|
|
@@ -96003,9 +96180,9 @@ Examples:
|
|
|
96003
96180
|
// src/cli/tables/format.tsx
|
|
96004
96181
|
var exports_format = {};
|
|
96005
96182
|
__export(exports_format, {
|
|
96006
|
-
run: () =>
|
|
96183
|
+
run: () => run51
|
|
96007
96184
|
});
|
|
96008
|
-
async function
|
|
96185
|
+
async function run51(args) {
|
|
96009
96186
|
const parsed = await tryParseArgs(args, {
|
|
96010
96187
|
at: { type: "string" },
|
|
96011
96188
|
shade: { type: "string" },
|
|
@@ -96024,20 +96201,20 @@ async function run50(args) {
|
|
|
96024
96201
|
author: { type: "string" },
|
|
96025
96202
|
track: { type: "boolean" },
|
|
96026
96203
|
...SAVE_FLAGS
|
|
96027
|
-
},
|
|
96204
|
+
}, HELP47);
|
|
96028
96205
|
if (typeof parsed === "number")
|
|
96029
96206
|
return parsed;
|
|
96030
96207
|
if (parsed.values.help) {
|
|
96031
|
-
await writeStdout(
|
|
96208
|
+
await writeStdout(HELP47);
|
|
96032
96209
|
return EXIT2.OK;
|
|
96033
96210
|
}
|
|
96034
96211
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
96035
96212
|
const path2 = parsed.positionals[0];
|
|
96036
96213
|
if (!path2)
|
|
96037
|
-
return fail("USAGE", "Missing FILE argument",
|
|
96214
|
+
return fail("USAGE", "Missing FILE argument", HELP47);
|
|
96038
96215
|
const at = parsed.values.at;
|
|
96039
96216
|
if (!at)
|
|
96040
|
-
return fail("USAGE", "Missing --at LOCATOR",
|
|
96217
|
+
return fail("USAGE", "Missing --at LOCATOR", HELP47);
|
|
96041
96218
|
const scope = resolveScope(at);
|
|
96042
96219
|
if (!scope) {
|
|
96043
96220
|
return fail("INVALID_LOCATOR", `--at must address a table, row, column, cell, or cell range (got ${at})`, "e.g. t0 (table), t0:r0 (row), t0:c1 (column), t0:r0c0 (cell), t0:r0c0-r1c2 (range).");
|
|
@@ -96376,7 +96553,7 @@ function parseMeasureToTwips(raw) {
|
|
|
96376
96553
|
const unit = match[2].toLowerCase();
|
|
96377
96554
|
return Math.round(unit === "pt" ? value * 20 : value * 1440);
|
|
96378
96555
|
}
|
|
96379
|
-
var
|
|
96556
|
+
var HELP47 = `docx tables format \u2014 shade, align, border, and size table cells/rows/tables
|
|
96380
96557
|
|
|
96381
96558
|
Usage:
|
|
96382
96559
|
docx tables format FILE --at LOCATOR [formatting options]
|
|
@@ -96464,12 +96641,12 @@ var init_format = __esm(() => {
|
|
|
96464
96641
|
// src/cli/tables/index.ts
|
|
96465
96642
|
var exports_tables = {};
|
|
96466
96643
|
__export(exports_tables, {
|
|
96467
|
-
run: () =>
|
|
96644
|
+
run: () => run52
|
|
96468
96645
|
});
|
|
96469
|
-
async function
|
|
96646
|
+
async function run52(args) {
|
|
96470
96647
|
const verb = args[0];
|
|
96471
96648
|
if (!verb || verb === "--help" || verb === "-h" || verb === "help") {
|
|
96472
|
-
await writeStdout(
|
|
96649
|
+
await writeStdout(HELP48);
|
|
96473
96650
|
return verb ? 0 : 2;
|
|
96474
96651
|
}
|
|
96475
96652
|
const loader = SUBCOMMANDS10[verb];
|
|
@@ -96479,7 +96656,7 @@ async function run51(args) {
|
|
|
96479
96656
|
const module_ = await loader();
|
|
96480
96657
|
return module_.run(args.slice(1));
|
|
96481
96658
|
}
|
|
96482
|
-
var SUBCOMMANDS10,
|
|
96659
|
+
var SUBCOMMANDS10, HELP48 = `docx tables \u2014 restructure & format tables (rows, columns, merges, widths, shading)
|
|
96483
96660
|
|
|
96484
96661
|
Usage:
|
|
96485
96662
|
docx tables <verb> FILE [options]
|
|
@@ -96583,19 +96760,19 @@ var init_groups = __esm(() => {
|
|
|
96583
96760
|
function collectTrackedChangeRecords(document4) {
|
|
96584
96761
|
const byId = new Map;
|
|
96585
96762
|
for (const paragraph2 of flattenParagraphs(document4.body.blocks)) {
|
|
96586
|
-
for (const
|
|
96587
|
-
if (
|
|
96763
|
+
for (const run53 of paragraph2.runs) {
|
|
96764
|
+
if (run53.type !== "text" || !run53.trackedChange)
|
|
96588
96765
|
continue;
|
|
96589
|
-
const change =
|
|
96766
|
+
const change = run53.trackedChange;
|
|
96590
96767
|
const existing = byId.get(change.id);
|
|
96591
96768
|
if (existing) {
|
|
96592
|
-
existing.text +=
|
|
96769
|
+
existing.text += run53.text;
|
|
96593
96770
|
continue;
|
|
96594
96771
|
}
|
|
96595
96772
|
byId.set(change.id, {
|
|
96596
96773
|
...change,
|
|
96597
96774
|
blockId: paragraph2.id,
|
|
96598
|
-
text:
|
|
96775
|
+
text: run53.text
|
|
96599
96776
|
});
|
|
96600
96777
|
}
|
|
96601
96778
|
}
|
|
@@ -96838,22 +97015,22 @@ var init_list_view = __esm(() => {
|
|
|
96838
97015
|
// src/cli/track-changes/list.ts
|
|
96839
97016
|
var exports_list5 = {};
|
|
96840
97017
|
__export(exports_list5, {
|
|
96841
|
-
run: () =>
|
|
97018
|
+
run: () => run53
|
|
96842
97019
|
});
|
|
96843
|
-
async function
|
|
97020
|
+
async function run53(args) {
|
|
96844
97021
|
const parsed = await tryParseArgs(args, {
|
|
96845
97022
|
help: { type: "boolean", short: "h" },
|
|
96846
97023
|
json: { type: "boolean" }
|
|
96847
|
-
},
|
|
97024
|
+
}, HELP49);
|
|
96848
97025
|
if (typeof parsed === "number")
|
|
96849
97026
|
return parsed;
|
|
96850
97027
|
if (parsed.values.help) {
|
|
96851
|
-
await writeStdout(
|
|
97028
|
+
await writeStdout(HELP49);
|
|
96852
97029
|
return EXIT2.OK;
|
|
96853
97030
|
}
|
|
96854
97031
|
const path2 = parsed.positionals[0];
|
|
96855
97032
|
if (!path2)
|
|
96856
|
-
return fail("USAGE", "Missing FILE argument",
|
|
97033
|
+
return fail("USAGE", "Missing FILE argument", HELP49);
|
|
96857
97034
|
const document4 = await openOrFail(path2);
|
|
96858
97035
|
if (typeof document4 === "number")
|
|
96859
97036
|
return document4;
|
|
@@ -96865,7 +97042,7 @@ async function run52(args) {
|
|
|
96865
97042
|
await writeStdout(renderTrackedChangeTable(records));
|
|
96866
97043
|
return EXIT2.OK;
|
|
96867
97044
|
}
|
|
96868
|
-
var
|
|
97045
|
+
var HELP49 = `docx track-changes list \u2014 inventory every revision wrapper
|
|
96869
97046
|
|
|
96870
97047
|
Usage:
|
|
96871
97048
|
docx track-changes list FILE [options]
|
|
@@ -97015,17 +97192,17 @@ var init_run_apply = __esm(() => {
|
|
|
97015
97192
|
// src/cli/track-changes/accept.ts
|
|
97016
97193
|
var exports_accept = {};
|
|
97017
97194
|
__export(exports_accept, {
|
|
97018
|
-
run: () =>
|
|
97195
|
+
run: () => run54
|
|
97019
97196
|
});
|
|
97020
|
-
async function
|
|
97021
|
-
return runApply(args, "accept",
|
|
97197
|
+
async function run54(args) {
|
|
97198
|
+
return runApply(args, "accept", HELP50);
|
|
97022
97199
|
}
|
|
97023
|
-
var AT_FORMS14,
|
|
97200
|
+
var AT_FORMS14, HELP50;
|
|
97024
97201
|
var init_accept = __esm(() => {
|
|
97025
97202
|
init_core2();
|
|
97026
97203
|
init_run_apply();
|
|
97027
97204
|
AT_FORMS14 = describeForms(["trackedChange"], " ");
|
|
97028
|
-
|
|
97205
|
+
HELP50 = `docx track-changes accept \u2014 accept tracked changes (incorporate into the doc)
|
|
97029
97206
|
|
|
97030
97207
|
Usage:
|
|
97031
97208
|
docx track-changes accept FILE --at tcN [options]
|
|
@@ -97086,17 +97263,17 @@ Examples:
|
|
|
97086
97263
|
// src/cli/track-changes/reject.ts
|
|
97087
97264
|
var exports_reject = {};
|
|
97088
97265
|
__export(exports_reject, {
|
|
97089
|
-
run: () =>
|
|
97266
|
+
run: () => run55
|
|
97090
97267
|
});
|
|
97091
|
-
async function
|
|
97092
|
-
return runApply(args, "reject",
|
|
97268
|
+
async function run55(args) {
|
|
97269
|
+
return runApply(args, "reject", HELP51);
|
|
97093
97270
|
}
|
|
97094
|
-
var AT_FORMS15,
|
|
97271
|
+
var AT_FORMS15, HELP51;
|
|
97095
97272
|
var init_reject = __esm(() => {
|
|
97096
97273
|
init_core2();
|
|
97097
97274
|
init_run_apply();
|
|
97098
97275
|
AT_FORMS15 = describeForms(["trackedChange"], " ");
|
|
97099
|
-
|
|
97276
|
+
HELP51 = `docx track-changes reject \u2014 reject tracked changes (revert to pre-change state)
|
|
97100
97277
|
|
|
97101
97278
|
Usage:
|
|
97102
97279
|
docx track-changes reject FILE --at tcN [options]
|
|
@@ -97165,28 +97342,28 @@ Examples:
|
|
|
97165
97342
|
// src/cli/track-changes/apply.ts
|
|
97166
97343
|
var exports_apply = {};
|
|
97167
97344
|
__export(exports_apply, {
|
|
97168
|
-
run: () =>
|
|
97345
|
+
run: () => run56
|
|
97169
97346
|
});
|
|
97170
|
-
async function
|
|
97347
|
+
async function run56(args) {
|
|
97171
97348
|
const parsed = await tryParseArgs(args, {
|
|
97172
97349
|
accept: { type: "string", multiple: true },
|
|
97173
97350
|
reject: { type: "string", multiple: true },
|
|
97174
97351
|
...SAVE_FLAGS
|
|
97175
|
-
},
|
|
97352
|
+
}, HELP52);
|
|
97176
97353
|
if (typeof parsed === "number")
|
|
97177
97354
|
return parsed;
|
|
97178
97355
|
if (parsed.values.help) {
|
|
97179
|
-
await writeStdout(
|
|
97356
|
+
await writeStdout(HELP52);
|
|
97180
97357
|
return EXIT2.OK;
|
|
97181
97358
|
}
|
|
97182
97359
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
97183
97360
|
const path2 = parsed.positionals[0];
|
|
97184
97361
|
if (!path2)
|
|
97185
|
-
return fail("USAGE", "Missing FILE argument",
|
|
97362
|
+
return fail("USAGE", "Missing FILE argument", HELP52);
|
|
97186
97363
|
const acceptRaw = parsed.values.accept ?? [];
|
|
97187
97364
|
const rejectRaw = parsed.values.reject ?? [];
|
|
97188
97365
|
if (acceptRaw.length === 0 && rejectRaw.length === 0) {
|
|
97189
|
-
return fail("USAGE", "Specify --accept and/or --reject (handle)",
|
|
97366
|
+
return fail("USAGE", "Specify --accept and/or --reject (handle)", HELP52);
|
|
97190
97367
|
}
|
|
97191
97368
|
const document4 = await openOrFail(path2);
|
|
97192
97369
|
if (typeof document4 === "number")
|
|
@@ -97207,7 +97384,7 @@ async function run55(args) {
|
|
|
97207
97384
|
const rejectSet = new Set(rejects);
|
|
97208
97385
|
const conflict = accepts.find((id) => rejectSet.has(id));
|
|
97209
97386
|
if (conflict) {
|
|
97210
|
-
return fail("USAGE", `${conflict} is named in both --accept and --reject`,
|
|
97387
|
+
return fail("USAGE", `${conflict} is named in both --accept and --reject`, HELP52);
|
|
97211
97388
|
}
|
|
97212
97389
|
const outputPath = parsed.values.output;
|
|
97213
97390
|
try {
|
|
@@ -97250,7 +97427,7 @@ function trackedChangeIndex2(id) {
|
|
|
97250
97427
|
const match = id.match(/^tc(\d+)$/);
|
|
97251
97428
|
return match?.[1] ? Number(match[1]) : 0;
|
|
97252
97429
|
}
|
|
97253
|
-
var
|
|
97430
|
+
var HELP52 = `docx track-changes apply \u2014 finalize: accept AND reject in one atomic call
|
|
97254
97431
|
|
|
97255
97432
|
Usage:
|
|
97256
97433
|
docx track-changes apply FILE (--accept H ... | --reject H ...) [options]
|
|
@@ -97303,16 +97480,16 @@ var init_apply2 = __esm(() => {
|
|
|
97303
97480
|
// src/cli/track-changes/toggle.tsx
|
|
97304
97481
|
var exports_toggle = {};
|
|
97305
97482
|
__export(exports_toggle, {
|
|
97306
|
-
run: () =>
|
|
97483
|
+
run: () => run57
|
|
97307
97484
|
});
|
|
97308
|
-
async function
|
|
97485
|
+
async function run57(args) {
|
|
97309
97486
|
const parsed = await tryParseArgs(args, {
|
|
97310
97487
|
...SAVE_FLAGS
|
|
97311
|
-
},
|
|
97488
|
+
}, HELP53);
|
|
97312
97489
|
if (typeof parsed === "number")
|
|
97313
97490
|
return parsed;
|
|
97314
97491
|
if (parsed.values.help) {
|
|
97315
|
-
await writeStdout(
|
|
97492
|
+
await writeStdout(HELP53);
|
|
97316
97493
|
return EXIT2.OK;
|
|
97317
97494
|
}
|
|
97318
97495
|
setVerboseAck(Boolean(parsed.values.verbose));
|
|
@@ -97321,10 +97498,10 @@ async function run56(args) {
|
|
|
97321
97498
|
const mode = modeFirst ? first : second;
|
|
97322
97499
|
const path2 = modeFirst ? second : first;
|
|
97323
97500
|
if (mode !== "on" && mode !== "off") {
|
|
97324
|
-
return fail("USAGE", `Expected "on" or "off" (e.g. \`docx track-changes on FILE\`), got: ${parsed.positionals.join(" ") || "<nothing>"}`,
|
|
97501
|
+
return fail("USAGE", `Expected "on" or "off" (e.g. \`docx track-changes on FILE\`), got: ${parsed.positionals.join(" ") || "<nothing>"}`, HELP53);
|
|
97325
97502
|
}
|
|
97326
97503
|
if (!path2)
|
|
97327
|
-
return fail("USAGE", "Missing FILE argument",
|
|
97504
|
+
return fail("USAGE", "Missing FILE argument", HELP53);
|
|
97328
97505
|
const document4 = await openOrFail(path2);
|
|
97329
97506
|
if (typeof document4 === "number")
|
|
97330
97507
|
return document4;
|
|
@@ -97354,7 +97531,7 @@ async function run56(args) {
|
|
|
97354
97531
|
});
|
|
97355
97532
|
return EXIT2.OK;
|
|
97356
97533
|
}
|
|
97357
|
-
var
|
|
97534
|
+
var HELP53 = `docx track-changes \u2014 toggle the document's tracked-changes mode
|
|
97358
97535
|
|
|
97359
97536
|
Usage:
|
|
97360
97537
|
docx track-changes on|off FILE [options]
|
|
@@ -97392,16 +97569,16 @@ var init_toggle2 = __esm(() => {
|
|
|
97392
97569
|
// src/cli/track-changes/index.ts
|
|
97393
97570
|
var exports_track_changes = {};
|
|
97394
97571
|
__export(exports_track_changes, {
|
|
97395
|
-
run: () =>
|
|
97572
|
+
run: () => run58
|
|
97396
97573
|
});
|
|
97397
|
-
async function
|
|
97574
|
+
async function run58(args) {
|
|
97398
97575
|
const first = args[0];
|
|
97399
97576
|
if (first === "--help" || first === "-h" || first === "help") {
|
|
97400
|
-
await writeStdout(
|
|
97577
|
+
await writeStdout(HELP54);
|
|
97401
97578
|
return 0;
|
|
97402
97579
|
}
|
|
97403
97580
|
if (!first) {
|
|
97404
|
-
return fail("USAGE", "Missing arguments",
|
|
97581
|
+
return fail("USAGE", "Missing arguments", HELP54);
|
|
97405
97582
|
}
|
|
97406
97583
|
if (first === "list") {
|
|
97407
97584
|
const module_2 = await Promise.resolve().then(() => (init_list8(), exports_list5));
|
|
@@ -97422,7 +97599,7 @@ async function run57(args) {
|
|
|
97422
97599
|
const module_ = await Promise.resolve().then(() => (init_toggle2(), exports_toggle));
|
|
97423
97600
|
return module_.run(args);
|
|
97424
97601
|
}
|
|
97425
|
-
var
|
|
97602
|
+
var HELP54 = `docx track-changes \u2014 manage tracked-changes
|
|
97426
97603
|
|
|
97427
97604
|
Usage:
|
|
97428
97605
|
docx track-changes on|off FILE [options]
|
|
@@ -97568,29 +97745,29 @@ var init_count = __esm(() => {
|
|
|
97568
97745
|
// src/cli/wc/index.ts
|
|
97569
97746
|
var exports_wc = {};
|
|
97570
97747
|
__export(exports_wc, {
|
|
97571
|
-
run: () =>
|
|
97748
|
+
run: () => run59
|
|
97572
97749
|
});
|
|
97573
|
-
async function
|
|
97750
|
+
async function run59(args) {
|
|
97574
97751
|
const parsed = await tryParseArgs(args, {
|
|
97575
97752
|
accepted: { type: "boolean" },
|
|
97576
97753
|
baseline: { type: "boolean" },
|
|
97577
97754
|
current: { type: "boolean" },
|
|
97578
97755
|
json: { type: "boolean" },
|
|
97579
97756
|
help: { type: "boolean", short: "h" }
|
|
97580
|
-
},
|
|
97757
|
+
}, HELP55);
|
|
97581
97758
|
if (typeof parsed === "number")
|
|
97582
97759
|
return parsed;
|
|
97583
97760
|
if (parsed.values.help) {
|
|
97584
|
-
await writeStdout(
|
|
97761
|
+
await writeStdout(HELP55);
|
|
97585
97762
|
return EXIT2.OK;
|
|
97586
97763
|
}
|
|
97587
97764
|
const path2 = parsed.positionals[0];
|
|
97588
97765
|
const locatorInput = parsed.positionals[1];
|
|
97589
97766
|
if (!path2)
|
|
97590
|
-
return fail("USAGE", "Missing FILE argument",
|
|
97767
|
+
return fail("USAGE", "Missing FILE argument", HELP55);
|
|
97591
97768
|
const view = resolveView(parsed.values);
|
|
97592
97769
|
if (!view) {
|
|
97593
|
-
return fail("USAGE", "--accepted, --baseline, and --current are mutually exclusive",
|
|
97770
|
+
return fail("USAGE", "--accepted, --baseline, and --current are mutually exclusive", HELP55);
|
|
97594
97771
|
}
|
|
97595
97772
|
const json2 = Boolean(parsed.values.json);
|
|
97596
97773
|
const pickText = paragraphTextFor(view);
|
|
@@ -97768,13 +97945,13 @@ function paragraphTextFor(view) {
|
|
|
97768
97945
|
return paragraphTextBaseline;
|
|
97769
97946
|
return paragraphText2;
|
|
97770
97947
|
}
|
|
97771
|
-
var
|
|
97948
|
+
var HELP55;
|
|
97772
97949
|
var init_wc = __esm(() => {
|
|
97773
97950
|
init_core2();
|
|
97774
97951
|
init_parse_helpers();
|
|
97775
97952
|
init_respond();
|
|
97776
97953
|
init_count();
|
|
97777
|
-
|
|
97954
|
+
HELP55 = `docx wc \u2014 count words in a document or a locator-addressed slice
|
|
97778
97955
|
|
|
97779
97956
|
Usage:
|
|
97780
97957
|
docx wc FILE [LOCATOR] [options]
|
|
@@ -97838,8 +98015,8 @@ Examples:
|
|
|
97838
98015
|
// package.json
|
|
97839
98016
|
var package_default = {
|
|
97840
98017
|
name: "bun-docx",
|
|
97841
|
-
version: "0.
|
|
97842
|
-
description: "
|
|
98018
|
+
version: "0.19.0",
|
|
98019
|
+
description: "Read, edit, redline, and comment on Microsoft Word .docx files from the command line \u2014 built for AI agents.",
|
|
97843
98020
|
keywords: [
|
|
97844
98021
|
"docx",
|
|
97845
98022
|
"openxml",
|
|
@@ -97849,8 +98026,15 @@ var package_default = {
|
|
|
97849
98026
|
"ai",
|
|
97850
98027
|
"claude",
|
|
97851
98028
|
"codex",
|
|
97852
|
-
"agentic"
|
|
98029
|
+
"agentic",
|
|
98030
|
+
"agent-skill",
|
|
98031
|
+
"pi-package"
|
|
97853
98032
|
],
|
|
98033
|
+
pi: {
|
|
98034
|
+
skills: [
|
|
98035
|
+
"./skills"
|
|
98036
|
+
]
|
|
98037
|
+
},
|
|
97854
98038
|
license: "MIT",
|
|
97855
98039
|
author: "Kirill Klimuk",
|
|
97856
98040
|
repository: {
|
|
@@ -97867,6 +98051,7 @@ var package_default = {
|
|
|
97867
98051
|
files: [
|
|
97868
98052
|
"dist/index.js",
|
|
97869
98053
|
"dist/pdfium-*.wasm",
|
|
98054
|
+
"skills/",
|
|
97870
98055
|
"README.md",
|
|
97871
98056
|
"LICENSE",
|
|
97872
98057
|
"LGPL-3.0.txt",
|