kordoc 4.18.2 → 4.18.3
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/{-I3CP33G4.js → -WOKB25R2.js} +11 -11
- package/dist/{chunk-M4P7YS2N.js → chunk-2I2RTJJ5.js} +66 -36
- package/dist/chunk-2I2RTJJ5.js.map +1 -0
- package/dist/{chunk-QGFZU3JE.cjs → chunk-2ZBLQVAS.cjs} +10 -8
- package/dist/chunk-2ZBLQVAS.cjs.map +1 -0
- package/dist/{chunk-LSOD2A6N.js → chunk-3FZGL3IL.js} +2 -2
- package/dist/{chunk-NZM2SSI4.js → chunk-5X7XWYR2.js} +2 -2
- package/dist/{chunk-GM7XIZF2.js → chunk-6GLTGOP6.js} +2 -2
- package/dist/{chunk-6OKBTY72.js → chunk-AZQWESRH.js} +2 -2
- package/dist/{chunk-O2DI4GHD.js → chunk-BGOR5GCF.js} +2 -2
- package/dist/{chunk-L64QRUMK.js → chunk-BJ6RYYXV.js} +9 -6
- package/dist/chunk-BJ6RYYXV.js.map +1 -0
- package/dist/{chunk-N5DQFA7L.js → chunk-CAN5P6N6.js} +10 -5
- package/dist/chunk-CAN5P6N6.js.map +1 -0
- package/dist/{chunk-YNLW6EGU.cjs → chunk-HZV52V2X.cjs} +3 -3
- package/dist/{chunk-YNLW6EGU.cjs.map → chunk-HZV52V2X.cjs.map} +1 -1
- package/dist/{chunk-BL7KRE6X.js → chunk-IXX3WHIE.js} +3 -3
- package/dist/{chunk-OGAYGUJF.js → chunk-J2A46VCA.js} +8 -5
- package/dist/chunk-J2A46VCA.js.map +1 -0
- package/dist/{chunk-CKUIFTXJ.js → chunk-KSJ7GKNQ.js} +2 -2
- package/dist/{chunk-L5RLJPI3.js → chunk-NES5U4JK.js} +3 -3
- package/dist/{chunk-VSY5PAJ5.js → chunk-OOX2GZZ4.js} +2 -2
- package/dist/{chunk-B2E6C2LH.js → chunk-PSJLB3SZ.js} +6 -4
- package/dist/chunk-PSJLB3SZ.js.map +1 -0
- package/dist/{chunk-4B2EXELH.js → chunk-RDBTOE5X.js} +2 -2
- package/dist/{chunk-QP7IXF7R.js → chunk-RRURZDEK.js} +2 -2
- package/dist/{chunk-LACO375L.js → chunk-RSDUH4XF.js} +4 -3
- package/dist/chunk-RSDUH4XF.js.map +1 -0
- package/dist/{chunk-UZGZRGYM.cjs → chunk-SHRRD2TD.cjs} +10 -5
- package/dist/chunk-SHRRD2TD.cjs.map +1 -0
- package/dist/{chunk-F5HING4Y.js → chunk-UVUKT3IQ.js} +5 -4
- package/dist/chunk-UVUKT3IQ.js.map +1 -0
- package/dist/{chunk-W2YYBPW5.cjs → chunk-V4BKT65D.cjs} +3 -3
- package/dist/{chunk-W2YYBPW5.cjs.map → chunk-V4BKT65D.cjs.map} +1 -1
- package/dist/{chunk-OBILAVWC.js → chunk-VGDTONTB.js} +10 -5
- package/dist/chunk-VGDTONTB.js.map +1 -0
- package/dist/{chunk-IA3UKDHA.js → chunk-W3RADOLO.js} +3 -2
- package/dist/{chunk-IA3UKDHA.js.map → chunk-W3RADOLO.js.map} +1 -1
- package/dist/{chunk-C2CVOC5K.js → chunk-W7P4GPOV.js} +4 -4
- package/dist/{chunk-KDMAYOWH.cjs → chunk-WN5YLP7H.cjs} +26 -23
- package/dist/chunk-WN5YLP7H.cjs.map +1 -0
- package/dist/{chunk-OI5ZSSIC.cjs → chunk-ZD5WNQNC.cjs} +12 -12
- package/dist/{chunk-OI5ZSSIC.cjs.map → chunk-ZD5WNQNC.cjs.map} +1 -1
- package/dist/{chunk-T4MXCSBP.js → chunk-ZN3LHNJG.js} +49 -26
- package/dist/chunk-ZN3LHNJG.js.map +1 -0
- package/dist/chunks-OQDRDICD.js +10 -0
- package/dist/cli.js +55 -34
- package/dist/cli.js.map +1 -1
- package/dist/{formula-VY4ITOMN.cjs → formula-BQ5RW5XD.cjs} +9 -9
- package/dist/{formula-VY4ITOMN.cjs.map → formula-BQ5RW5XD.cjs.map} +1 -1
- package/dist/{formula-AQZODKZF.js → formula-GPCOJJXN.js} +3 -3
- package/dist/{formula-E3N7KDDG.js → formula-QZAOKPBX.js} +4 -4
- package/dist/{image-ocr-IMYXOHHV.js → image-ocr-POCME5I4.js} +6 -6
- package/dist/{image-ocr-LN3GSQPW.js → image-ocr-TWNNVTZS.js} +9 -9
- package/dist/{image-ocr-6LYEBMVR.cjs → image-ocr-VKIUBLBX.cjs} +15 -15
- package/dist/{image-ocr-6LYEBMVR.cjs.map → image-ocr-VKIUBLBX.cjs.map} +1 -1
- package/dist/index.cjs +800 -748
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +104 -52
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +26 -26
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-IHKNDLOT.js → model-bundle-THYUL7GG.js} +5 -5
- package/dist/{models-YXITRAMR.js → models-U22N4RXX.js} +5 -5
- package/dist/{parser-7KECZTTP.cjs → parser-JOMFOZLH.cjs} +211 -198
- package/dist/parser-JOMFOZLH.cjs.map +1 -0
- package/dist/{parser-KB4BYQBZ.js → parser-NKP2NCSV.js} +24 -11
- package/dist/parser-NKP2NCSV.js.map +1 -0
- package/dist/{parser-M3T2EWUN.js → parser-SCXRLOW7.js} +21 -8
- package/dist/parser-SCXRLOW7.js.map +1 -0
- package/dist/pdf-ocr-NF4AY5MI.cjs +16 -0
- package/dist/{pdf-ocr-IGYCZ7G2.cjs.map → pdf-ocr-NF4AY5MI.cjs.map} +1 -1
- package/dist/pdf-ocr-OLII3WAG.js +15 -0
- package/dist/pdf-ocr-VJL7ON2Q.js +19 -0
- package/dist/{profile-io-GQWQR7YQ.js → profile-io-UI3TZBYH.js} +3 -3
- package/dist/{rasterize-Y6TVFQ3M.js → rasterize-XMBV5H2I.js} +3 -3
- package/dist/{redact-doc-TRPZ3HNW.js → redact-doc-7ZZMHDBO.js} +11 -11
- package/dist/{render-GHT5HKBO.js → render-SWRTUDAV.js} +7 -7
- package/dist/seal-UKKJZHKE.js +10 -0
- package/dist/{setup-AGSCEHDB.js → setup-43JJEEU7.js} +3 -3
- package/dist/visual-D2563HCJ.js +20 -0
- package/dist/{watch-ALSEW4GB.js → watch-NRATQ472.js} +13 -13
- package/dist/watch-NRATQ472.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-B2E6C2LH.js.map +0 -1
- package/dist/chunk-F5HING4Y.js.map +0 -1
- package/dist/chunk-KDMAYOWH.cjs.map +0 -1
- package/dist/chunk-L64QRUMK.js.map +0 -1
- package/dist/chunk-LACO375L.js.map +0 -1
- package/dist/chunk-M4P7YS2N.js.map +0 -1
- package/dist/chunk-N5DQFA7L.js.map +0 -1
- package/dist/chunk-OBILAVWC.js.map +0 -1
- package/dist/chunk-OGAYGUJF.js.map +0 -1
- package/dist/chunk-QGFZU3JE.cjs.map +0 -1
- package/dist/chunk-T4MXCSBP.js.map +0 -1
- package/dist/chunk-UZGZRGYM.cjs.map +0 -1
- package/dist/chunks-IFFRC5IQ.js +0 -10
- package/dist/parser-7KECZTTP.cjs.map +0 -1
- package/dist/parser-KB4BYQBZ.js.map +0 -1
- package/dist/parser-M3T2EWUN.js.map +0 -1
- package/dist/pdf-ocr-4S2OAHUX.js +0 -15
- package/dist/pdf-ocr-IGYCZ7G2.cjs +0 -16
- package/dist/pdf-ocr-YEBFWU2K.js +0 -19
- package/dist/seal-3YTXSABW.js +0 -10
- package/dist/visual-R3E35Q2K.js +0 -20
- package/dist/watch-ALSEW4GB.js.map +0 -1
- /package/dist/{-I3CP33G4.js.map → -WOKB25R2.js.map} +0 -0
- /package/dist/{chunk-LSOD2A6N.js.map → chunk-3FZGL3IL.js.map} +0 -0
- /package/dist/{chunk-NZM2SSI4.js.map → chunk-5X7XWYR2.js.map} +0 -0
- /package/dist/{chunk-GM7XIZF2.js.map → chunk-6GLTGOP6.js.map} +0 -0
- /package/dist/{chunk-6OKBTY72.js.map → chunk-AZQWESRH.js.map} +0 -0
- /package/dist/{chunk-O2DI4GHD.js.map → chunk-BGOR5GCF.js.map} +0 -0
- /package/dist/{chunk-BL7KRE6X.js.map → chunk-IXX3WHIE.js.map} +0 -0
- /package/dist/{chunk-CKUIFTXJ.js.map → chunk-KSJ7GKNQ.js.map} +0 -0
- /package/dist/{chunk-L5RLJPI3.js.map → chunk-NES5U4JK.js.map} +0 -0
- /package/dist/{chunk-VSY5PAJ5.js.map → chunk-OOX2GZZ4.js.map} +0 -0
- /package/dist/{chunk-4B2EXELH.js.map → chunk-RDBTOE5X.js.map} +0 -0
- /package/dist/{chunk-QP7IXF7R.js.map → chunk-RRURZDEK.js.map} +0 -0
- /package/dist/{chunk-C2CVOC5K.js.map → chunk-W7P4GPOV.js.map} +0 -0
- /package/dist/{chunks-IFFRC5IQ.js.map → chunks-OQDRDICD.js.map} +0 -0
- /package/dist/{formula-AQZODKZF.js.map → formula-GPCOJJXN.js.map} +0 -0
- /package/dist/{formula-E3N7KDDG.js.map → formula-QZAOKPBX.js.map} +0 -0
- /package/dist/{image-ocr-IMYXOHHV.js.map → image-ocr-POCME5I4.js.map} +0 -0
- /package/dist/{image-ocr-LN3GSQPW.js.map → image-ocr-TWNNVTZS.js.map} +0 -0
- /package/dist/{model-bundle-IHKNDLOT.js.map → model-bundle-THYUL7GG.js.map} +0 -0
- /package/dist/{models-YXITRAMR.js.map → models-U22N4RXX.js.map} +0 -0
- /package/dist/{pdf-ocr-4S2OAHUX.js.map → pdf-ocr-OLII3WAG.js.map} +0 -0
- /package/dist/{pdf-ocr-YEBFWU2K.js.map → pdf-ocr-VJL7ON2Q.js.map} +0 -0
- /package/dist/{profile-io-GQWQR7YQ.js.map → profile-io-UI3TZBYH.js.map} +0 -0
- /package/dist/{rasterize-Y6TVFQ3M.js.map → rasterize-XMBV5H2I.js.map} +0 -0
- /package/dist/{redact-doc-TRPZ3HNW.js.map → redact-doc-7ZZMHDBO.js.map} +0 -0
- /package/dist/{render-GHT5HKBO.js.map → render-SWRTUDAV.js.map} +0 -0
- /package/dist/{seal-3YTXSABW.js.map → seal-UKKJZHKE.js.map} +0 -0
- /package/dist/{setup-AGSCEHDB.js.map → setup-43JJEEU7.js.map} +0 -0
- /package/dist/{visual-R3E35Q2K.js.map → visual-D2563HCJ.js.map} +0 -0
|
@@ -51,17 +51,17 @@ import {
|
|
|
51
51
|
unknownFontWarnings,
|
|
52
52
|
usesGaejosikMunche,
|
|
53
53
|
validateHwpx
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-2I2RTJJ5.js";
|
|
55
55
|
import {
|
|
56
56
|
blocksToPages
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-6GLTGOP6.js";
|
|
58
58
|
import {
|
|
59
59
|
applySplices,
|
|
60
60
|
buildParagraphSplices,
|
|
61
61
|
buildRangeSplices,
|
|
62
62
|
placeSealHwpx,
|
|
63
63
|
scanSectionXml
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-NES5U4JK.js";
|
|
65
65
|
import {
|
|
66
66
|
DEFAULT_REDACT_RULES,
|
|
67
67
|
redactMarkdown,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
} from "./chunk-3WSNLH4B.js";
|
|
70
70
|
import {
|
|
71
71
|
blocksToChunks
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RRURZDEK.js";
|
|
73
73
|
import {
|
|
74
74
|
SPACE_EM_FIXED,
|
|
75
75
|
SPACE_EM_FONT,
|
|
@@ -94,20 +94,20 @@ import {
|
|
|
94
94
|
renderSceneToHtml,
|
|
95
95
|
simulateWrap,
|
|
96
96
|
simulateWrapKeepWord
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-ZN3LHNJG.js";
|
|
98
98
|
import "./chunk-7FCNOKOR.js";
|
|
99
|
-
import "./chunk-
|
|
99
|
+
import "./chunk-UVUKT3IQ.js";
|
|
100
100
|
import "./chunk-VQFA55IC.js";
|
|
101
|
-
import "./chunk-
|
|
101
|
+
import "./chunk-RSDUH4XF.js";
|
|
102
102
|
import {
|
|
103
103
|
blocksToMarkdown,
|
|
104
104
|
flattenLayoutTables,
|
|
105
105
|
hasStructuredCellContent
|
|
106
|
-
} from "./chunk-
|
|
107
|
-
import "./chunk-
|
|
106
|
+
} from "./chunk-W3RADOLO.js";
|
|
107
|
+
import "./chunk-KSJ7GKNQ.js";
|
|
108
108
|
import {
|
|
109
109
|
VERSION
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-VGDTONTB.js";
|
|
111
111
|
export {
|
|
112
112
|
BUILTIN_TEMPLATES,
|
|
113
113
|
DEFAULT_REDACT_RULES,
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
usesGaejosikMunche,
|
|
199
199
|
validateHwpx
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=-
|
|
201
|
+
//# sourceMappingURL=-WOKB25R2.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6GLTGOP6.js";
|
|
5
5
|
import {
|
|
6
6
|
allLinesegRemovalSplices,
|
|
7
7
|
applySplices,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
paraTextPureT,
|
|
16
16
|
patchZipEntries,
|
|
17
17
|
scanSectionXml
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NES5U4JK.js";
|
|
19
19
|
import {
|
|
20
20
|
CONVERT_MAP,
|
|
21
21
|
FLAG_COMPRESSED,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
romanNumeral,
|
|
66
66
|
simulateWrap,
|
|
67
67
|
takeTocLeaders
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-ZN3LHNJG.js";
|
|
69
69
|
import {
|
|
70
70
|
CELL_EDGES,
|
|
71
71
|
HEADING_RATIO_H1,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
tidyScriptTags,
|
|
78
78
|
unframeLayoutTables,
|
|
79
79
|
wrapScript
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-UVUKT3IQ.js";
|
|
81
81
|
import {
|
|
82
82
|
parsePageRange
|
|
83
83
|
} from "./chunk-VQFA55IC.js";
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
findChildByLocalName,
|
|
97
97
|
localName,
|
|
98
98
|
rawTextContent
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-RSDUH4XF.js";
|
|
100
100
|
import {
|
|
101
101
|
MAX_COLS,
|
|
102
102
|
MAX_ROWS,
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
hasStructuredCellContent,
|
|
112
112
|
mapPuaText,
|
|
113
113
|
noteSuffix
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-W3RADOLO.js";
|
|
115
115
|
import {
|
|
116
116
|
KordocError,
|
|
117
117
|
classifyError,
|
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
escapeHtml,
|
|
120
120
|
isPathTraversal,
|
|
121
121
|
normalizeSectionHref,
|
|
122
|
+
partExtension,
|
|
122
123
|
precheckZipSize,
|
|
123
124
|
sanitizeError,
|
|
124
125
|
sanitizeHref,
|
|
@@ -126,7 +127,7 @@ import {
|
|
|
126
127
|
toArrayBuffer,
|
|
127
128
|
unescapeHtml,
|
|
128
129
|
unzipLimitBytes
|
|
129
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-VGDTONTB.js";
|
|
130
131
|
|
|
131
132
|
// src/table/visual.ts
|
|
132
133
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -632,7 +633,7 @@ function parseParaHeadings(doc, map) {
|
|
|
632
633
|
if (map.size > 0) break;
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
|
-
function detectHwpxHeadings(blocks, styleMap) {
|
|
636
|
+
function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
636
637
|
if (blocks.some((b) => b.type === "heading")) return;
|
|
637
638
|
let baseFontSize = 0;
|
|
638
639
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
@@ -649,7 +650,7 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
649
650
|
}
|
|
650
651
|
}
|
|
651
652
|
for (const block of blocks) {
|
|
652
|
-
if (block.type !== "paragraph" || !block.text || TOC_ENTRY_BLOCKS.has(block)) continue;
|
|
653
|
+
if (block.type !== "paragraph" || !block.text || TOC_ENTRY_BLOCKS.has(block) || tocTexts?.has(block.text.trim())) continue;
|
|
653
654
|
const text = block.text.trim();
|
|
654
655
|
if (text.length === 0 || text.length > 200 || /^\d+$/.test(text)) continue;
|
|
655
656
|
let level = 0;
|
|
@@ -1301,13 +1302,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1301
1302
|
}
|
|
1302
1303
|
if (tableCtx) tableStack.push(tableCtx);
|
|
1303
1304
|
const newTable = { rows: [], currentRow: [], cell: null, sourceId: el.getAttribute("id") ?? void 0 };
|
|
1304
|
-
walkSection(el, blocks, newTable, tableStack, ctx, depth + 1);
|
|
1305
|
+
inIndependentDeletionStory(ctx.shared.track, () => walkSection(el, blocks, newTable, tableStack, ctx, depth + 1));
|
|
1305
1306
|
tableCtx = completeTable(newTable, tableStack, blocks, ctx);
|
|
1306
1307
|
break;
|
|
1307
1308
|
}
|
|
1308
1309
|
// 표/도표 캡션 — IRTable.caption으로 보존 (v3.0, 기존 무음 드롭 수정)
|
|
1309
1310
|
case "caption": {
|
|
1310
|
-
const cap = collectSubListContent(el, ctx);
|
|
1311
|
+
const cap = inIndependentDeletionStory(ctx.shared.track, () => collectSubListContent(el, ctx));
|
|
1311
1312
|
if (cap.text) {
|
|
1312
1313
|
if (tableCtx) {
|
|
1313
1314
|
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
@@ -1367,6 +1368,9 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1367
1368
|
if (text) {
|
|
1368
1369
|
if (ph?.prefix) text = ph.prefix + " " + text;
|
|
1369
1370
|
headingLevel = tocEntry ? void 0 : ph?.headingLevel;
|
|
1371
|
+
if (tocEntry) {
|
|
1372
|
+
for (const line of text.split("\n")) if (line.trim()) ctx.shared.tocTexts.add(line.trim());
|
|
1373
|
+
}
|
|
1370
1374
|
}
|
|
1371
1375
|
if (segments) {
|
|
1372
1376
|
const cell2 = tableCtx?.cell ?? null;
|
|
@@ -1452,6 +1456,15 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1452
1456
|
if (spanMode !== "foreign" && el.getAttribute("paraPrIDRef") === KORDOC_PARA_QUOTE) block.quote = true;
|
|
1453
1457
|
}
|
|
1454
1458
|
if (!headingLevel && !block.spans && placeholderSpans) block.spans = withPrefixSpan(placeholderSpans, ph?.prefix);
|
|
1459
|
+
if (headingLevel && placeholderSpans) {
|
|
1460
|
+
const shown = withPrefixSpan(placeholderSpans.filter((s) => !s.placeholder), ph?.prefix).map((s) => s.text).join("").trim();
|
|
1461
|
+
if (shown) block.text = shown;
|
|
1462
|
+
else {
|
|
1463
|
+
block.type = "paragraph";
|
|
1464
|
+
delete block.level;
|
|
1465
|
+
block.spans = withPrefixSpan(placeholderSpans, ph?.prefix);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1455
1468
|
blocks.push(block);
|
|
1456
1469
|
} else {
|
|
1457
1470
|
blocks.push({ type: "paragraph", text, pageNumber: ctx.page });
|
|
@@ -1693,10 +1706,10 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1693
1706
|
}
|
|
1694
1707
|
if (tableCtx) tableStack.push(tableCtx);
|
|
1695
1708
|
const newTable = { rows: [], currentRow: [], cell: null, inline: isInlineTbl(el), sourceId: el.getAttribute("id") ?? void 0 };
|
|
1696
|
-
walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
|
|
1709
|
+
inIndependentDeletionStory(ctx.shared.track, () => walkSection(el, blocks, newTable, tableStack, ctx, d + 1));
|
|
1697
1710
|
tableCtx = completeTable(newTable, tableStack, blocks, ctx);
|
|
1698
1711
|
} else if (localTag === "caption" && !inShape) {
|
|
1699
|
-
const cap = collectSubListContent(el, ctx);
|
|
1712
|
+
const cap = inIndependentDeletionStory(ctx.shared.track, () => collectSubListContent(el, ctx));
|
|
1700
1713
|
if (cap.text) {
|
|
1701
1714
|
if (tableCtx?.cell) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.page }]);
|
|
1702
1715
|
else if (tableCtx) {
|
|
@@ -1892,7 +1905,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1892
1905
|
// 아니므로 방출하지 않는다
|
|
1893
1906
|
case "header":
|
|
1894
1907
|
case "footer": {
|
|
1895
|
-
if (!ctx) break;
|
|
1908
|
+
if (!ctx || isInDeletedRange(ctx)) break;
|
|
1896
1909
|
const t = collectSubListText(k, ctx);
|
|
1897
1910
|
if (t && hasPageAutoNum(k) && !/\p{L}/u.test(t)) break;
|
|
1898
1911
|
if (t) {
|
|
@@ -2014,9 +2027,10 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2014
2027
|
if (isInlineTbl(child)) text += "";
|
|
2015
2028
|
break;
|
|
2016
2029
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2030
|
+
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
2017
2031
|
case "checkBtn":
|
|
2018
2032
|
case "radioBtn":
|
|
2019
|
-
text += formButtonText(child, tag === "radioBtn");
|
|
2033
|
+
if (!isInDeletedRange(ctx)) text += formButtonText(child, tag === "radioBtn");
|
|
2020
2034
|
break;
|
|
2021
2035
|
// 하이퍼링크
|
|
2022
2036
|
case "hyperlink": {
|
|
@@ -2086,6 +2100,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2086
2100
|
// 스크립트가 담겨 있음. hml-equation-parser 로 LaTeX 변환 후 `$...$`
|
|
2087
2101
|
// 로 래핑. 실패/빈 스크립트면 무시 (대체 텍스트 누출 방지).
|
|
2088
2102
|
case "equation": {
|
|
2103
|
+
if (isInDeletedRange(ctx)) break;
|
|
2089
2104
|
const script = findChildByLocalName(child, "script");
|
|
2090
2105
|
const raw = script ? extractTextFromNode(script) : "";
|
|
2091
2106
|
if (raw.trim()) {
|
|
@@ -2656,7 +2671,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
2656
2671
|
applyPageText(blocks, shared);
|
|
2657
2672
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !options?.pages, shared.track.deletedImageRefs);
|
|
2658
2673
|
const shown = options?.layoutTables === "keep" ? blocks : unframeLayoutTables(blocks, !!options?.keepTrailingEmptyCols);
|
|
2659
|
-
detectHwpxHeadings(shown, styleMap);
|
|
2674
|
+
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
2660
2675
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
2661
2676
|
const markdown = blocksToMarkdown(shown);
|
|
2662
2677
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
@@ -15741,7 +15756,7 @@ function collectRichText(root) {
|
|
|
15741
15756
|
const el = children[i];
|
|
15742
15757
|
const local = el.localName || el.tagName?.replace(/^[^:]+:/, "") || "";
|
|
15743
15758
|
if (local === "rPh") continue;
|
|
15744
|
-
if (local === "t") out += escapeLiteralTags(el.textContent ?? "");
|
|
15759
|
+
if (local === "t") out += escapeLiteralTags(escapeLiteralDollar(el.textContent ?? ""));
|
|
15745
15760
|
else walk(el);
|
|
15746
15761
|
}
|
|
15747
15762
|
};
|
|
@@ -16365,14 +16380,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
16365
16380
|
const h = readCellHeader(rec.data);
|
|
16366
16381
|
if (h && rec.data.length >= 10) {
|
|
16367
16382
|
const isst = rec.data.readUInt32LE(6);
|
|
16368
|
-
cells.push({ row: h.row, col: h.col, value: escapeLiteralTags(sst[isst] ?? "") });
|
|
16383
|
+
cells.push({ row: h.row, col: h.col, value: escapeLiteralTags(escapeLiteralDollar(sst[isst] ?? "")) });
|
|
16369
16384
|
}
|
|
16370
16385
|
break;
|
|
16371
16386
|
}
|
|
16372
16387
|
case OP_LABEL: {
|
|
16373
16388
|
const h = readCellHeader(rec.data);
|
|
16374
16389
|
if (h) {
|
|
16375
|
-
cells.push({ row: h.row, col: h.col, value: escapeLiteralTags(decodeLabelString(rec.data)) });
|
|
16390
|
+
cells.push({ row: h.row, col: h.col, value: escapeLiteralTags(escapeLiteralDollar(decodeLabelString(rec.data))) });
|
|
16376
16391
|
}
|
|
16377
16392
|
break;
|
|
16378
16393
|
}
|
|
@@ -16388,7 +16403,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
16388
16403
|
cells.push({
|
|
16389
16404
|
row: h.row,
|
|
16390
16405
|
col: h.col,
|
|
16391
|
-
value: escapeLiteralTags(decodeFormulaStringRecord(next.data))
|
|
16406
|
+
value: escapeLiteralTags(escapeLiteralDollar(decodeFormulaStringRecord(next.data)))
|
|
16392
16407
|
});
|
|
16393
16408
|
i = j;
|
|
16394
16409
|
} else {
|
|
@@ -17100,6 +17115,7 @@ function isDisplayMath(el) {
|
|
|
17100
17115
|
// src/docx/parser.ts
|
|
17101
17116
|
var MAX_DECOMPRESS_SIZE4 = unzipLimitBytes(100 * 1024 * 1024);
|
|
17102
17117
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
17118
|
+
var NEVER_READ_RE = /^word\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
17103
17119
|
function matchesLocal(el, localName3) {
|
|
17104
17120
|
return el.localName === localName3 || (el.tagName?.endsWith(`:${localName3}`) ?? false);
|
|
17105
17121
|
}
|
|
@@ -17291,7 +17307,7 @@ function parseFootnotes(xml) {
|
|
|
17291
17307
|
const runs = findElements(p, "r");
|
|
17292
17308
|
for (const r of runs) {
|
|
17293
17309
|
const tElements = getChildElements(r, "t");
|
|
17294
|
-
for (const t of tElements) texts.push(escapeLiteralTags(t.textContent ?? ""));
|
|
17310
|
+
for (const t of tElements) texts.push(escapeLiteralTags(escapeLiteralDollar(t.textContent ?? "")));
|
|
17295
17311
|
}
|
|
17296
17312
|
}
|
|
17297
17313
|
notes.set(id, texts.join("").trim());
|
|
@@ -17322,7 +17338,7 @@ function collectOmmlRoots(p) {
|
|
|
17322
17338
|
function extractRun(r) {
|
|
17323
17339
|
let text = "";
|
|
17324
17340
|
for (const el of effectiveChildElements(r)) {
|
|
17325
|
-
if (matchesLocal(el, "t")) text += escapeLiteralTags(el.textContent ?? "");
|
|
17341
|
+
if (matchesLocal(el, "t")) text += escapeLiteralTags(escapeLiteralDollar(el.textContent ?? ""));
|
|
17326
17342
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
17327
17343
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
17328
17344
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -17618,7 +17634,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
17618
17634
|
let data = null;
|
|
17619
17635
|
if (readBytes) data = await imgFile.async("uint8array");
|
|
17620
17636
|
imgIdx++;
|
|
17621
|
-
const ext = imgPath
|
|
17637
|
+
const ext = partExtension(imgPath);
|
|
17622
17638
|
const mimeMap = {
|
|
17623
17639
|
png: "image/png",
|
|
17624
17640
|
jpg: "image/jpeg",
|
|
@@ -17717,7 +17733,7 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
17717
17733
|
}
|
|
17718
17734
|
async function parseDocxDocument(buffer, options) {
|
|
17719
17735
|
const readImages = options?.images !== false;
|
|
17720
|
-
precheckZipSize(buffer, MAX_DECOMPRESS_SIZE4, void 0, { re: MEDIA_PART_RE, skip: !readImages });
|
|
17736
|
+
precheckZipSize(buffer, MAX_DECOMPRESS_SIZE4, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
17721
17737
|
const zip = await JSZip4.loadAsync(buffer);
|
|
17722
17738
|
const warnings = [];
|
|
17723
17739
|
const docFile = zip.file("word/document.xml");
|
|
@@ -17838,6 +17854,7 @@ import JSZip5 from "jszip";
|
|
|
17838
17854
|
import { DOMParser as DOMParser3 } from "@xmldom/xmldom";
|
|
17839
17855
|
var MAX_DECOMPRESS_SIZE5 = unzipLimitBytes(100 * 1024 * 1024);
|
|
17840
17856
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
17857
|
+
var NEVER_READ_RE2 = /^ppt\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
17841
17858
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
17842
17859
|
var MAX_SLIDES = 2e3;
|
|
17843
17860
|
var SKIP_PLACEHOLDERS = /* @__PURE__ */ new Set(["sldNum", "dt", "ftr", "hdr", "sldImg"]);
|
|
@@ -17934,12 +17951,14 @@ function paragraphText(p) {
|
|
|
17934
17951
|
const name = localName(child);
|
|
17935
17952
|
if (name === "r" || name === "fld") {
|
|
17936
17953
|
const t = findChildByLocalName(child, "t");
|
|
17937
|
-
|
|
17954
|
+
const rPr = findChildByLocalName(child, "rPr");
|
|
17955
|
+
const baseline = Number(rPr ? getAttr2(rPr, "baseline") ?? 0 : 0);
|
|
17956
|
+
if (t) text += wrapScript(escapeLiteralTags(escapeLiteralDollar(rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
17938
17957
|
} else if (name === "br") {
|
|
17939
17958
|
text += " ";
|
|
17940
17959
|
}
|
|
17941
17960
|
}
|
|
17942
|
-
return text.replace(/\s+/g, " ").trim();
|
|
17961
|
+
return tidyScriptTags(text.replace(/\s+/g, " ").trim());
|
|
17943
17962
|
}
|
|
17944
17963
|
function bodyParagraphs(txBody) {
|
|
17945
17964
|
const out = [];
|
|
@@ -18013,7 +18032,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
18013
18032
|
if (!filename) {
|
|
18014
18033
|
const file = ctx.zip.file(rel.target);
|
|
18015
18034
|
if (!file) return null;
|
|
18016
|
-
const ext = rel.target
|
|
18035
|
+
const ext = partExtension(rel.target);
|
|
18017
18036
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
18018
18037
|
try {
|
|
18019
18038
|
if (ctx.options?.images !== false) {
|
|
@@ -18091,7 +18110,7 @@ async function notesText(zip, rels) {
|
|
|
18091
18110
|
return texts.join(" ");
|
|
18092
18111
|
}
|
|
18093
18112
|
async function parsePptxDocument(buffer, options) {
|
|
18094
|
-
precheckZipSize(buffer, MAX_DECOMPRESS_SIZE5, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: options?.images === false });
|
|
18113
|
+
precheckZipSize(buffer, MAX_DECOMPRESS_SIZE5, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: options?.images === false, never: NEVER_READ_RE2 });
|
|
18095
18114
|
const zip = await JSZip5.loadAsync(buffer);
|
|
18096
18115
|
if (!zip.file("ppt/presentation.xml")) {
|
|
18097
18116
|
throw new KordocError("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
@@ -18101,8 +18120,10 @@ async function parsePptxDocument(buffer, options) {
|
|
|
18101
18120
|
const imageNames = /* @__PURE__ */ new Map();
|
|
18102
18121
|
const images = [];
|
|
18103
18122
|
const slides = await slideParts(zip);
|
|
18123
|
+
const pageFilter = options?.pages ? parsePageRange(options.pages, slides.length) : null;
|
|
18104
18124
|
for (let i = 0; i < slides.length; i++) {
|
|
18105
18125
|
const page = i + 1;
|
|
18126
|
+
if (pageFilter && !pageFilter.has(page)) continue;
|
|
18106
18127
|
const root = parseXml3(await zip.file(slides[i]).async("text")).documentElement;
|
|
18107
18128
|
if (getAttr2(root, "show") === "0") {
|
|
18108
18129
|
warnings.push({ page, code: "HIDDEN_TEXT_FILTERED", message: `PPTX \uC228\uAE34 \uC2AC\uB77C\uC774\uB4DC ${page}\uCABD\uC744 \uAC74\uB108\uB701\uB2C8\uB2E4` });
|
|
@@ -22687,7 +22708,7 @@ function sanitizeText(text) {
|
|
|
22687
22708
|
return result;
|
|
22688
22709
|
}
|
|
22689
22710
|
function normForMatch(text) {
|
|
22690
|
-
return sanitizeText(text.replace(/\\\$/g, "$")).replace(/\s+/g, " ").trim();
|
|
22711
|
+
return sanitizeText(text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
22691
22712
|
}
|
|
22692
22713
|
function unescapeGfm(text) {
|
|
22693
22714
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -29090,6 +29111,10 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
29090
29111
|
const parsed = await parseHwpxDocument(u8ToArrayBuffer(original), { layoutTables: "keep" });
|
|
29091
29112
|
origBlocks = parsed.blocks;
|
|
29092
29113
|
const visual = await parseHwpxDocument(u8ToArrayBuffer(original));
|
|
29114
|
+
if (parsed.markdown !== visual.markdown && editedMarkdown === visual.markdown) {
|
|
29115
|
+
const verification2 = options?.verify === false ? void 0 : diffUnitLists(splitMarkdownUnits(visual.markdown), splitMarkdownUnits(editedMarkdown));
|
|
29116
|
+
return { success: true, data: new Uint8Array(original), applied: 0, skipped, verification: verification2 };
|
|
29117
|
+
}
|
|
29093
29118
|
if (editedFromVisual(parsed.markdown, visual.markdown, editedMarkdown)) return { success: false, applied: 0, skipped, error: LAYOUT_MODE_MISMATCH };
|
|
29094
29119
|
} catch (err) {
|
|
29095
29120
|
return { success: false, applied: 0, skipped, error: `\uC6D0\uBCF8 HWPX \uD30C\uC2F1 \uC2E4\uD328: ${err instanceof Error ? err.message : String(err)}` };
|
|
@@ -30006,9 +30031,12 @@ async function parse(input, options) {
|
|
|
30006
30031
|
}
|
|
30007
30032
|
if (result.success && opts?.classifyTables) classifyTableTree(result.blocks);
|
|
30008
30033
|
let out = result;
|
|
30009
|
-
if (result.success &&
|
|
30010
|
-
|
|
30011
|
-
|
|
30034
|
+
if (result.success && opts?.pages && result.pageCount && parsePageRange(opts.pages, result.pageCount).size === 0) {
|
|
30035
|
+
out = { ...result, warnings: [...result.warnings ?? [], { code: "PARTIAL_PARSE", message: `\uC694\uCCAD\uD55C \uCABD \uBC94\uC704(${opts.pages})\uAC00 \uBB38\uC11C \uCABD(1~${result.pageCount})\uACFC \uACB9\uCE58\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4` }] };
|
|
30036
|
+
}
|
|
30037
|
+
if (out.success && !out.pages) {
|
|
30038
|
+
const pages = blocksToPages(out.blocks);
|
|
30039
|
+
if (pages) out = { ...out, pages };
|
|
30012
30040
|
}
|
|
30013
30041
|
if (out.success && opts?.plain) {
|
|
30014
30042
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
@@ -30060,7 +30088,7 @@ function scriptsOff(r, off) {
|
|
|
30060
30088
|
}
|
|
30061
30089
|
async function parseImage(buffer, options) {
|
|
30062
30090
|
try {
|
|
30063
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
30091
|
+
const { parseImageDocument } = await import("./image-ocr-TWNNVTZS.js");
|
|
30064
30092
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
30065
30093
|
stripScriptTags({ blocks });
|
|
30066
30094
|
return {
|
|
@@ -30120,7 +30148,7 @@ async function parseHwp(buffer, options) {
|
|
|
30120
30148
|
async function parsePdf(buffer, options) {
|
|
30121
30149
|
let parsePdfDocument;
|
|
30122
30150
|
try {
|
|
30123
|
-
const mod = await import("./parser-
|
|
30151
|
+
const mod = await import("./parser-NKP2NCSV.js");
|
|
30124
30152
|
parsePdfDocument = mod.parsePdfDocument;
|
|
30125
30153
|
} catch {
|
|
30126
30154
|
return {
|
|
@@ -30165,7 +30193,7 @@ async function parseDocx(buffer, options) {
|
|
|
30165
30193
|
async function parsePptx(buffer, options) {
|
|
30166
30194
|
try {
|
|
30167
30195
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
30168
|
-
return { success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount };
|
|
30196
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
|
|
30169
30197
|
} catch (err) {
|
|
30170
30198
|
return { success: false, fileType: "pptx", error: sanitizeError(err), code: classifyError(err) };
|
|
30171
30199
|
}
|
|
@@ -30285,6 +30313,8 @@ async function extractTables(input, options = {}) {
|
|
|
30285
30313
|
}
|
|
30286
30314
|
|
|
30287
30315
|
export {
|
|
30316
|
+
toPlainMarkdown,
|
|
30317
|
+
toHtmlTables,
|
|
30288
30318
|
extractHwpxMetadataOnly,
|
|
30289
30319
|
formatFillValue,
|
|
30290
30320
|
ValueCursor,
|
|
@@ -30341,4 +30371,4 @@ export {
|
|
|
30341
30371
|
parseHwpml,
|
|
30342
30372
|
fillForm
|
|
30343
30373
|
};
|
|
30344
|
-
//# sourceMappingURL=chunk-
|
|
30374
|
+
//# sourceMappingURL=chunk-2I2RTJJ5.js.map
|