kordoc 4.25.21 → 4.25.23
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 +3 -3
- package/dist/{chunk-PVOLFVXE.js → chunk-2PQMHHX4.js} +2 -2
- package/dist/{chunk-6I3X54AQ.js → chunk-377GAL46.js} +2 -2
- package/dist/{chunk-ZCMMU34Z.js → chunk-3IVEGZI3.js} +2 -2
- package/dist/{chunk-5ULHNZ3P.js → chunk-7LW2HG7F.js} +3 -3
- package/dist/{chunk-LSUTK3DH.js → chunk-7S4KRBXC.js} +2 -2
- package/dist/{chunk-COJYQKGH.js → chunk-B3LK5RVY.js} +83 -4
- package/dist/chunk-B3LK5RVY.js.map +7 -0
- package/dist/{chunk-QNJ2LMUO.js → chunk-BXHO5BB5.js} +8 -8
- package/dist/{chunk-HQILGS2O.js → chunk-GMYXTUSJ.js} +2 -2
- package/dist/{chunk-6MCJHRSM.js → chunk-GZX5UQ4P.js} +2 -2
- package/dist/{chunk-3AYNFK6J.js → chunk-IRR32NHL.js} +2 -2
- package/dist/{chunk-FDSFXE2L.js → chunk-J4OTJFSW.js} +2 -2
- package/dist/{chunk-TI6S3KZF.js → chunk-K5ZUKPU3.js} +2 -2
- package/dist/{chunk-W5AHXAUP.js → chunk-LTXF66N6.js} +7 -7
- package/dist/{chunk-B2SRYWEY.js → chunk-MJ2B3EXE.js} +19 -1
- package/dist/{chunk-B2SRYWEY.js.map → chunk-MJ2B3EXE.js.map} +2 -2
- package/dist/{chunk-TYJSNW4Z.js → chunk-MMJIFTWZ.js} +131 -32
- package/dist/chunk-MMJIFTWZ.js.map +7 -0
- package/dist/{chunk-MWCJYIJC.js → chunk-MPEWMDM2.js} +19 -19
- package/dist/{chunk-DHXKCDAU.js → chunk-NFMC6FLB.js} +66 -9
- package/dist/chunk-NFMC6FLB.js.map +7 -0
- package/dist/{chunk-ZO4P735U.js → chunk-PGBRNQAF.js} +2 -2
- package/dist/{chunk-PFNZQ3XI.js → chunk-PQIIJRV2.js} +2 -2
- package/dist/{chunk-S553BW45.js → chunk-QAQDSBAC.js} +6 -6
- package/dist/{chunk-XUBBFY3H.js → chunk-QI7LT4AX.js} +6 -6
- package/dist/{chunk-XUBBFY3H.js.map → chunk-QI7LT4AX.js.map} +2 -2
- package/dist/{chunk-QOCUFTT4.js → chunk-SE5HAJNL.js} +5 -5
- package/dist/{chunk-5MDRUEHP.js → chunk-SKZ2LLN5.js} +237 -4
- package/dist/chunk-SKZ2LLN5.js.map +1 -0
- package/dist/{chunk-KW4JO5CV.js → chunk-TYANRH6O.js} +3 -3
- package/dist/{chunk-DZOA5N5W.js → chunk-WLHQL53U.js} +2 -2
- package/dist/{chunk-24LB25LZ.js → chunk-YDOIXWSF.js} +2 -2
- package/dist/{chunk-GJORKM42.js → chunk-YWRAHQTV.js} +2 -2
- package/dist/chunks-A2NELZR2.js +10 -0
- package/dist/cli.js +38 -38
- package/dist/{formula-HMKT4BZL.js → formula-LUPB363D.js} +4 -4
- package/dist/generator-MK3VLXV2.js +18 -0
- package/dist/{hancom-QWJBWOOE.js → hancom-24SHJFWF.js} +2 -2
- package/dist/{image-ocr-P5AIZNT3.js → image-ocr-CSV7OLPX.js} +11 -11
- package/dist/index.cjs +517 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +22 -22
- package/dist/mcp.js +34 -34
- package/dist/memo-5G32P322.js +15 -0
- package/dist/{model-bundle-5CXCIZHZ.js → model-bundle-U6ONSDTJ.js} +5 -5
- package/dist/{models-PS4L7NLP.js → models-X4FVLSSQ.js} +5 -5
- package/dist/{page-images-QW7IUTUB.js → page-images-E67SJN3S.js} +2 -2
- package/dist/{parse-worker-v2-PRH6KVKP.js → parse-worker-v2-3VY5X7SF.js} +24 -24
- package/dist/{parser-OQIR5ZMI.js → parser-6GFE6B42.js} +14 -14
- package/dist/{pdf-ocr-ZH4JAUTR.js → pdf-ocr-MKQURNXT.js} +9 -9
- package/dist/{profile-io-JFRAM2VE.js → profile-io-DAZZHP7S.js} +3 -3
- package/dist/{rasterize-JJOMUTYX.js → rasterize-BJTBPSDM.js} +3 -3
- package/dist/{redact-doc-A7TW4MNF.js → redact-doc-W6H7SXGB.js} +23 -23
- package/dist/{render-VAOMAQV2.js → render-HJDMKGMV.js} +10 -10
- package/dist/{rewrite-fallback-7PR7V3AZ.js → rewrite-fallback-VKA6BLLT.js} +13 -13
- package/dist/seal-5KR6SUIU.js +14 -0
- package/dist/{setup-6DXZJQCT.js → setup-UGWQLJ5Z.js} +3 -3
- package/dist/{to-hwpx-A56R6H27.js → to-hwpx-WI5CGWDZ.js} +7 -7
- package/dist/visual-YDMDCB7Q.js +42 -0
- package/dist/{watch-7W6CKGX7.js → watch-CIO5522I.js} +23 -23
- package/package.json +1 -1
- package/dist/chunk-5MDRUEHP.js.map +0 -1
- package/dist/chunk-COJYQKGH.js.map +0 -7
- package/dist/chunk-DHXKCDAU.js.map +0 -7
- package/dist/chunk-TYJSNW4Z.js.map +0 -7
- package/dist/chunks-XX7RHVQF.js +0 -10
- package/dist/generator-HOY4SZ26.js +0 -18
- package/dist/memo-Q7772VJD.js +0 -15
- package/dist/seal-RZZNRJFL.js +0 -14
- package/dist/visual-25RY7EFI.js +0 -42
- /package/dist/{chunk-PVOLFVXE.js.map → chunk-2PQMHHX4.js.map} +0 -0
- /package/dist/{chunk-6I3X54AQ.js.map → chunk-377GAL46.js.map} +0 -0
- /package/dist/{chunk-ZCMMU34Z.js.map → chunk-3IVEGZI3.js.map} +0 -0
- /package/dist/{chunk-5ULHNZ3P.js.map → chunk-7LW2HG7F.js.map} +0 -0
- /package/dist/{chunk-LSUTK3DH.js.map → chunk-7S4KRBXC.js.map} +0 -0
- /package/dist/{chunk-QNJ2LMUO.js.map → chunk-BXHO5BB5.js.map} +0 -0
- /package/dist/{chunk-HQILGS2O.js.map → chunk-GMYXTUSJ.js.map} +0 -0
- /package/dist/{chunk-6MCJHRSM.js.map → chunk-GZX5UQ4P.js.map} +0 -0
- /package/dist/{chunk-3AYNFK6J.js.map → chunk-IRR32NHL.js.map} +0 -0
- /package/dist/{chunk-FDSFXE2L.js.map → chunk-J4OTJFSW.js.map} +0 -0
- /package/dist/{chunk-TI6S3KZF.js.map → chunk-K5ZUKPU3.js.map} +0 -0
- /package/dist/{chunk-W5AHXAUP.js.map → chunk-LTXF66N6.js.map} +0 -0
- /package/dist/{chunk-MWCJYIJC.js.map → chunk-MPEWMDM2.js.map} +0 -0
- /package/dist/{chunk-ZO4P735U.js.map → chunk-PGBRNQAF.js.map} +0 -0
- /package/dist/{chunk-PFNZQ3XI.js.map → chunk-PQIIJRV2.js.map} +0 -0
- /package/dist/{chunk-S553BW45.js.map → chunk-QAQDSBAC.js.map} +0 -0
- /package/dist/{chunk-QOCUFTT4.js.map → chunk-SE5HAJNL.js.map} +0 -0
- /package/dist/{chunk-KW4JO5CV.js.map → chunk-TYANRH6O.js.map} +0 -0
- /package/dist/{chunk-DZOA5N5W.js.map → chunk-WLHQL53U.js.map} +0 -0
- /package/dist/{chunk-24LB25LZ.js.map → chunk-YDOIXWSF.js.map} +0 -0
- /package/dist/{chunk-GJORKM42.js.map → chunk-YWRAHQTV.js.map} +0 -0
- /package/dist/{chunks-XX7RHVQF.js.map → chunks-A2NELZR2.js.map} +0 -0
- /package/dist/{formula-HMKT4BZL.js.map → formula-LUPB363D.js.map} +0 -0
- /package/dist/{generator-HOY4SZ26.js.map → generator-MK3VLXV2.js.map} +0 -0
- /package/dist/{hancom-QWJBWOOE.js.map → hancom-24SHJFWF.js.map} +0 -0
- /package/dist/{image-ocr-P5AIZNT3.js.map → image-ocr-CSV7OLPX.js.map} +0 -0
- /package/dist/{memo-Q7772VJD.js.map → memo-5G32P322.js.map} +0 -0
- /package/dist/{model-bundle-5CXCIZHZ.js.map → model-bundle-U6ONSDTJ.js.map} +0 -0
- /package/dist/{models-PS4L7NLP.js.map → models-X4FVLSSQ.js.map} +0 -0
- /package/dist/{page-images-QW7IUTUB.js.map → page-images-E67SJN3S.js.map} +0 -0
- /package/dist/{parse-worker-v2-PRH6KVKP.js.map → parse-worker-v2-3VY5X7SF.js.map} +0 -0
- /package/dist/{parser-OQIR5ZMI.js.map → parser-6GFE6B42.js.map} +0 -0
- /package/dist/{pdf-ocr-ZH4JAUTR.js.map → pdf-ocr-MKQURNXT.js.map} +0 -0
- /package/dist/{profile-io-JFRAM2VE.js.map → profile-io-DAZZHP7S.js.map} +0 -0
- /package/dist/{rasterize-JJOMUTYX.js.map → rasterize-BJTBPSDM.js.map} +0 -0
- /package/dist/{redact-doc-A7TW4MNF.js.map → redact-doc-W6H7SXGB.js.map} +0 -0
- /package/dist/{render-VAOMAQV2.js.map → render-HJDMKGMV.js.map} +0 -0
- /package/dist/{rewrite-fallback-7PR7V3AZ.js.map → rewrite-fallback-VKA6BLLT.js.map} +0 -0
- /package/dist/{seal-RZZNRJFL.js.map → seal-5KR6SUIU.js.map} +0 -0
- /package/dist/{setup-6DXZJQCT.js.map → setup-UGWQLJ5Z.js.map} +0 -0
- /package/dist/{to-hwpx-A56R6H27.js.map → to-hwpx-WI5CGWDZ.js.map} +0 -0
- /package/dist/{visual-25RY7EFI.js.map → visual-YDMDCB7Q.js.map} +0 -0
- /package/dist/{watch-7W6CKGX7.js.map → watch-CIO5522I.js.map} +0 -0
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
EMPH_SUP,
|
|
8
8
|
EMPH_UNDERLINE,
|
|
9
9
|
LAYOUT_MODE_MISMATCH,
|
|
10
|
+
NOTE_TEXT_UNSUPPORTED,
|
|
10
11
|
alignToRaw,
|
|
11
12
|
alignUnits,
|
|
12
13
|
alignedTextEdits,
|
|
@@ -32,12 +33,14 @@ import {
|
|
|
32
33
|
noScriptTags,
|
|
33
34
|
normForMatch,
|
|
34
35
|
noteMarksOf,
|
|
36
|
+
noteParaEdit,
|
|
35
37
|
pairTablesInGaps,
|
|
36
38
|
parseEmphasis,
|
|
37
39
|
parseGfmTable,
|
|
38
40
|
parseHtmlTable,
|
|
39
41
|
parseSectionPathsFromManifest,
|
|
40
42
|
parseSectionXml,
|
|
43
|
+
planNoteEdits,
|
|
41
44
|
readKordocLayout,
|
|
42
45
|
removeNoteMarks,
|
|
43
46
|
replicateColumnTable,
|
|
@@ -56,17 +59,17 @@ import {
|
|
|
56
59
|
unescapeGfm,
|
|
57
60
|
unescapeGfmCell,
|
|
58
61
|
wordHunks
|
|
59
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-NFMC6FLB.js";
|
|
60
63
|
import {
|
|
61
64
|
decryptHwpxInPlace,
|
|
62
65
|
lockedHwpxError,
|
|
63
66
|
noteFormatFrom,
|
|
64
67
|
noteRefMark
|
|
65
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-7LW2HG7F.js";
|
|
66
69
|
import {
|
|
67
70
|
patchZipEntries,
|
|
68
71
|
readZipEntries
|
|
69
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-GZX5UQ4P.js";
|
|
70
73
|
import {
|
|
71
74
|
allLinesegRemovalSplices,
|
|
72
75
|
applySplices,
|
|
@@ -81,7 +84,7 @@ import {
|
|
|
81
84
|
normalizeLabel,
|
|
82
85
|
paraTText,
|
|
83
86
|
scanSectionXml
|
|
84
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-MJ2B3EXE.js";
|
|
85
88
|
import {
|
|
86
89
|
DOMParser,
|
|
87
90
|
MAX_DECOMPRESS_SIZE,
|
|
@@ -95,7 +98,7 @@ import {
|
|
|
95
98
|
findChildByLocalName,
|
|
96
99
|
localName,
|
|
97
100
|
readZipEntry
|
|
98
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-377GAL46.js";
|
|
99
102
|
import {
|
|
100
103
|
comResultToParseResult,
|
|
101
104
|
extractTextViaCom,
|
|
@@ -110,7 +113,7 @@ import {
|
|
|
110
113
|
locateMemoBlocks,
|
|
111
114
|
parseHwp5Document,
|
|
112
115
|
unfilledClickHereGuide
|
|
113
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-QI7LT4AX.js";
|
|
114
117
|
import {
|
|
115
118
|
FLAG_COMPRESSED,
|
|
116
119
|
FLAG_DISTRIBUTION,
|
|
@@ -131,7 +134,7 @@ import {
|
|
|
131
134
|
isExtendedOnlyCtrlChar,
|
|
132
135
|
parseFileHeader,
|
|
133
136
|
readRecords
|
|
134
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-7S4KRBXC.js";
|
|
135
138
|
import {
|
|
136
139
|
parsePageRange
|
|
137
140
|
} from "./chunk-Y56TLZ42.js";
|
|
@@ -143,20 +146,20 @@ import {
|
|
|
143
146
|
} from "./chunk-L3U4XTBO.js";
|
|
144
147
|
import {
|
|
145
148
|
unframeLayoutTables
|
|
146
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-YWRAHQTV.js";
|
|
147
150
|
import {
|
|
148
151
|
blocksToMarkdown,
|
|
149
152
|
escapeGfm,
|
|
150
153
|
hasInlineCellBlocks,
|
|
151
154
|
sanitizeText
|
|
152
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-IRR32NHL.js";
|
|
153
156
|
import {
|
|
154
157
|
KordocError,
|
|
155
158
|
compareSectionPaths,
|
|
156
159
|
isPathTraversal,
|
|
157
160
|
precheckZipSize,
|
|
158
161
|
stripDtd
|
|
159
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-YDOIXWSF.js";
|
|
160
163
|
|
|
161
164
|
// src/hwpx/parser.ts
|
|
162
165
|
import JSZip2 from "jszip";
|
|
@@ -1125,6 +1128,23 @@ function buildEmbeddedLineSplices(para, xml, newLines) {
|
|
|
1125
1128
|
return splices;
|
|
1126
1129
|
}
|
|
1127
1130
|
|
|
1131
|
+
// src/roundtrip/note-edit.ts
|
|
1132
|
+
function noteEditSplices(host, xml, origNote, newNote) {
|
|
1133
|
+
if (!host.notes?.length || xml === void 0) return NOTE_TEXT_UNSUPPORTED;
|
|
1134
|
+
const plan = planNoteEdits(origNote, newNote, host.notes.map((paras) => paras.map((p) => p.text).join(" ")));
|
|
1135
|
+
if (typeof plan === "string") return plan;
|
|
1136
|
+
const out = [];
|
|
1137
|
+
for (const edit of plan) {
|
|
1138
|
+
const paras = host.notes[edit.index].filter((p) => normForMatch(p.text) !== "");
|
|
1139
|
+
const one = noteParaEdit(paras.map((p) => normForMatch(p.text)), edit.before, edit.after);
|
|
1140
|
+
if (!one) return "각주의 여러 문단에 걸친 수정은 미지원 — 각주 글 수정 미적용";
|
|
1141
|
+
const sp = minimalTextSplices(paras[one.index], xml, one.before, one.after);
|
|
1142
|
+
if (!sp) return "각주 문단을 원문과 맞대지 못함 — 각주 글 수정 미적용";
|
|
1143
|
+
out.push(...sp);
|
|
1144
|
+
}
|
|
1145
|
+
return out;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1128
1148
|
// src/roundtrip/table-patch.ts
|
|
1129
1149
|
function patchGfmTable(table, scanTable, orig, edited, ctx, skip) {
|
|
1130
1150
|
const replica = replicateGfmTable(table);
|
|
@@ -1378,17 +1398,31 @@ function patchTextChunkTable(table, scanTable, orig, edited, ctx, skip) {
|
|
|
1378
1398
|
return skip("표 렌더 경로 식별 실패");
|
|
1379
1399
|
}
|
|
1380
1400
|
function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, after, origLineCount) {
|
|
1401
|
+
let noteApplied = false;
|
|
1381
1402
|
const skip = (reason) => {
|
|
1382
1403
|
ctx.skipped.push({ reason, before: summarize(before), after: summarize(after) });
|
|
1383
|
-
return 0;
|
|
1404
|
+
return noteApplied ? 1 : 0;
|
|
1384
1405
|
};
|
|
1385
1406
|
const cell = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
1386
1407
|
if (!cell) return skip("셀 좌표 매핑 실패 (병합 영역의 빈 칸이거나 좌표 불일치)");
|
|
1387
1408
|
const origLines = gfmCellLines(before);
|
|
1388
1409
|
if (origLines.some((l) => /\(주: [\s\S]*\)$/.test(l)) && origLines.length === newLines.length) {
|
|
1389
|
-
const
|
|
1410
|
+
const hosts = cell.paragraphs.filter((p) => p.notes?.length);
|
|
1411
|
+
const notedLines = origLines.map((l, i) => /\(주: [\s\S]*\)$/.test(l) ? i : -1).filter((i) => i >= 0);
|
|
1412
|
+
const notes = newLines.map((l, i) => splitCellNote(origLines[i], l, ctx.skipped, (origNote, newNote) => {
|
|
1413
|
+
const host = hosts.length === notedLines.length ? hosts[notedLines.indexOf(i)] : void 0;
|
|
1414
|
+
if (!host) return false;
|
|
1415
|
+
const sp = noteEditSplices(host, ctx.scans[host.sectionIndex]?.xml, origNote, newNote);
|
|
1416
|
+
if (typeof sp === "string") ctx.skipped.push({ reason: sp, before: origNote, after: newNote });
|
|
1417
|
+
else if (sp.length) {
|
|
1418
|
+
ctx.sectionSplices[host.sectionIndex].push(...sp);
|
|
1419
|
+
noteApplied = true;
|
|
1420
|
+
}
|
|
1421
|
+
return true;
|
|
1422
|
+
}));
|
|
1390
1423
|
newLines = notes.map((n) => n.after);
|
|
1391
1424
|
before = notes.map((n) => n.before).join("<br>");
|
|
1425
|
+
if (notes.every((n) => normForMatch(n.before) === normForMatch(n.after))) return noteApplied ? 1 : 0;
|
|
1392
1426
|
}
|
|
1393
1427
|
const irCell = table.cells[gridR]?.[gridC];
|
|
1394
1428
|
const scanJoined = cell.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
@@ -1499,7 +1533,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
|
|
|
1499
1533
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
1500
1534
|
}
|
|
1501
1535
|
}
|
|
1502
|
-
if (splices.length === 0) return 0;
|
|
1536
|
+
if (splices.length === 0) return noteApplied ? 1 : 0;
|
|
1503
1537
|
ctx.sectionSplices[sectionIndex].push(...splices);
|
|
1504
1538
|
if (emphMissed) ctx.skipped.push({ reason: EMPHASIS_NOTE, before: summarize(before), after: summarize(after), partial: true });
|
|
1505
1539
|
return 1;
|
|
@@ -2352,14 +2386,21 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
2352
2386
|
let newPlain = newInline.plain;
|
|
2353
2387
|
const segsUsable = !block.footnoteText && !mapping.noteMarks?.length && !mapping.prefixStripped;
|
|
2354
2388
|
let noteEdited = false;
|
|
2389
|
+
let noteApplied = false;
|
|
2355
2390
|
if (block.footnoteText) {
|
|
2356
|
-
const
|
|
2391
|
+
const mdNote = origPlain.match(/\s*\(주: ([\s\S]*)\)$/)?.[1];
|
|
2392
|
+
const origNote = block.footnoteBlocks ? mdNote : void 0;
|
|
2357
2393
|
origPlain = origPlain.replace(/\s*\(주: [\s\S]*\)$/, "");
|
|
2358
2394
|
const noteMatch = newPlain.match(/\s*\(주: ([\s\S]*)\)$/);
|
|
2359
2395
|
if (noteMatch) {
|
|
2360
2396
|
newPlain = newPlain.slice(0, noteMatch.index).trimEnd();
|
|
2361
2397
|
if (normForMatch(noteMatch[1]) !== normForMatch(origNote ?? block.footnoteText)) {
|
|
2362
|
-
|
|
2398
|
+
const sp = block.footnoteBlocks ? NOTE_TEXT_UNSUPPORTED : noteEditSplices(mapping.para, ctx.scans[mapping.para.sectionIndex]?.xml, mdNote ?? block.footnoteText, noteMatch[1]);
|
|
2399
|
+
if (typeof sp === "string") ctx.skipped.push({ reason: sp, before: block.footnoteText, after: noteMatch[1] });
|
|
2400
|
+
else if (sp.length) {
|
|
2401
|
+
ctx.sectionSplices[mapping.para.sectionIndex].push(...sp);
|
|
2402
|
+
noteApplied = true;
|
|
2403
|
+
}
|
|
2363
2404
|
noteEdited = true;
|
|
2364
2405
|
}
|
|
2365
2406
|
} else {
|
|
@@ -2378,9 +2419,12 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
2378
2419
|
newPlain = head.text;
|
|
2379
2420
|
if (head.note) ctx.skipped.push({ reason: head.note, after: summarize(newPlain), partial: true });
|
|
2380
2421
|
}
|
|
2381
|
-
if (newPlain === origPlain)
|
|
2422
|
+
if (newPlain === origPlain) {
|
|
2423
|
+
if (!noteEdited) return skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
|
|
2424
|
+
return noteApplied ? 1 : 0;
|
|
2425
|
+
}
|
|
2382
2426
|
if (sanitizeText(newPlain) !== newPlain && sanitizeText(origPlain) === origPlain) {
|
|
2383
|
-
return skip("공백 정규화 불안정 텍스트 — 패치 시 원문 보존 불가로 미지원");
|
|
2427
|
+
return Math.max(skip("공백 정규화 불안정 텍스트 — 패치 시 원문 보존 불가로 미지원"), noteApplied ? 1 : 0);
|
|
2384
2428
|
}
|
|
2385
2429
|
const xml = ctx.scans[mapping.para.sectionIndex]?.xml;
|
|
2386
2430
|
const book = ctx.charBook;
|
|
@@ -2393,7 +2437,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
2393
2437
|
} : void 0;
|
|
2394
2438
|
const minimal = xml ? minimalTextSplices(mapping.para, xml, origPlain, newPlain, segsUsable ? origInline.segs : void 0, segsUsable ? newInline.segs : void 0, style) : null;
|
|
2395
2439
|
const splices = (xml ? clickHereEditSplices(mapping.para, xml, origPlain, newPlain) : null) ?? minimal ?? (xml ? markerRunSplices(mapping.para, xml, newPlain) : null) ?? buildParagraphSplices(mapping.para, newPlain, xml);
|
|
2396
|
-
if (splices === null) return skip("문단에 텍스트 노드를 만들 수 없음");
|
|
2440
|
+
if (splices === null) return Math.max(skip("문단에 텍스트 노드를 만들 수 없음"), noteApplied ? 1 : 0);
|
|
2397
2441
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
2398
2442
|
if (origInline.segs.length !== newInline.segs.length && (!minimal || !style || style.missed || restyledKept(origInline, newInline, origInline.plain, newInline.plain))) {
|
|
2399
2443
|
ctx.skipped.push({ reason: EMPHASIS_NOTE, before: summarize(orig.raw), after: summarize(edited.raw), partial: true });
|
|
@@ -3346,6 +3390,8 @@ function cid(s) {
|
|
|
3346
3390
|
}
|
|
3347
3391
|
var CTRL_TBL = cid("tbl ");
|
|
3348
3392
|
var CTRL_GSO = cid("gso ");
|
|
3393
|
+
var CTRL_FN = cid("fn ");
|
|
3394
|
+
var CTRL_EN = cid("en ");
|
|
3349
3395
|
function swap32(id) {
|
|
3350
3396
|
return ((id & 255) << 24 | (id >>> 8 & 255) << 16 | (id >>> 16 & 255) << 8 | id >>> 24 & 255) >>> 0;
|
|
3351
3397
|
}
|
|
@@ -3465,6 +3511,17 @@ function scanSection(stream, sectionIndex, compressed) {
|
|
|
3465
3511
|
paras.push(para);
|
|
3466
3512
|
parasByHeader.set(i, para);
|
|
3467
3513
|
}
|
|
3514
|
+
for (let i = 0; i < records.length; i++) {
|
|
3515
|
+
if (!isCtrl(records[i], CTRL_FN) && !isCtrl(records[i], CTRL_EN)) continue;
|
|
3516
|
+
const host = parent[i] >= 0 ? parasByHeader.get(parent[i]) : void 0;
|
|
3517
|
+
if (!host) continue;
|
|
3518
|
+
const list = [];
|
|
3519
|
+
for (let j = i + 1; j < records.length && records[j].level > records[i].level; j++) {
|
|
3520
|
+
const np = parent[j] === i ? parasByHeader.get(j) : void 0;
|
|
3521
|
+
if (np) list.push(np);
|
|
3522
|
+
}
|
|
3523
|
+
(host.notes ??= []).push(list);
|
|
3524
|
+
}
|
|
3468
3525
|
const scanTable = (i, depth) => {
|
|
3469
3526
|
const ctrlLevel = records[i].level;
|
|
3470
3527
|
let rows = 0, cols = 0, tableIdx = -1;
|
|
@@ -3885,12 +3942,14 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
3885
3942
|
return skip("다중줄 문단 수정에 <br> 없음 — 줄바꿈 위치 보존 불가로 미지원 (줄바꿈은 <br>로 표기)");
|
|
3886
3943
|
}
|
|
3887
3944
|
let noteEdited = false;
|
|
3945
|
+
let noteApplied = false;
|
|
3888
3946
|
if (block.footnoteText) {
|
|
3889
3947
|
const noteMatch = newPlain.match(/\s*\(주: ([\s\S]*)\)$/);
|
|
3890
3948
|
if (noteMatch) {
|
|
3891
3949
|
newPlain = newPlain.slice(0, noteMatch.index).trimEnd();
|
|
3892
3950
|
if (normForMatch(noteMatch[1]) !== normForMatch(block.footnoteText)) {
|
|
3893
|
-
|
|
3951
|
+
noteApplied = !block.footnoteBlocks && stageNoteEdit(mapping.para, block.footnoteText, noteMatch[1], ctx);
|
|
3952
|
+
if (block.footnoteBlocks) ctx.skipped.push({ reason: NOTE_TEXT_UNSUPPORTED, before: block.footnoteText, after: noteMatch[1] });
|
|
3894
3953
|
noteEdited = true;
|
|
3895
3954
|
}
|
|
3896
3955
|
} else {
|
|
@@ -3909,9 +3968,9 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
3909
3968
|
}
|
|
3910
3969
|
let origPlain = block.text != null ? noScriptTags(block.text) : restoreBr(origStyled.plain);
|
|
3911
3970
|
if (mapping.noteMarks?.length) origPlain = removeNoteMarks(origPlain, mapping.noteMarks).text;
|
|
3912
|
-
if (newPlain === origPlain) return noteEdited ? 0 : skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
|
|
3971
|
+
if (newPlain === origPlain) return noteEdited ? noteApplied ? 1 : 0 : skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
|
|
3913
3972
|
if (sanitizeText(newPlain) !== newPlain && sanitizeText(origPlain) === origPlain) {
|
|
3914
|
-
return skip("공백 정규화 불안정 텍스트 — 패치 시 원문 보존 불가로 미지원");
|
|
3973
|
+
return Math.max(skip("공백 정규화 불안정 텍스트 — 패치 시 원문 보존 불가로 미지원"), noteApplied ? 1 : 0);
|
|
3915
3974
|
}
|
|
3916
3975
|
let origMd = restoreBr(origStyled.plain);
|
|
3917
3976
|
if (block.footnoteText) origMd = origMd.replace(/\s*\(주: [\s\S]*\)$/, "");
|
|
@@ -3923,7 +3982,28 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
3923
3982
|
if (n && (style?.missed || style && restyledKept(origStyled, editedStyled, origStyled.plain, editedStyled.plain))) {
|
|
3924
3983
|
ctx.skipped.push({ reason: EMPHASIS_NOTE, before: summarize(orig.raw), after: summarize(edited.raw), partial: true });
|
|
3925
3984
|
}
|
|
3926
|
-
return n;
|
|
3985
|
+
return Math.max(n, noteApplied ? 1 : 0);
|
|
3986
|
+
}
|
|
3987
|
+
function stageNoteEdit(host, origNote, newNote, ctx) {
|
|
3988
|
+
const note = (reason) => {
|
|
3989
|
+
ctx.skipped.push({ reason, before: summarize(origNote), after: summarize(newNote) });
|
|
3990
|
+
return 0;
|
|
3991
|
+
};
|
|
3992
|
+
if (!host.notes?.length) return note(NOTE_TEXT_UNSUPPORTED) > 0;
|
|
3993
|
+
const plan = planNoteEdits(origNote, newNote, host.notes.map((paras) => paras.map((p) => p.rawText).join(" ")));
|
|
3994
|
+
if (typeof plan === "string") return note(plan) > 0;
|
|
3995
|
+
let staged = 0;
|
|
3996
|
+
for (const edit of plan) {
|
|
3997
|
+
const paras = host.notes[edit.index].filter((p) => normForMatch(p.rawText) !== "");
|
|
3998
|
+
const one = noteParaEdit(paras.map((p) => normForMatch(p.rawText)), edit.before, edit.after);
|
|
3999
|
+
if (!one) {
|
|
4000
|
+
note("각주의 여러 문단에 걸친 수정은 미지원 — 각주 글 수정 미적용");
|
|
4001
|
+
continue;
|
|
4002
|
+
}
|
|
4003
|
+
const para = paras[one.index];
|
|
4004
|
+
staged += stageParaPatch(ctx.scans[para.sectionIndex], para, one.after, note, ctx.keepLineseg, one.before);
|
|
4005
|
+
}
|
|
4006
|
+
return staged > 0;
|
|
3927
4007
|
}
|
|
3928
4008
|
function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
3929
4009
|
const origRows = parseGfmTable(orig.lines);
|
|
@@ -3954,18 +4034,27 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
3954
4034
|
continue;
|
|
3955
4035
|
}
|
|
3956
4036
|
if (beforeEach.join("\n") === afterEach.join("\n")) continue;
|
|
3957
|
-
const { before, after, noted } = splitCellNote(beforeEach.join("\n"), afterEach.join("\n"), ctx.skipped);
|
|
3958
|
-
if (before === after) continue;
|
|
3959
4037
|
const para = cell.paras[0];
|
|
4038
|
+
let noteDone = 0;
|
|
4039
|
+
const { before, after, noted } = splitCellNote(beforeEach.join("\n"), afterEach.join("\n"), ctx.skipped, (o, n) => {
|
|
4040
|
+
if (stageNoteEdit(para, o, n, ctx)) noteDone = 1;
|
|
4041
|
+
return true;
|
|
4042
|
+
});
|
|
4043
|
+
if (before === after) {
|
|
4044
|
+
applied += noteDone;
|
|
4045
|
+
continue;
|
|
4046
|
+
}
|
|
3960
4047
|
if (normForMatch(para.rawText) !== normForMatch(before)) {
|
|
3961
4048
|
cellSkip("셀 텍스트 불일치 — 소스맵 신뢰 불가");
|
|
4049
|
+
applied += noteDone;
|
|
3962
4050
|
continue;
|
|
3963
4051
|
}
|
|
3964
4052
|
if (afterEach.some((l) => sanitizeText(l) !== l)) {
|
|
3965
4053
|
cellSkip("공백 정규화 불안정 텍스트 — 미지원");
|
|
4054
|
+
applied += noteDone;
|
|
3966
4055
|
continue;
|
|
3967
4056
|
}
|
|
3968
|
-
applied += stageParaPatch(
|
|
4057
|
+
applied += Math.max(noteDone, stageParaPatch(
|
|
3969
4058
|
ctx.scans[para.sectionIndex],
|
|
3970
4059
|
para,
|
|
3971
4060
|
after,
|
|
@@ -3974,7 +4063,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
3974
4063
|
before,
|
|
3975
4064
|
// 바뀐 자리만 — 굵은 조각 등 run 유지
|
|
3976
4065
|
noted ? void 0 : cellLineStyles(origRows[r][c], editedRows[r][c], ctx.charBook)(0, after)
|
|
3977
|
-
);
|
|
4066
|
+
));
|
|
3978
4067
|
continue;
|
|
3979
4068
|
}
|
|
3980
4069
|
if (beforeParts.length !== cell.paras.length || afterParts.length !== cell.paras.length) {
|
|
@@ -3989,22 +4078,32 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
3989
4078
|
break;
|
|
3990
4079
|
}
|
|
3991
4080
|
if (rawBefore === rawAfter) continue;
|
|
3992
|
-
const
|
|
3993
|
-
|
|
4081
|
+
const para = cell.paras[k];
|
|
4082
|
+
let noteDone = 0;
|
|
4083
|
+
const { before, after, noted } = splitCellNote(rawBefore, rawAfter, ctx.skipped, (o, n) => {
|
|
4084
|
+
if (stageNoteEdit(para, o, n, ctx)) noteDone = 1;
|
|
4085
|
+
return true;
|
|
4086
|
+
});
|
|
4087
|
+
if (before === after) {
|
|
4088
|
+
applied += noteDone;
|
|
4089
|
+
continue;
|
|
4090
|
+
}
|
|
3994
4091
|
if (after.includes("\n")) {
|
|
3995
4092
|
cellSkip("셀 내 줄바꿈 추가는 미지원 (v1)");
|
|
4093
|
+
applied += noteDone;
|
|
3996
4094
|
break;
|
|
3997
4095
|
}
|
|
3998
|
-
const para = cell.paras[k];
|
|
3999
4096
|
if (normForMatch(para.rawText) !== normForMatch(before)) {
|
|
4000
4097
|
cellSkip("셀 텍스트 불일치 — 소스맵 신뢰 불가");
|
|
4098
|
+
applied += noteDone;
|
|
4001
4099
|
break;
|
|
4002
4100
|
}
|
|
4003
4101
|
if (sanitizeText(after) !== after) {
|
|
4004
4102
|
cellSkip("공백 정규화 불안정 텍스트 — 미지원");
|
|
4103
|
+
applied += noteDone;
|
|
4005
4104
|
break;
|
|
4006
4105
|
}
|
|
4007
|
-
applied += stageParaPatch(
|
|
4106
|
+
applied += Math.max(noteDone, stageParaPatch(
|
|
4008
4107
|
ctx.scans[para.sectionIndex],
|
|
4009
4108
|
para,
|
|
4010
4109
|
after,
|
|
@@ -4013,7 +4112,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
4013
4112
|
before,
|
|
4014
4113
|
// 바뀐 자리만 — 굵은 조각 등 run 유지
|
|
4015
4114
|
noted ? void 0 : cellLineStyles(origRows[r][c], editedRows[r][c], ctx.charBook)(k, after)
|
|
4016
|
-
);
|
|
4115
|
+
));
|
|
4017
4116
|
}
|
|
4018
4117
|
}
|
|
4019
4118
|
}
|
|
@@ -4225,4 +4324,4 @@ export {
|
|
|
4225
4324
|
resolveParagraphMappings,
|
|
4226
4325
|
diffUnitLists
|
|
4227
4326
|
};
|
|
4228
|
-
//# sourceMappingURL=chunk-
|
|
4327
|
+
//# sourceMappingURL=chunk-MMJIFTWZ.js.map
|