kordoc 4.16.1 → 4.16.2
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 +6 -7
- package/dist/{-3DURLXSO.js → -4G6MA4X6.js} +11 -11
- package/dist/chunk-3IB7LBHC.js +57 -0
- package/dist/chunk-3IB7LBHC.js.map +1 -0
- package/dist/{chunk-EEVAPRPD.js → chunk-4VODJKFL.js} +3 -3
- package/dist/{chunk-NCXRSQNE.js → chunk-5KS5PWJR.js} +2 -2
- package/dist/chunk-62W7QCEX.cjs +57 -0
- package/dist/chunk-62W7QCEX.cjs.map +1 -0
- package/dist/{chunk-ANZTLTKU.js → chunk-7KNGSQU7.js} +4 -4
- package/dist/chunk-7KNGSQU7.js.map +1 -0
- package/dist/{chunk-63YGGAQW.js → chunk-AUWGDP4G.js} +2 -2
- package/dist/{chunk-2BZFKIRB.cjs → chunk-CEIATRDW.cjs} +3 -3
- package/dist/{chunk-2BZFKIRB.cjs.map → chunk-CEIATRDW.cjs.map} +1 -1
- package/dist/{chunk-BIHS4VWR.js → chunk-DES2LGFZ.js} +2 -2
- package/dist/{chunk-N65ZXWNQ.js → chunk-F4NRLLY4.js} +2 -2
- package/dist/{chunk-NV37CQFN.cjs → chunk-FKUDAIJI.cjs} +12 -12
- package/dist/{chunk-NV37CQFN.cjs.map → chunk-FKUDAIJI.cjs.map} +1 -1
- package/dist/{chunk-VCRBR72A.js → chunk-GO5IFOUF.js} +2 -2
- package/dist/{chunk-BTO7ZEE4.js → chunk-IQGIT2VX.js} +37 -7
- package/dist/chunk-IQGIT2VX.js.map +1 -0
- package/dist/chunk-J3IF6KGW.js +59 -0
- package/dist/chunk-J3IF6KGW.js.map +1 -0
- package/dist/{chunk-VNOQTDTE.js → chunk-JELRWAZC.js} +2 -2
- package/dist/{chunk-CXWWX6BQ.js → chunk-JFLAM3MM.js} +2 -2
- package/dist/{chunk-7XAGIPOX.js → chunk-KIOQ4N37.js} +2 -2
- package/dist/{chunk-UZHT3LBF.js → chunk-LEIAEWZ7.js} +4 -4
- package/dist/chunk-LEIAEWZ7.js.map +1 -0
- package/dist/{chunk-NUPXPKIQ.js → chunk-MLIS253L.js} +2 -2
- package/dist/{chunk-DJ2BBQ5P.js → chunk-OXLPVQYK.js} +3 -3
- package/dist/{chunk-3VLVNKJV.js → chunk-P6ZDXTV6.js} +2 -2
- package/dist/{chunk-OBRPYCIS.js → chunk-QOCS7W7R.js} +58 -23
- package/dist/chunk-QOCS7W7R.js.map +1 -0
- package/dist/{chunk-24N4IJ5I.js → chunk-S2PL227Q.js} +2 -2
- package/dist/{chunk-PVMROO3A.js → chunk-SFEQYKYJ.js} +86 -94
- package/dist/chunk-SFEQYKYJ.js.map +1 -0
- package/dist/{chunk-YRRBA4HW.cjs → chunk-STM3ORY7.cjs} +2 -2
- package/dist/{chunk-YRRBA4HW.cjs.map → chunk-STM3ORY7.cjs.map} +1 -1
- package/dist/{chunk-7FKPPIDZ.js → chunk-TXUKTOG2.js} +166 -14
- package/dist/chunk-TXUKTOG2.js.map +1 -0
- package/dist/{chunk-3WIQSM3Z.js → chunk-UTP2WCHS.js} +4 -4
- package/dist/{chunk-7IRHSRPU.cjs → chunk-WDQTFAXY.cjs} +97 -25
- package/dist/chunk-WDQTFAXY.cjs.map +1 -0
- package/dist/{chunk-D2QCXK2X.cjs → chunk-XTFN5WKS.cjs} +7 -7
- package/dist/chunk-XTFN5WKS.cjs.map +1 -0
- package/dist/chunks-NUNIKS2J.js +10 -0
- package/dist/cli.js +28 -27
- package/dist/cli.js.map +1 -1
- package/dist/{formula-IPLFHEBD.js → formula-EPKLPDU7.js} +3 -3
- package/dist/{formula-U4BTEZ6I.js → formula-NARUOXRX.js} +4 -4
- package/dist/{formula-TRTONZMA.cjs → formula-WIMV5TUX.cjs} +9 -9
- package/dist/{formula-TRTONZMA.cjs.map → formula-WIMV5TUX.cjs.map} +1 -1
- package/dist/{image-ocr-3IJ25PS4.js → image-ocr-3WJ4QH3T.js} +8 -8
- package/dist/{image-ocr-GTDG4SAJ.js → image-ocr-5BUJQ4TK.js} +6 -6
- package/dist/{image-ocr-THFLQ3DC.cjs → image-ocr-AXWXR6JV.cjs} +15 -15
- package/dist/{image-ocr-THFLQ3DC.cjs.map → image-ocr-AXWXR6JV.cjs.map} +1 -1
- package/dist/index.cjs +723 -659
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +82 -18
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +25 -23
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-PVWIAVEX.js → model-bundle-IMBW7D2Z.js} +5 -5
- package/dist/{models-VCRF3JMT.js → models-SY75IBOE.js} +5 -5
- package/dist/{parser-2CN2DIPV.cjs → parser-2LU4EVU3.cjs} +86 -83
- package/dist/parser-2LU4EVU3.cjs.map +1 -0
- package/dist/{parser-T4RITZDP.js → parser-N6476XAC.js} +15 -12
- package/dist/{parser-UEROAPYZ.js.map → parser-N6476XAC.js.map} +1 -1
- package/dist/{parser-UEROAPYZ.js → parser-ZQM3664Z.js} +12 -9
- package/dist/{parser-T4RITZDP.js.map → parser-ZQM3664Z.js.map} +1 -1
- package/dist/pdf-ocr-6DEE23IP.js +15 -0
- package/dist/pdf-ocr-GHEJVPX2.cjs +16 -0
- package/dist/{pdf-ocr-NARV2AQI.cjs.map → pdf-ocr-GHEJVPX2.cjs.map} +1 -1
- package/dist/pdf-ocr-MQTWODVU.js +18 -0
- package/dist/{profile-io-YD54CDXY.js → profile-io-GJPKCYPT.js} +3 -3
- package/dist/{rasterize-3THYOOUN.js → rasterize-UOALJQDS.js} +3 -3
- package/dist/{redact-doc-65L2YJN6.js → redact-doc-22SYW3KH.js} +11 -11
- package/dist/{render-YU7QJVZ7.js → render-MJ4H3R23.js} +7 -7
- package/dist/seal-XWMRUTI4.js +10 -0
- package/dist/{setup-CFHKXDY4.js → setup-2URYVUEO.js} +3 -3
- package/dist/visual-USPS4QRC.js +20 -0
- package/dist/{watch-D6FCAYKJ.js → watch-ALXZGTOB.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-7FKPPIDZ.js.map +0 -1
- package/dist/chunk-7IRHSRPU.cjs.map +0 -1
- package/dist/chunk-ANZTLTKU.js.map +0 -1
- package/dist/chunk-BTO7ZEE4.js.map +0 -1
- package/dist/chunk-D2QCXK2X.cjs.map +0 -1
- package/dist/chunk-DO74GYSM.cjs +0 -11
- package/dist/chunk-DO74GYSM.cjs.map +0 -1
- package/dist/chunk-KBAQLAEL.js +0 -11
- package/dist/chunk-KBAQLAEL.js.map +0 -1
- package/dist/chunk-OBRPYCIS.js.map +0 -1
- package/dist/chunk-PVMROO3A.js.map +0 -1
- package/dist/chunk-T77M2QP7.js +0 -13
- package/dist/chunk-T77M2QP7.js.map +0 -1
- package/dist/chunk-UZHT3LBF.js.map +0 -1
- package/dist/chunks-PYYQURNO.js +0 -10
- package/dist/parser-2CN2DIPV.cjs.map +0 -1
- package/dist/pdf-ocr-NARV2AQI.cjs +0 -16
- package/dist/pdf-ocr-SYLMM727.js +0 -18
- package/dist/pdf-ocr-YMQZDJBO.js +0 -15
- package/dist/seal-6CQGFTML.js +0 -10
- package/dist/visual-ED2H75Q5.js +0 -20
- /package/dist/{-3DURLXSO.js.map → -4G6MA4X6.js.map} +0 -0
- /package/dist/{chunk-EEVAPRPD.js.map → chunk-4VODJKFL.js.map} +0 -0
- /package/dist/{chunk-NCXRSQNE.js.map → chunk-5KS5PWJR.js.map} +0 -0
- /package/dist/{chunk-63YGGAQW.js.map → chunk-AUWGDP4G.js.map} +0 -0
- /package/dist/{chunk-BIHS4VWR.js.map → chunk-DES2LGFZ.js.map} +0 -0
- /package/dist/{chunk-N65ZXWNQ.js.map → chunk-F4NRLLY4.js.map} +0 -0
- /package/dist/{chunk-VCRBR72A.js.map → chunk-GO5IFOUF.js.map} +0 -0
- /package/dist/{chunk-VNOQTDTE.js.map → chunk-JELRWAZC.js.map} +0 -0
- /package/dist/{chunk-CXWWX6BQ.js.map → chunk-JFLAM3MM.js.map} +0 -0
- /package/dist/{chunk-7XAGIPOX.js.map → chunk-KIOQ4N37.js.map} +0 -0
- /package/dist/{chunk-NUPXPKIQ.js.map → chunk-MLIS253L.js.map} +0 -0
- /package/dist/{chunk-DJ2BBQ5P.js.map → chunk-OXLPVQYK.js.map} +0 -0
- /package/dist/{chunk-3VLVNKJV.js.map → chunk-P6ZDXTV6.js.map} +0 -0
- /package/dist/{chunk-24N4IJ5I.js.map → chunk-S2PL227Q.js.map} +0 -0
- /package/dist/{chunk-3WIQSM3Z.js.map → chunk-UTP2WCHS.js.map} +0 -0
- /package/dist/{chunks-PYYQURNO.js.map → chunks-NUNIKS2J.js.map} +0 -0
- /package/dist/{formula-IPLFHEBD.js.map → formula-EPKLPDU7.js.map} +0 -0
- /package/dist/{formula-U4BTEZ6I.js.map → formula-NARUOXRX.js.map} +0 -0
- /package/dist/{image-ocr-3IJ25PS4.js.map → image-ocr-3WJ4QH3T.js.map} +0 -0
- /package/dist/{image-ocr-GTDG4SAJ.js.map → image-ocr-5BUJQ4TK.js.map} +0 -0
- /package/dist/{model-bundle-PVWIAVEX.js.map → model-bundle-IMBW7D2Z.js.map} +0 -0
- /package/dist/{models-VCRF3JMT.js.map → models-SY75IBOE.js.map} +0 -0
- /package/dist/{pdf-ocr-SYLMM727.js.map → pdf-ocr-6DEE23IP.js.map} +0 -0
- /package/dist/{pdf-ocr-YMQZDJBO.js.map → pdf-ocr-MQTWODVU.js.map} +0 -0
- /package/dist/{profile-io-YD54CDXY.js.map → profile-io-GJPKCYPT.js.map} +0 -0
- /package/dist/{rasterize-3THYOOUN.js.map → rasterize-UOALJQDS.js.map} +0 -0
- /package/dist/{redact-doc-65L2YJN6.js.map → redact-doc-22SYW3KH.js.map} +0 -0
- /package/dist/{render-YU7QJVZ7.js.map → render-MJ4H3R23.js.map} +0 -0
- /package/dist/{seal-6CQGFTML.js.map → seal-XWMRUTI4.js.map} +0 -0
- /package/dist/{setup-CFHKXDY4.js.map → setup-2URYVUEO.js.map} +0 -0
- /package/dist/{visual-ED2H75Q5.js.map → visual-USPS4QRC.js.map} +0 -0
- /package/dist/{watch-D6FCAYKJ.js.map → watch-ALXZGTOB.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AUWGDP4G.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-4VODJKFL.js";
|
|
19
19
|
import {
|
|
20
20
|
CONVERT_MAP,
|
|
21
21
|
FLAG_COMPRESSED,
|
|
@@ -61,12 +61,16 @@ import {
|
|
|
61
61
|
renderDocumentToScene,
|
|
62
62
|
romanNumeral,
|
|
63
63
|
simulateWrap
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-IQGIT2VX.js";
|
|
65
65
|
import {
|
|
66
66
|
HEADING_RATIO_H1,
|
|
67
67
|
HEADING_RATIO_H2,
|
|
68
|
-
HEADING_RATIO_H3
|
|
69
|
-
|
|
68
|
+
HEADING_RATIO_H3,
|
|
69
|
+
plainScripts,
|
|
70
|
+
stripScriptTags,
|
|
71
|
+
tidyScriptTags,
|
|
72
|
+
wrapScript
|
|
73
|
+
} from "./chunk-J3IF6KGW.js";
|
|
70
74
|
import {
|
|
71
75
|
parsePageRange
|
|
72
76
|
} from "./chunk-VQFA55IC.js";
|
|
@@ -85,7 +89,7 @@ import {
|
|
|
85
89
|
findChildByLocalName,
|
|
86
90
|
localName,
|
|
87
91
|
rawTextContent
|
|
88
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-JFLAM3MM.js";
|
|
89
93
|
import {
|
|
90
94
|
MAX_COLS,
|
|
91
95
|
MAX_ROWS,
|
|
@@ -100,7 +104,7 @@ import {
|
|
|
100
104
|
hasStructuredCellContent,
|
|
101
105
|
mapPuaText,
|
|
102
106
|
noteSuffix
|
|
103
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-LEIAEWZ7.js";
|
|
104
108
|
import {
|
|
105
109
|
KordocError,
|
|
106
110
|
classifyError,
|
|
@@ -115,20 +119,20 @@ import {
|
|
|
115
119
|
toArrayBuffer,
|
|
116
120
|
unescapeHtml,
|
|
117
121
|
unzipLimitBytes
|
|
118
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-P6ZDXTV6.js";
|
|
119
123
|
|
|
120
124
|
// src/table/visual.ts
|
|
121
125
|
import { readFile as readFile2 } from "fs/promises";
|
|
122
126
|
|
|
123
127
|
// src/plain-markdown.ts
|
|
124
128
|
function toPlainMarkdown(md) {
|
|
125
|
-
return md.replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").replace(/<img\b[^>]*>/gi, "").replace(/(?<!!)\[([^\]\n]*)\]\((?:https?|mailto|ftp):[^)\s]*\)/g, "$1").replace(/<\/?u>/g, "").replace(/(?<!\\)\*\*(?=\S)([^\n]*?\S)(?<!\\)\*\*/g, "$1").replace(/(<br>)+(?=<\/t[dh]>)/g, "").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
129
|
+
return plainScripts(md).replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").replace(/<img\b[^>]*>/gi, "").replace(/(?<!!)\[([^\]\n]*)\]\((?:https?|mailto|ftp):[^)\s]*\)/g, "$1").replace(/<\/?u>/g, "").replace(/(?<!\\)\*\*(?=\S)([^\n]*?\S)(?<!\\)\*\*/g, "$1").replace(/(<br>)+(?=<\/t[dh]>)/g, "").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
// src/html-tables.ts
|
|
129
133
|
var TABLE_TAG = /(<\/?(?:table|tr|th|td)\b[^>]*>)/i;
|
|
130
134
|
function pipeCellToHtml(cell2) {
|
|
131
|
-
return cell2.split(/(<br>|<\/?u>|<img\b[^>]*>)/).map((part, i) => i % 2 ? part : part.replace(/\\([\\`*_{}[\]()#+\-.!|~<>$])/g, "$1").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")).join("");
|
|
135
|
+
return cell2.split(/(<br>|<\/?(?:u|sup|sub)>|<img\b[^>]*>)/).map((part, i) => i % 2 ? part : part.replace(/\\([\\`*_{}[\]()#+\-.!|~<>$])/g, "$1").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")).join("");
|
|
132
136
|
}
|
|
133
137
|
function splitPipeRow(line) {
|
|
134
138
|
const t = line.trim().replace(/^\|/, "").replace(/(?<!\\)\|$/, "");
|
|
@@ -476,7 +480,9 @@ function parseCharProperties(doc, map) {
|
|
|
476
480
|
else if (localTag === "strikeout") {
|
|
477
481
|
const shape = k.getAttribute("shape") || "";
|
|
478
482
|
if (isRealStrikeShape(shape)) prop.strike = true;
|
|
479
|
-
} else if (localTag === "
|
|
483
|
+
} else if (localTag === "supscript") prop.script = "sup";
|
|
484
|
+
else if (localTag === "subscript") prop.script = "sub";
|
|
485
|
+
else if (localTag === "underline") {
|
|
480
486
|
if (k.getAttribute("type") === "BOTTOM") prop.underline = true;
|
|
481
487
|
}
|
|
482
488
|
}
|
|
@@ -1039,6 +1045,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1039
1045
|
const span = { text };
|
|
1040
1046
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
|
|
1041
1047
|
else {
|
|
1048
|
+
if (cp?.script) span.text = wrapScript(text, cp.script);
|
|
1042
1049
|
if (cp?.bold) span.bold = true;
|
|
1043
1050
|
if (cp?.italic) span.italic = true;
|
|
1044
1051
|
if (cp?.strike) span.strike = true;
|
|
@@ -1058,6 +1065,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1058
1065
|
}
|
|
1059
1066
|
}
|
|
1060
1067
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
1068
|
+
for (const s of merged) s.text = tidyScriptTags(s.text);
|
|
1061
1069
|
return merged;
|
|
1062
1070
|
}
|
|
1063
1071
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -1707,6 +1715,16 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
1707
1715
|
function isInDeletedRange(ctx) {
|
|
1708
1716
|
return (ctx?.shared.track.deleteDepth ?? 0) > 0;
|
|
1709
1717
|
}
|
|
1718
|
+
function runHasOnlyText(run) {
|
|
1719
|
+
const kids = run.childNodes;
|
|
1720
|
+
for (let i = 0; i < (kids?.length ?? 0); i++) {
|
|
1721
|
+
const k = kids[i];
|
|
1722
|
+
if (k.nodeType !== 1) continue;
|
|
1723
|
+
const t = (k.tagName || k.localName || "").replace(/^[^:]+:/, "");
|
|
1724
|
+
if (t !== "t" && t !== "linesegarray") return false;
|
|
1725
|
+
}
|
|
1726
|
+
return true;
|
|
1727
|
+
}
|
|
1710
1728
|
function extractParagraphInfo(para2, styleMap, ctx) {
|
|
1711
1729
|
let text = "";
|
|
1712
1730
|
let href;
|
|
@@ -1963,11 +1981,19 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1963
1981
|
}
|
|
1964
1982
|
break;
|
|
1965
1983
|
}
|
|
1966
|
-
// run
|
|
1967
|
-
|
|
1984
|
+
// run 요소 — hp:r 은 charPrIDRef 를 문단 대표 스타일로. 첨자 글자 모양이면 이 run 이 더한 글을 <sup>·<sub> 로
|
|
1985
|
+
// (개체·각주 등 컨트롤을 품은 run·필드 경계가 걸친 run 은 글 위치가 섞여 감싸지 않는다)
|
|
1986
|
+
case "r":
|
|
1987
|
+
case "run": {
|
|
1968
1988
|
const runCharPr = child.getAttribute("charPrIDRef");
|
|
1969
|
-
if (runCharPr && !charPrId) charPrId = runCharPr;
|
|
1989
|
+
if (tag === "r" && runCharPr && !charPrId) charPrId = runCharPr;
|
|
1990
|
+
const script = runCharPr ? styleMap?.charProperties.get(runCharPr)?.script : void 0;
|
|
1991
|
+
const start = text.length, nLinks = linkRanges.length, nOpen = openFields.length;
|
|
1970
1992
|
walk(child, depth + 1);
|
|
1993
|
+
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
1994
|
+
const added = text.slice(start);
|
|
1995
|
+
if (added && !/[\x1E\x1F\n$]/.test(added)) text = text.slice(0, start) + wrapScript(added, script);
|
|
1996
|
+
}
|
|
1971
1997
|
break;
|
|
1972
1998
|
}
|
|
1973
1999
|
default:
|
|
@@ -1991,6 +2017,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1991
2017
|
}
|
|
1992
2018
|
const leaderIdx = text.indexOf("");
|
|
1993
2019
|
if (leaderIdx >= 0) text = text.substring(0, leaderIdx);
|
|
2020
|
+
text = tidyScriptTags(text);
|
|
1994
2021
|
const cleanParaText = (raw) => {
|
|
1995
2022
|
let t = raw.replace(/[ \t]+/g, " ").trim();
|
|
1996
2023
|
if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(t)) t = "";
|
|
@@ -17157,6 +17184,9 @@ function extractRun(r) {
|
|
|
17157
17184
|
if (rPrEls.length > 0) {
|
|
17158
17185
|
bold = getChildElements(rPrEls[0], "b").length > 0;
|
|
17159
17186
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
17187
|
+
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
17188
|
+
const v = va ? getAttr(va, "val") : null;
|
|
17189
|
+
if (v === "superscript" || v === "subscript") text = wrapScript(text, v === "superscript" ? "sup" : "sub");
|
|
17160
17190
|
}
|
|
17161
17191
|
return { text, bold, italic };
|
|
17162
17192
|
}
|
|
@@ -17254,7 +17284,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
17254
17284
|
if (isDisplayMath(om)) parts.push(" $$" + latex + "$$ ");
|
|
17255
17285
|
else parts.push(" $" + latex + "$ ");
|
|
17256
17286
|
}
|
|
17257
|
-
const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
|
|
17287
|
+
const text = tidyScriptTags(parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
17258
17288
|
return { text, bold, italic, footnoteText };
|
|
17259
17289
|
}
|
|
17260
17290
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -18127,7 +18157,7 @@ var ValueCursor = class {
|
|
|
18127
18157
|
}
|
|
18128
18158
|
};
|
|
18129
18159
|
function normalizeLabel(label) {
|
|
18130
|
-
return label.trim().replace(/[::\s()()·]/g, "");
|
|
18160
|
+
return label.trim().replace(/<\/?su[bp]>/g, "").replace(/[::\s()()·]/g, "");
|
|
18131
18161
|
}
|
|
18132
18162
|
function findMatchingKey(cellLabel, values) {
|
|
18133
18163
|
if (values.has(cellLabel)) return cellLabel;
|
|
@@ -20910,6 +20940,7 @@ function parseInlineMarkdown(text) {
|
|
|
20910
20940
|
text = text.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
20911
20941
|
text = text.replace(/~~([^~]+)~~/g, "$1");
|
|
20912
20942
|
text = text.replace(/<u>([^<]*)<\/u>/g, "$1");
|
|
20943
|
+
text = text.replace(/<(sup|sub)>([^<]*)<\/\1>/g, "$2");
|
|
20913
20944
|
let spans;
|
|
20914
20945
|
if (inlineDoc) {
|
|
20915
20946
|
spans = [];
|
|
@@ -29483,10 +29514,14 @@ async function dispatch(format2, buffer, opts) {
|
|
|
29483
29514
|
return { success: false, fileType: "unknown", error: "\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4.", code: "UNSUPPORTED_FORMAT" };
|
|
29484
29515
|
}
|
|
29485
29516
|
}
|
|
29517
|
+
function scriptsOff(r, off) {
|
|
29518
|
+
return off ? stripScriptTags(r) : r;
|
|
29519
|
+
}
|
|
29486
29520
|
async function parseImage(buffer, options) {
|
|
29487
29521
|
try {
|
|
29488
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
29522
|
+
const { parseImageDocument } = await import("./image-ocr-3WJ4QH3T.js");
|
|
29489
29523
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
29524
|
+
stripScriptTags({ blocks });
|
|
29490
29525
|
return {
|
|
29491
29526
|
success: true,
|
|
29492
29527
|
fileType: "image",
|
|
@@ -29510,7 +29545,7 @@ async function parseHwp3(buffer, options) {
|
|
|
29510
29545
|
async function parseHwpx(buffer, options) {
|
|
29511
29546
|
try {
|
|
29512
29547
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
29513
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount };
|
|
29548
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
|
|
29514
29549
|
} catch (err) {
|
|
29515
29550
|
return { success: false, fileType: "hwpx", error: sanitizeError(err), code: classifyError(err) };
|
|
29516
29551
|
}
|
|
@@ -29536,7 +29571,7 @@ async function parseHwp(buffer, options) {
|
|
|
29536
29571
|
} catch {
|
|
29537
29572
|
}
|
|
29538
29573
|
}
|
|
29539
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount };
|
|
29574
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
|
|
29540
29575
|
} catch (err) {
|
|
29541
29576
|
return { success: false, fileType: "hwp", error: sanitizeError(err), code: classifyError(err) };
|
|
29542
29577
|
}
|
|
@@ -29544,7 +29579,7 @@ async function parseHwp(buffer, options) {
|
|
|
29544
29579
|
async function parsePdf(buffer, options) {
|
|
29545
29580
|
let parsePdfDocument;
|
|
29546
29581
|
try {
|
|
29547
|
-
const mod = await import("./parser-
|
|
29582
|
+
const mod = await import("./parser-N6476XAC.js");
|
|
29548
29583
|
parsePdfDocument = mod.parsePdfDocument;
|
|
29549
29584
|
} catch {
|
|
29550
29585
|
return {
|
|
@@ -29556,7 +29591,7 @@ async function parsePdf(buffer, options) {
|
|
|
29556
29591
|
}
|
|
29557
29592
|
try {
|
|
29558
29593
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages } = await parsePdfDocument(buffer, options);
|
|
29559
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: metadata?.pageCount };
|
|
29594
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: metadata?.pageCount }, options?.scriptTags !== true);
|
|
29560
29595
|
} catch (err) {
|
|
29561
29596
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
29562
29597
|
return { success: false, fileType: "pdf", error: sanitizeError(err), code: classifyError(err), isImageBased };
|
|
@@ -29581,7 +29616,7 @@ async function parseXls(buffer, options) {
|
|
|
29581
29616
|
async function parseDocx(buffer, options) {
|
|
29582
29617
|
try {
|
|
29583
29618
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
29584
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount };
|
|
29619
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
|
|
29585
29620
|
} catch (err) {
|
|
29586
29621
|
return { success: false, fileType: "docx", error: sanitizeError(err), code: classifyError(err) };
|
|
29587
29622
|
}
|
|
@@ -29756,4 +29791,4 @@ export {
|
|
|
29756
29791
|
parseHwpml,
|
|
29757
29792
|
fillForm
|
|
29758
29793
|
};
|
|
29759
|
-
//# sourceMappingURL=chunk-
|
|
29794
|
+
//# sourceMappingURL=chunk-QOCS7W7R.js.map
|