kordoc 4.0.6 → 4.0.7
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/LICENSE +21 -21
- package/dist/{-NDU7YGSS.js → -6HWEFXVV.js} +9 -9
- package/dist/{chunk-UVSOSFER.js → chunk-2SN3CKME.js} +2 -2
- package/dist/{chunk-MOL7MDBG.js → chunk-3TBUDJDE.js} +1 -1
- package/dist/chunk-3TBUDJDE.js.map +1 -0
- package/dist/{chunk-HOGJ5ALY.js → chunk-5OKHAJ62.js} +2 -2
- package/dist/{chunk-GE43BE46.js → chunk-AIQ3ISQU.js} +1 -1
- package/dist/chunk-AIQ3ISQU.js.map +1 -0
- package/dist/{chunk-5SOZXPQY.js → chunk-BKWHX3RC.js} +3 -3
- package/dist/{chunk-5CJGKKMZ.js → chunk-CFQLK3LM.js} +1 -1
- package/dist/chunk-CFQLK3LM.js.map +1 -0
- package/dist/{chunk-L3I4TIRP.js → chunk-CNM75ZSX.js} +2 -2
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-63ASYC4N.js → chunk-NGSHDBQR.js} +3 -3
- package/dist/{chunk-KA4FEBS2.js → chunk-ONXVBURQ.js} +2 -2
- package/dist/{chunk-4C7SBZNW.js → chunk-Q7EN4EUJ.js} +2 -2
- package/dist/{chunk-HC2SEH6I.js → chunk-TJJTLM76.js} +166 -97
- package/dist/chunk-TJJTLM76.js.map +1 -0
- package/dist/{chunk-DQJTNXVS.cjs → chunk-U25XGCNH.cjs} +2 -2
- package/dist/chunk-U25XGCNH.cjs.map +1 -0
- package/dist/{chunk-DCZVOIEO.cjs → chunk-X34YWRL5.cjs} +1 -1
- package/dist/chunk-X34YWRL5.cjs.map +1 -0
- package/dist/cli.js +17 -17
- package/dist/{detect-PJZMUL2Z.js → detect-NTR2FUEG.js} +2 -2
- package/dist/{formula-JCNF43NE.js → formula-KOQV353G.js} +1 -1
- package/dist/formula-KOQV353G.js.map +1 -0
- package/dist/{formula-RXVSQPXI.js → formula-MEDGYQXS.js} +1 -1
- package/dist/formula-MEDGYQXS.js.map +1 -0
- package/dist/{formula-5NKVS2LR.cjs → formula-ZYUDQHD3.cjs} +1 -1
- package/dist/formula-ZYUDQHD3.cjs.map +1 -0
- package/dist/index.cjs +298 -229
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +160 -91
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +13 -13
- package/dist/page-range-CIRRJPXJ.js +7 -0
- package/dist/page-range-OF5I4PQY.js +8 -0
- package/dist/page-range-TPIRSA3J.cjs +8 -0
- package/dist/page-range-TPIRSA3J.cjs.map +1 -0
- package/dist/{parser-C636QIOB.js → parser-5EHWYJMC.js} +24 -6
- package/dist/parser-5EHWYJMC.js.map +1 -0
- package/dist/{parser-VEY4B5CJ.cjs → parser-E6U5TNAU.cjs} +36 -18
- package/dist/parser-E6U5TNAU.cjs.map +1 -0
- package/dist/{parser-DMKHIV4E.js → parser-UGB3NIVH.js} +23 -5
- package/dist/parser-UGB3NIVH.js.map +1 -0
- package/dist/{profile-io-JYGCC6XQ.js → profile-io-CAKRPQRD.js} +3 -3
- package/dist/provider-5K7O3Z2O.cjs.map +1 -1
- package/dist/render-P6663O4I.js +10 -0
- package/dist/seal-7PPTXKKV.js +10 -0
- package/dist/{setup-57FB3LSP.js → setup-QSJ2INNS.js} +1 -1
- package/dist/setup-QSJ2INNS.js.map +1 -0
- package/dist/{watch-ZQUFJBFR.js → watch-RMX427YR.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-5CJGKKMZ.js.map +0 -1
- package/dist/chunk-DCZVOIEO.cjs.map +0 -1
- package/dist/chunk-DQJTNXVS.cjs.map +0 -1
- package/dist/chunk-GE43BE46.js.map +0 -1
- package/dist/chunk-HC2SEH6I.js.map +0 -1
- package/dist/chunk-MOL7MDBG.js.map +0 -1
- package/dist/formula-5NKVS2LR.cjs.map +0 -1
- package/dist/formula-JCNF43NE.js.map +0 -1
- package/dist/formula-RXVSQPXI.js.map +0 -1
- package/dist/page-range-737B4EZW.js +0 -8
- package/dist/page-range-LNMXJU6W.js +0 -7
- package/dist/page-range-P7SDW6LR.cjs +0 -8
- package/dist/page-range-P7SDW6LR.cjs.map +0 -1
- package/dist/parser-C636QIOB.js.map +0 -1
- package/dist/parser-DMKHIV4E.js.map +0 -1
- package/dist/parser-VEY4B5CJ.cjs.map +0 -1
- package/dist/render-ISOEOMTM.js +0 -10
- package/dist/seal-676ZIAZZ.js +0 -10
- package/dist/setup-57FB3LSP.js.map +0 -1
- /package/dist/{-NDU7YGSS.js.map → -6HWEFXVV.js.map} +0 -0
- /package/dist/{chunk-UVSOSFER.js.map → chunk-2SN3CKME.js.map} +0 -0
- /package/dist/{chunk-HOGJ5ALY.js.map → chunk-5OKHAJ62.js.map} +0 -0
- /package/dist/{chunk-5SOZXPQY.js.map → chunk-BKWHX3RC.js.map} +0 -0
- /package/dist/{chunk-L3I4TIRP.js.map → chunk-CNM75ZSX.js.map} +0 -0
- /package/dist/{chunk-63ASYC4N.js.map → chunk-NGSHDBQR.js.map} +0 -0
- /package/dist/{chunk-KA4FEBS2.js.map → chunk-ONXVBURQ.js.map} +0 -0
- /package/dist/{chunk-4C7SBZNW.js.map → chunk-Q7EN4EUJ.js.map} +0 -0
- /package/dist/{detect-PJZMUL2Z.js.map → detect-NTR2FUEG.js.map} +0 -0
- /package/dist/{page-range-737B4EZW.js.map → page-range-CIRRJPXJ.js.map} +0 -0
- /package/dist/{page-range-LNMXJU6W.js.map → page-range-OF5I4PQY.js.map} +0 -0
- /package/dist/{profile-io-JYGCC6XQ.js.map → profile-io-CAKRPQRD.js.map} +0 -0
- /package/dist/{render-ISOEOMTM.js.map → render-P6663O4I.js.map} +0 -0
- /package/dist/{seal-676ZIAZZ.js.map → seal-7PPTXKKV.js.map} +0 -0
- /package/dist/{watch-ZQUFJBFR.js.map → watch-RMX427YR.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
sanitizeHref,
|
|
21
21
|
stripDtd,
|
|
22
22
|
toArrayBuffer
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5OKHAJ62.js";
|
|
24
24
|
import {
|
|
25
25
|
parsePageRange
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AIQ3ISQU.js";
|
|
27
27
|
|
|
28
28
|
// src/index.ts
|
|
29
29
|
import { readFile } from "fs/promises";
|
|
@@ -18057,7 +18057,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18057
18057
|
}
|
|
18058
18058
|
let pageFilter = null;
|
|
18059
18059
|
if (options?.pages) {
|
|
18060
|
-
const { parsePageRange: parsePageRange2 } = await import("./page-range-
|
|
18060
|
+
const { parsePageRange: parsePageRange2 } = await import("./page-range-CIRRJPXJ.js");
|
|
18061
18061
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
18062
18062
|
}
|
|
18063
18063
|
const blocks = [];
|
|
@@ -18695,7 +18695,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18695
18695
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
18696
18696
|
let pageFilter = null;
|
|
18697
18697
|
if (options?.pages) {
|
|
18698
|
-
const { parsePageRange: parsePageRange2 } = await import("./page-range-
|
|
18698
|
+
const { parsePageRange: parsePageRange2 } = await import("./page-range-CIRRJPXJ.js");
|
|
18699
18699
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
18700
18700
|
}
|
|
18701
18701
|
const allBlocks = [];
|
|
@@ -19297,6 +19297,102 @@ function extractRun(r) {
|
|
|
19297
19297
|
}
|
|
19298
19298
|
return { text, bold, italic };
|
|
19299
19299
|
}
|
|
19300
|
+
function fieldUrlFromInstr(instr) {
|
|
19301
|
+
if (!/HYPERLINK\b/i.test(instr)) return null;
|
|
19302
|
+
const urlM = instr.match(/HYPERLINK\s+"([^"]*)"/i);
|
|
19303
|
+
const anchorM = instr.match(/\\l\s+"([^"]*)"/i);
|
|
19304
|
+
if (urlM && urlM[1]) {
|
|
19305
|
+
return anchorM && anchorM[1] ? `${urlM[1]}#${anchorM[1]}` : urlM[1];
|
|
19306
|
+
}
|
|
19307
|
+
if (anchorM && anchorM[1]) return `#${anchorM[1]}`;
|
|
19308
|
+
return null;
|
|
19309
|
+
}
|
|
19310
|
+
function makeLink(text, rawHref) {
|
|
19311
|
+
if (!text) return "";
|
|
19312
|
+
if (!rawHref) return text;
|
|
19313
|
+
const href = sanitizeHref(rawHref);
|
|
19314
|
+
return href ? `[${text}](${href})` : text;
|
|
19315
|
+
}
|
|
19316
|
+
function collectInline(p, footnotes, rels) {
|
|
19317
|
+
const parts = [];
|
|
19318
|
+
let bold = false;
|
|
19319
|
+
let italic = false;
|
|
19320
|
+
let footnoteText;
|
|
19321
|
+
let fieldActive = false;
|
|
19322
|
+
let fieldStage = "instr";
|
|
19323
|
+
let fieldInstr = "";
|
|
19324
|
+
let fieldDisplay = "";
|
|
19325
|
+
const flushField = () => {
|
|
19326
|
+
if (!fieldActive) return;
|
|
19327
|
+
if (fieldDisplay) {
|
|
19328
|
+
const url = fieldUrlFromInstr(fieldInstr);
|
|
19329
|
+
parts.push(url ? makeLink(fieldDisplay, url) : fieldDisplay);
|
|
19330
|
+
}
|
|
19331
|
+
fieldActive = false;
|
|
19332
|
+
fieldStage = "instr";
|
|
19333
|
+
fieldInstr = "";
|
|
19334
|
+
fieldDisplay = "";
|
|
19335
|
+
};
|
|
19336
|
+
for (const el of effectiveChildElements(p)) {
|
|
19337
|
+
if (matchesLocal(el, "hyperlink")) {
|
|
19338
|
+
const rId = getAttr(el, "id");
|
|
19339
|
+
const anchor = getAttr(el, "anchor");
|
|
19340
|
+
const t = findElements(el, "r").map((r) => extractRun(r).text).join("");
|
|
19341
|
+
if (!t) continue;
|
|
19342
|
+
let raw = null;
|
|
19343
|
+
if (rId && rels.has(rId)) raw = rels.get(rId);
|
|
19344
|
+
else if (anchor) raw = `#${anchor}`;
|
|
19345
|
+
if (fieldActive && fieldStage === "display") fieldDisplay += t;
|
|
19346
|
+
else parts.push(makeLink(t, raw));
|
|
19347
|
+
continue;
|
|
19348
|
+
}
|
|
19349
|
+
if (matchesLocal(el, "fldSimple")) {
|
|
19350
|
+
const t = findElements(el, "r").map((r) => extractRun(r).text).join("");
|
|
19351
|
+
if (!t) continue;
|
|
19352
|
+
const url = fieldUrlFromInstr(getAttr(el, "instr") ?? "");
|
|
19353
|
+
parts.push(url ? makeLink(t, url) : t);
|
|
19354
|
+
continue;
|
|
19355
|
+
}
|
|
19356
|
+
if (matchesLocal(el, "r")) {
|
|
19357
|
+
for (const fc of getChildElements(el, "fldChar")) {
|
|
19358
|
+
const ty = getAttr(fc, "fldCharType");
|
|
19359
|
+
if (ty === "begin") {
|
|
19360
|
+
flushField();
|
|
19361
|
+
fieldActive = true;
|
|
19362
|
+
fieldStage = "instr";
|
|
19363
|
+
} else if (ty === "separate") {
|
|
19364
|
+
if (fieldActive) fieldStage = "display";
|
|
19365
|
+
} else if (ty === "end") flushField();
|
|
19366
|
+
}
|
|
19367
|
+
if (fieldActive && fieldStage === "instr") {
|
|
19368
|
+
for (const it of getChildElements(el, "instrText")) fieldInstr += it.textContent ?? "";
|
|
19369
|
+
}
|
|
19370
|
+
const rr = extractRun(el);
|
|
19371
|
+
if (rr.bold) bold = true;
|
|
19372
|
+
if (rr.italic) italic = true;
|
|
19373
|
+
const fnRefEls = getChildElements(el, "footnoteReference");
|
|
19374
|
+
if (fnRefEls.length > 0) {
|
|
19375
|
+
const fnId = getAttr(fnRefEls[0], "id");
|
|
19376
|
+
if (fnId && footnotes.has(fnId)) footnoteText = footnotes.get(fnId);
|
|
19377
|
+
}
|
|
19378
|
+
if (rr.text) {
|
|
19379
|
+
if (fieldActive && fieldStage === "display") fieldDisplay += rr.text;
|
|
19380
|
+
else if (fieldActive && fieldStage === "instr") {
|
|
19381
|
+
} else parts.push(rr.text);
|
|
19382
|
+
}
|
|
19383
|
+
continue;
|
|
19384
|
+
}
|
|
19385
|
+
}
|
|
19386
|
+
flushField();
|
|
19387
|
+
for (const om of collectOmmlRoots(p)) {
|
|
19388
|
+
const latex = ommlElementToLatex(om);
|
|
19389
|
+
if (!latex) continue;
|
|
19390
|
+
if (isDisplayMath(om)) parts.push(" $$" + latex + "$$ ");
|
|
19391
|
+
else parts.push(" $" + latex + "$ ");
|
|
19392
|
+
}
|
|
19393
|
+
const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
|
|
19394
|
+
return { text, bold, italic, footnoteText };
|
|
19395
|
+
}
|
|
19300
19396
|
function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
19301
19397
|
const pPrEls = getChildElements(p, "pPr");
|
|
19302
19398
|
let styleId = "";
|
|
@@ -19313,54 +19409,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19313
19409
|
ilvl = ilvlEls.length > 0 ? parseInt(getAttr(ilvlEls[0], "val") ?? "0", 10) : 0;
|
|
19314
19410
|
}
|
|
19315
19411
|
}
|
|
19316
|
-
const
|
|
19317
|
-
let hasBold = false;
|
|
19318
|
-
let hasItalic = false;
|
|
19319
|
-
let href;
|
|
19320
|
-
let footnoteText;
|
|
19321
|
-
const hyperlinks = getChildElements(p, "hyperlink");
|
|
19322
|
-
const hyperlinkTexts = /* @__PURE__ */ new Set();
|
|
19323
|
-
for (const hl of hyperlinks) {
|
|
19324
|
-
const rId = getAttr(hl, "id");
|
|
19325
|
-
const hlText = [];
|
|
19326
|
-
const runs2 = findElements(hl, "r");
|
|
19327
|
-
for (const r of runs2) {
|
|
19328
|
-
const result = extractRun(r);
|
|
19329
|
-
hlText.push(result.text);
|
|
19330
|
-
}
|
|
19331
|
-
const text2 = hlText.join("");
|
|
19332
|
-
if (text2) {
|
|
19333
|
-
hyperlinkTexts.add(text2);
|
|
19334
|
-
if (rId && rels.has(rId)) {
|
|
19335
|
-
href = rels.get(rId);
|
|
19336
|
-
parts.push(text2);
|
|
19337
|
-
} else {
|
|
19338
|
-
parts.push(text2);
|
|
19339
|
-
}
|
|
19340
|
-
}
|
|
19341
|
-
}
|
|
19342
|
-
const runs = getChildElements(p, "r");
|
|
19343
|
-
for (const r of runs) {
|
|
19344
|
-
if (r.parentNode && r.parentNode.localName === "hyperlink") continue;
|
|
19345
|
-
const result = extractRun(r);
|
|
19346
|
-
if (result.bold) hasBold = true;
|
|
19347
|
-
if (result.italic) hasItalic = true;
|
|
19348
|
-
const fnRefEls = getChildElements(r, "footnoteReference");
|
|
19349
|
-
if (fnRefEls.length > 0) {
|
|
19350
|
-
const fnId = getAttr(fnRefEls[0], "id");
|
|
19351
|
-
if (fnId && footnotes.has(fnId)) {
|
|
19352
|
-
footnoteText = footnotes.get(fnId);
|
|
19353
|
-
}
|
|
19354
|
-
}
|
|
19355
|
-
if (result.text) parts.push(result.text);
|
|
19356
|
-
}
|
|
19357
|
-
for (const om of collectOmmlRoots(p)) {
|
|
19358
|
-
const latex = ommlElementToLatex(om);
|
|
19359
|
-
if (!latex) continue;
|
|
19360
|
-
if (isDisplayMath(om)) parts.push(" $$" + latex + "$$ ");
|
|
19361
|
-
else parts.push(" $" + latex + "$ ");
|
|
19362
|
-
}
|
|
19363
|
-
const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
|
|
19412
|
+
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
19364
19413
|
if (!text) return null;
|
|
19365
19414
|
const style = styles.get(styleId);
|
|
19366
19415
|
if (style?.outlineLevel !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
@@ -19380,7 +19429,6 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19380
19429
|
if (hasBold || hasItalic) {
|
|
19381
19430
|
block.style = { bold: hasBold || void 0, italic: hasItalic || void 0 };
|
|
19382
19431
|
}
|
|
19383
|
-
if (href) block.href = href;
|
|
19384
19432
|
if (footnoteText) block.footnoteText = footnoteText;
|
|
19385
19433
|
return block;
|
|
19386
19434
|
}
|
|
@@ -19481,46 +19529,61 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
19481
19529
|
}
|
|
19482
19530
|
return parts;
|
|
19483
19531
|
}
|
|
19484
|
-
async function
|
|
19485
|
-
const
|
|
19532
|
+
async function buildImageMap(zip, rels, doc, warnings) {
|
|
19533
|
+
const imageMap = /* @__PURE__ */ new Map();
|
|
19486
19534
|
const images = [];
|
|
19487
|
-
const drawingElements = findElements(doc.documentElement, "drawing");
|
|
19488
19535
|
let imgIdx = 0;
|
|
19489
|
-
for (const
|
|
19490
|
-
const
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
message: `DOCX \uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328 (${imgPath}): ${err instanceof Error ? err.message : String(err)}`
|
|
19519
|
-
});
|
|
19520
|
-
}
|
|
19536
|
+
for (const blip of findElements(doc.documentElement, "blip")) {
|
|
19537
|
+
const embedId = getAttr(blip, "embed");
|
|
19538
|
+
if (!embedId || imageMap.has(embedId)) continue;
|
|
19539
|
+
const target = rels.get(embedId);
|
|
19540
|
+
if (!target) continue;
|
|
19541
|
+
const imgPath = target.startsWith("/") ? target.slice(1) : target.startsWith("word/") ? target : `word/${target}`;
|
|
19542
|
+
const imgFile = zip.file(imgPath);
|
|
19543
|
+
if (!imgFile) continue;
|
|
19544
|
+
try {
|
|
19545
|
+
const data = await imgFile.async("uint8array");
|
|
19546
|
+
imgIdx++;
|
|
19547
|
+
const ext = imgPath.split(".").pop()?.toLowerCase() ?? "png";
|
|
19548
|
+
const mimeMap = {
|
|
19549
|
+
png: "image/png",
|
|
19550
|
+
jpg: "image/jpeg",
|
|
19551
|
+
jpeg: "image/jpeg",
|
|
19552
|
+
gif: "image/gif",
|
|
19553
|
+
bmp: "image/bmp",
|
|
19554
|
+
wmf: "image/wmf",
|
|
19555
|
+
emf: "image/emf"
|
|
19556
|
+
};
|
|
19557
|
+
const filename = `image_${String(imgIdx).padStart(3, "0")}.${ext}`;
|
|
19558
|
+
images.push({ filename, data, mimeType: mimeMap[ext] ?? "image/png" });
|
|
19559
|
+
imageMap.set(embedId, filename);
|
|
19560
|
+
} catch (err) {
|
|
19561
|
+
warnings.push({
|
|
19562
|
+
code: "SKIPPED_IMAGE",
|
|
19563
|
+
message: `DOCX \uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328 (${imgPath}): ${err instanceof Error ? err.message : String(err)}`
|
|
19564
|
+
});
|
|
19521
19565
|
}
|
|
19522
19566
|
}
|
|
19523
|
-
return {
|
|
19567
|
+
return { imageMap, images };
|
|
19568
|
+
}
|
|
19569
|
+
function collectParagraphBlips(node, out = [], depth = 0) {
|
|
19570
|
+
if (depth > 40) return out;
|
|
19571
|
+
for (const el of effectiveChildElements(node)) {
|
|
19572
|
+
if (matchesLocal(el, "txbxContent") || matchesLocal(el, "Fallback")) continue;
|
|
19573
|
+
if (matchesLocal(el, "blip")) out.push(el);
|
|
19574
|
+
else collectParagraphBlips(el, out, depth + 1);
|
|
19575
|
+
}
|
|
19576
|
+
return out;
|
|
19577
|
+
}
|
|
19578
|
+
function emitParagraphImages(p, imageMap, linked, out) {
|
|
19579
|
+
for (const blip of collectParagraphBlips(p)) {
|
|
19580
|
+
const embedId = getAttr(blip, "embed");
|
|
19581
|
+
if (!embedId) continue;
|
|
19582
|
+
const filename = imageMap.get(embedId);
|
|
19583
|
+
if (!filename) continue;
|
|
19584
|
+
linked.add(embedId);
|
|
19585
|
+
out.push({ type: "image", text: filename });
|
|
19586
|
+
}
|
|
19524
19587
|
}
|
|
19525
19588
|
async function parseDocxDocument(buffer, options) {
|
|
19526
19589
|
precheckZipSize(buffer, MAX_DECOMPRESS_SIZE4);
|
|
@@ -19577,6 +19640,8 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19577
19640
|
if (body.length === 0) {
|
|
19578
19641
|
throw new KordocError("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19579
19642
|
}
|
|
19643
|
+
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19644
|
+
const linkedImages = /* @__PURE__ */ new Set();
|
|
19580
19645
|
const blocks = [];
|
|
19581
19646
|
const bodyEl = body[0];
|
|
19582
19647
|
const topLevel = effectiveChildElements(bodyEl);
|
|
@@ -19585,16 +19650,20 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19585
19650
|
if (localName2 === "p") {
|
|
19586
19651
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19587
19652
|
if (block) blocks.push(block);
|
|
19653
|
+
if (imageMap.size > 0) emitParagraphImages(el, imageMap, linkedImages, blocks);
|
|
19588
19654
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
19589
19655
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
19590
19656
|
if (tb) blocks.push(tb);
|
|
19657
|
+
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
19591
19658
|
}
|
|
19592
19659
|
} else if (localName2 === "tbl") {
|
|
19593
19660
|
const block = parseTable(el, styles, numbering, footnotes, rels);
|
|
19594
19661
|
if (block) blocks.push(block);
|
|
19595
19662
|
}
|
|
19596
19663
|
}
|
|
19597
|
-
const
|
|
19664
|
+
for (const [embedId, filename] of imageMap) {
|
|
19665
|
+
if (!linkedImages.has(embedId)) blocks.push({ type: "image", text: filename });
|
|
19666
|
+
}
|
|
19598
19667
|
const metadata = {};
|
|
19599
19668
|
const coreFile = zip.file("docProps/core.xml");
|
|
19600
19669
|
if (coreFile) {
|
|
@@ -29814,7 +29883,7 @@ async function parseHwp(buffer, options) {
|
|
|
29814
29883
|
async function parsePdf(buffer, options) {
|
|
29815
29884
|
let parsePdfDocument;
|
|
29816
29885
|
try {
|
|
29817
|
-
const mod = await import("./parser-
|
|
29886
|
+
const mod = await import("./parser-UGB3NIVH.js");
|
|
29818
29887
|
parsePdfDocument = mod.parsePdfDocument;
|
|
29819
29888
|
} catch {
|
|
29820
29889
|
return {
|