kordoc 4.2.6 → 4.2.8
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/dist/{-UYYP67I6.js → -SCTT2TBZ.js} +9 -9
- package/dist/{chunk-6XVQSILN.cjs → chunk-2BTKLDNX.cjs} +4 -4
- package/dist/chunk-2BTKLDNX.cjs.map +1 -0
- package/dist/{chunk-YHAB7UP6.js → chunk-4FTXKIGT.js} +2 -2
- package/dist/{chunk-YF6JUAM7.js → chunk-55QIELGV.js} +3 -3
- package/dist/{chunk-O5JOHYCV.js → chunk-7GEBDS6B.js} +2 -2
- package/dist/{chunk-LIG666DX.cjs → chunk-CELJIGBQ.cjs} +3 -3
- package/dist/chunk-CELJIGBQ.cjs.map +1 -0
- package/dist/{chunk-DSCSR6NE.js → chunk-COHHXQSP.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-EGQQVYKL.js → chunk-EOVJ27WC.js} +3 -3
- package/dist/{chunk-64DMMXFW.js → chunk-FS3XQ3ZQ.js} +2 -2
- package/dist/{chunk-QPPOC6OL.js → chunk-GKSFNCVP.js} +2 -2
- package/dist/chunk-GKSFNCVP.js.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-H7OWEYH2.cjs.map +1 -1
- package/dist/{chunk-NVPCKSNL.js → chunk-IJUAWDOS.js} +3 -3
- package/dist/{chunk-6KT4B4QX.js → chunk-JP5MNHUK.js} +2 -2
- package/dist/{chunk-GJO3ORFW.js → chunk-LM7C6HI2.js} +1 -1
- package/dist/chunk-LM7C6HI2.js.map +1 -0
- package/dist/{chunk-5FS4IZWY.cjs → chunk-OQNFGKRY.cjs} +2 -2
- package/dist/chunk-OQNFGKRY.cjs.map +1 -0
- package/dist/{chunk-5E7ZMWDF.js → chunk-QZCAIFUW.js} +2 -2
- package/dist/{chunk-ZB3WT7XX.cjs → chunk-ROKHZE76.cjs} +9 -9
- package/dist/chunk-ROKHZE76.cjs.map +1 -0
- package/dist/{chunk-N4BFHNLA.js → chunk-UKEZ46VL.js} +2 -2
- package/dist/{chunk-SYJ6FPPQ.js → chunk-URKX77GB.js} +2 -2
- package/dist/{chunk-TZLLCYDN.js → chunk-WP4VD5T7.js} +2 -2
- package/dist/chunk-WP4VD5T7.js.map +1 -0
- package/dist/{chunk-VQ5NQBL2.js → chunk-YNAPK4H6.js} +65 -32
- package/dist/chunk-YNAPK4H6.js.map +1 -0
- package/dist/chunks-KKYJDJT7.js +10 -0
- package/dist/cli.js +17 -17
- package/dist/formula-SB3NHDUM.cjs.map +1 -1
- package/dist/{image-ocr-WN3UO4UY.js → image-ocr-ANSXR5KJ.js} +4 -4
- package/dist/{image-ocr-YOUVLJIH.cjs → image-ocr-GHQ6YKJH.cjs} +9 -9
- package/dist/image-ocr-GHQ6YKJH.cjs.map +1 -0
- package/dist/{image-ocr-FXLX2GM6.js → image-ocr-ORATZW73.js} +5 -5
- package/dist/index.cjs +490 -457
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +60 -27
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +15 -15
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-KIXK2IEX.js → parser-BPVTYM5K.js} +5 -5
- package/dist/{parser-KYSMRSMJ.js → parser-GZDOZCHM.js} +6 -6
- package/dist/{parser-AUMEO4OU.cjs → parser-KTNIUF2N.cjs} +24 -24
- package/dist/parser-KTNIUF2N.cjs.map +1 -0
- package/dist/pdf-ocr-6XKLXZTF.cjs +13 -0
- package/dist/pdf-ocr-6XKLXZTF.cjs.map +1 -0
- package/dist/pdf-ocr-HWPNMKKC.js +12 -0
- package/dist/{pdf-ocr-NQFV46WZ.js → pdf-ocr-W2PA2K3U.js} +5 -5
- package/dist/{profile-io-NKUXEPI4.js → profile-io-I2TH44EO.js} +3 -3
- package/dist/{rasterize-OT5TROD4.js → rasterize-QBA43YAQ.js} +2 -2
- package/dist/render-MDJDKKNH.js +10 -0
- package/dist/seal-Z52JR2GX.js +10 -0
- package/dist/{watch-6KMSCCM5.js → watch-7V6X7LHV.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-5FS4IZWY.cjs.map +0 -1
- package/dist/chunk-6XVQSILN.cjs.map +0 -1
- package/dist/chunk-GJO3ORFW.js.map +0 -1
- package/dist/chunk-LIG666DX.cjs.map +0 -1
- package/dist/chunk-QPPOC6OL.js.map +0 -1
- package/dist/chunk-TZLLCYDN.js.map +0 -1
- package/dist/chunk-VQ5NQBL2.js.map +0 -1
- package/dist/chunk-ZB3WT7XX.cjs.map +0 -1
- package/dist/chunks-G7YDTLNI.js +0 -10
- package/dist/image-ocr-YOUVLJIH.cjs.map +0 -1
- package/dist/parser-AUMEO4OU.cjs.map +0 -1
- package/dist/pdf-ocr-2QOASWPI.js +0 -12
- package/dist/pdf-ocr-BUKZ5R4P.cjs +0 -13
- package/dist/pdf-ocr-BUKZ5R4P.cjs.map +0 -1
- package/dist/render-HQTKZ3ZE.js +0 -10
- package/dist/seal-KH6IL23B.js +0 -10
- /package/dist/{-UYYP67I6.js.map → -SCTT2TBZ.js.map} +0 -0
- /package/dist/{chunk-YHAB7UP6.js.map → chunk-4FTXKIGT.js.map} +0 -0
- /package/dist/{chunk-YF6JUAM7.js.map → chunk-55QIELGV.js.map} +0 -0
- /package/dist/{chunk-O5JOHYCV.js.map → chunk-7GEBDS6B.js.map} +0 -0
- /package/dist/{chunk-DSCSR6NE.js.map → chunk-COHHXQSP.js.map} +0 -0
- /package/dist/{chunk-EGQQVYKL.js.map → chunk-EOVJ27WC.js.map} +0 -0
- /package/dist/{chunk-64DMMXFW.js.map → chunk-FS3XQ3ZQ.js.map} +0 -0
- /package/dist/{chunk-NVPCKSNL.js.map → chunk-IJUAWDOS.js.map} +0 -0
- /package/dist/{chunk-6KT4B4QX.js.map → chunk-JP5MNHUK.js.map} +0 -0
- /package/dist/{chunk-5E7ZMWDF.js.map → chunk-QZCAIFUW.js.map} +0 -0
- /package/dist/{chunk-N4BFHNLA.js.map → chunk-UKEZ46VL.js.map} +0 -0
- /package/dist/{chunk-SYJ6FPPQ.js.map → chunk-URKX77GB.js.map} +0 -0
- /package/dist/{chunks-G7YDTLNI.js.map → chunks-KKYJDJT7.js.map} +0 -0
- /package/dist/{image-ocr-WN3UO4UY.js.map → image-ocr-ANSXR5KJ.js.map} +0 -0
- /package/dist/{image-ocr-FXLX2GM6.js.map → image-ocr-ORATZW73.js.map} +0 -0
- /package/dist/{parser-KIXK2IEX.js.map → parser-BPVTYM5K.js.map} +0 -0
- /package/dist/{parser-KYSMRSMJ.js.map → parser-GZDOZCHM.js.map} +0 -0
- /package/dist/{pdf-ocr-2QOASWPI.js.map → pdf-ocr-HWPNMKKC.js.map} +0 -0
- /package/dist/{pdf-ocr-NQFV46WZ.js.map → pdf-ocr-W2PA2K3U.js.map} +0 -0
- /package/dist/{profile-io-NKUXEPI4.js.map → profile-io-I2TH44EO.js.map} +0 -0
- /package/dist/{rasterize-OT5TROD4.js.map → rasterize-QBA43YAQ.js.map} +0 -0
- /package/dist/{render-HQTKZ3ZE.js.map → render-MDJDKKNH.js.map} +0 -0
- /package/dist/{seal-KH6IL23B.js.map → seal-Z52JR2GX.js.map} +0 -0
- /package/dist/{watch-6KMSCCM5.js.map → watch-7V6X7LHV.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -92,6 +92,12 @@ interface IRTable {
|
|
|
92
92
|
hasHeader: boolean;
|
|
93
93
|
/** 표 캡션 (예: "표 1. 부서별 예산") — v3.0 */
|
|
94
94
|
caption?: string;
|
|
95
|
+
/**
|
|
96
|
+
* 캡션 내부 블록 콘텐츠 — v4.2.8 (#55).
|
|
97
|
+
* 캡션 안 중첩표·문단을 구조 그대로, 원문 순서대로 보존한다 (IRCell.blocks와 같은 계약).
|
|
98
|
+
* 표가 있을 때만 채워지며, caption은 하위 호환용 평탄화 문자열로 계속 제공된다.
|
|
99
|
+
*/
|
|
100
|
+
captionBlocks?: IRBlock[];
|
|
95
101
|
}
|
|
96
102
|
interface IRCell {
|
|
97
103
|
text: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,12 @@ interface IRTable {
|
|
|
92
92
|
hasHeader: boolean;
|
|
93
93
|
/** 표 캡션 (예: "표 1. 부서별 예산") — v3.0 */
|
|
94
94
|
caption?: string;
|
|
95
|
+
/**
|
|
96
|
+
* 캡션 내부 블록 콘텐츠 — v4.2.8 (#55).
|
|
97
|
+
* 캡션 안 중첩표·문단을 구조 그대로, 원문 순서대로 보존한다 (IRCell.blocks와 같은 계약).
|
|
98
|
+
* 표가 있을 때만 채워지며, caption은 하위 호환용 평탄화 문자열로 계속 제공된다.
|
|
99
|
+
*/
|
|
100
|
+
captionBlocks?: IRBlock[];
|
|
95
101
|
}
|
|
96
102
|
interface IRCell {
|
|
97
103
|
text: string;
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
flattenLayoutTables,
|
|
9
9
|
inlineImagesIntoMarkdown,
|
|
10
10
|
mapPuaText
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QZCAIFUW.js";
|
|
12
12
|
import {
|
|
13
13
|
parsePageRange
|
|
14
14
|
} from "./chunk-GE43BE46.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
sanitizeHref,
|
|
28
28
|
stripDtd,
|
|
29
29
|
toArrayBuffer
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WP4VD5T7.js";
|
|
31
31
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
import { readFile } from "fs/promises";
|
|
@@ -1914,6 +1914,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1914
1914
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
|
|
1915
1915
|
const table2 = buildTable(state.rows, { keepAnchoredEmptyCols });
|
|
1916
1916
|
if (state.caption) table2.caption = state.caption;
|
|
1917
|
+
if (state.captionBlocks?.length) table2.captionBlocks = state.captionBlocks;
|
|
1917
1918
|
const anchors = [];
|
|
1918
1919
|
{
|
|
1919
1920
|
const covered = /* @__PURE__ */ new Set();
|
|
@@ -2061,12 +2062,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2061
2062
|
}
|
|
2062
2063
|
// 표/도표 캡션 — IRTable.caption으로 보존 (v3.0, 기존 무음 드롭 수정)
|
|
2063
2064
|
case "caption": {
|
|
2064
|
-
const
|
|
2065
|
-
if (
|
|
2065
|
+
const cap = collectSubListContent(el, ctx);
|
|
2066
|
+
if (cap.text) {
|
|
2066
2067
|
if (tableCtx) {
|
|
2067
|
-
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") +
|
|
2068
|
+
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
2069
|
+
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
2068
2070
|
} else {
|
|
2069
|
-
blocks.push({ type: "paragraph", text:
|
|
2071
|
+
blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
|
|
2070
2072
|
}
|
|
2071
2073
|
}
|
|
2072
2074
|
break;
|
|
@@ -2316,40 +2318,60 @@ function hasPageAutoNum(el, depth = 0) {
|
|
|
2316
2318
|
return false;
|
|
2317
2319
|
}
|
|
2318
2320
|
function collectSubListText(el, ctx, depth = 0) {
|
|
2319
|
-
|
|
2321
|
+
return collectSubListContent(el, ctx, depth).text;
|
|
2322
|
+
}
|
|
2323
|
+
function collectSubListContent(el, ctx, depth = 0) {
|
|
2324
|
+
const out = { text: "", blocks: [], hasStructure: false };
|
|
2325
|
+
if (depth > 10) return out;
|
|
2320
2326
|
const parts = [];
|
|
2321
2327
|
const children = el.childNodes;
|
|
2322
|
-
if (!children) return
|
|
2328
|
+
if (!children) return out;
|
|
2323
2329
|
for (let i = 0; i < children.length; i++) {
|
|
2324
2330
|
const ch = children[i];
|
|
2325
2331
|
if (ch.nodeType !== 1) continue;
|
|
2326
2332
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
2327
2333
|
if (tag === "p" || tag === "para") {
|
|
2328
2334
|
const t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
|
|
2329
|
-
if (t)
|
|
2335
|
+
if (t) {
|
|
2336
|
+
parts.push(t);
|
|
2337
|
+
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.sectionNum });
|
|
2338
|
+
}
|
|
2330
2339
|
const tbls = [];
|
|
2331
2340
|
findTopLevelTbls(ch, tbls);
|
|
2332
2341
|
for (const tbl2 of tbls) {
|
|
2333
|
-
const
|
|
2334
|
-
if (
|
|
2342
|
+
const built = buildSubListTable(tbl2, ctx, depth);
|
|
2343
|
+
if (built.text) parts.push(built.text);
|
|
2344
|
+
if (built.block) {
|
|
2345
|
+
out.blocks.push(built.block);
|
|
2346
|
+
out.hasStructure = true;
|
|
2347
|
+
}
|
|
2335
2348
|
}
|
|
2336
2349
|
} else if (tag === "tbl") {
|
|
2337
|
-
const
|
|
2338
|
-
if (
|
|
2350
|
+
const built = buildSubListTable(ch, ctx, depth);
|
|
2351
|
+
if (built.text) parts.push(built.text);
|
|
2352
|
+
if (built.block) {
|
|
2353
|
+
out.blocks.push(built.block);
|
|
2354
|
+
out.hasStructure = true;
|
|
2355
|
+
}
|
|
2339
2356
|
} else {
|
|
2340
|
-
const
|
|
2341
|
-
if (
|
|
2357
|
+
const sub = collectSubListContent(ch, ctx, depth + 1);
|
|
2358
|
+
if (sub.text) parts.push(sub.text);
|
|
2359
|
+
out.blocks.push(...sub.blocks);
|
|
2360
|
+
if (sub.hasStructure) out.hasStructure = true;
|
|
2342
2361
|
}
|
|
2343
2362
|
}
|
|
2344
|
-
|
|
2363
|
+
out.text = parts.join("\n").trim();
|
|
2364
|
+
return out;
|
|
2345
2365
|
}
|
|
2346
|
-
function
|
|
2366
|
+
function buildSubListTable(el, ctx, depth) {
|
|
2347
2367
|
const sink = [];
|
|
2348
2368
|
const st = { rows: [], currentRow: [], cell: null };
|
|
2349
2369
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2350
2370
|
let flat = convertTableToText(st.rows);
|
|
2351
2371
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2352
|
-
|
|
2372
|
+
const built = [];
|
|
2373
|
+
completeTable(st, [], built, ctx);
|
|
2374
|
+
return { text: flat, block: built.find((b) => b.type === "table") ?? null };
|
|
2353
2375
|
}
|
|
2354
2376
|
function findTopLevelTbls(el, out, depth = 0) {
|
|
2355
2377
|
if (depth > MAX_XML_DEPTH) return;
|
|
@@ -2395,11 +2417,13 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2395
2417
|
walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
|
|
2396
2418
|
tableCtx = completeTable(newTable, tableStack, blocks, ctx);
|
|
2397
2419
|
} else if (localTag === "caption" && !inShape) {
|
|
2398
|
-
const
|
|
2399
|
-
if (
|
|
2400
|
-
if (tableCtx?.cell) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text:
|
|
2401
|
-
else if (tableCtx)
|
|
2402
|
-
|
|
2420
|
+
const cap = collectSubListContent(el, ctx);
|
|
2421
|
+
if (cap.text) {
|
|
2422
|
+
if (tableCtx?.cell) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum }]);
|
|
2423
|
+
else if (tableCtx) {
|
|
2424
|
+
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
2425
|
+
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
2426
|
+
} else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
|
|
2403
2427
|
}
|
|
2404
2428
|
} else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
|
|
2405
2429
|
if (tableCtx?.cell) {
|
|
@@ -27125,8 +27149,17 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27125
27149
|
if (newLines.length === 0) return 0;
|
|
27126
27150
|
const target = cell2.paragraphs[0];
|
|
27127
27151
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
27128
|
-
const
|
|
27129
|
-
|
|
27152
|
+
const value = newLines.join(" ");
|
|
27153
|
+
const xml = ctx.scans[target.sectionIndex]?.xml;
|
|
27154
|
+
const rawT = xml ? paraTText(target, xml) : null;
|
|
27155
|
+
let sp;
|
|
27156
|
+
if (xml && rawT !== null && rawT.length > 0 && rawT.trim() === "") {
|
|
27157
|
+
sp = buildRangeSplices(target, xml, 0, 0, value);
|
|
27158
|
+
if (sp === null) return skip("\uBE48 \uC140 \uACF5\uBC31 \uBCF4\uC874 \uC0BD\uC785 \uACBD\uACC4 \uBAA8\uD638 \u2014 \uC6D0\uBB38 \uC190\uC2E4 \uBC29\uC9C0\uB85C \uBBF8\uC801\uC6A9");
|
|
27159
|
+
} else {
|
|
27160
|
+
sp = buildParagraphSplices(target, value, xml);
|
|
27161
|
+
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27162
|
+
}
|
|
27130
27163
|
splices.push(...sp);
|
|
27131
27164
|
sectionIndex = target.sectionIndex;
|
|
27132
27165
|
if (newLines.length > 1) {
|
|
@@ -30565,7 +30598,7 @@ async function parse(input, options) {
|
|
|
30565
30598
|
}
|
|
30566
30599
|
async function parseImage(buffer, options) {
|
|
30567
30600
|
try {
|
|
30568
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
30601
|
+
const { parseImageDocument } = await import("./image-ocr-ANSXR5KJ.js");
|
|
30569
30602
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
30570
30603
|
return {
|
|
30571
30604
|
success: true,
|
|
@@ -30623,7 +30656,7 @@ async function parseHwp(buffer, options) {
|
|
|
30623
30656
|
async function parsePdf(buffer, options) {
|
|
30624
30657
|
let parsePdfDocument;
|
|
30625
30658
|
try {
|
|
30626
|
-
const mod = await import("./parser-
|
|
30659
|
+
const mod = await import("./parser-BPVTYM5K.js");
|
|
30627
30660
|
parsePdfDocument = mod.parsePdfDocument;
|
|
30628
30661
|
} catch {
|
|
30629
30662
|
return {
|