kordoc 4.24.28 → 4.24.30
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 -6
- package/dist/{-R5BXEKN7.js → -LTYXURUV.js} +21 -21
- package/dist/{chunk-7D3YXOZB.js → chunk-2P7Y3BT3.js} +2 -2
- package/dist/{chunk-GEJLVYIV.js → chunk-44Y7SP3W.js} +2 -2
- package/dist/{chunk-X323YP65.js → chunk-4LOXBT7W.js} +2 -2
- package/dist/{chunk-AZE46MS5.js → chunk-64CA5E3N.js} +132 -70
- package/dist/chunk-64CA5E3N.js.map +1 -0
- package/dist/{chunk-FWVOXMFA.js → chunk-6KXAVROI.js} +2 -2
- package/dist/{chunk-6EC4PI6I.js → chunk-7LEWA5WH.js} +3 -3
- package/dist/{chunk-K6Z6LKX4.js → chunk-ACMWKNEF.js} +3 -3
- package/dist/{chunk-O57FU2GJ.js → chunk-AI2YUNVV.js} +2 -2
- package/dist/{chunk-H7M6SO2O.js → chunk-AL6DVHWS.js} +2 -2
- package/dist/{chunk-E2HUJHVO.cjs → chunk-BVAKONSV.cjs} +183 -169
- package/dist/chunk-BVAKONSV.cjs.map +1 -0
- package/dist/{chunk-HATKKA2U.js → chunk-C4NF2E7X.js} +2 -2
- package/dist/{chunk-H77XXKSA.js → chunk-CAAW52SA.js} +2 -2
- package/dist/{chunk-EW4RSALL.js → chunk-CATJO2L2.js} +2 -2
- package/dist/{chunk-GLUA5OVR.js → chunk-DBUSSWBU.js} +19 -5
- package/dist/chunk-DBUSSWBU.js.map +1 -0
- package/dist/{chunk-IGHD2274.cjs → chunk-EFSZHHEP.cjs} +6 -6
- package/dist/{chunk-IGHD2274.cjs.map → chunk-EFSZHHEP.cjs.map} +1 -1
- package/dist/{chunk-NXX3ZNCD.js → chunk-EH744WIF.js} +2 -2
- package/dist/{chunk-KNJFLPCP.js → chunk-FICCE4LN.js} +21 -9
- package/dist/chunk-FICCE4LN.js.map +1 -0
- package/dist/{chunk-PIFI3L4K.cjs → chunk-FW2OQZ3D.cjs} +3 -3
- package/dist/{chunk-PIFI3L4K.cjs.map → chunk-FW2OQZ3D.cjs.map} +1 -1
- package/dist/{chunk-LGJYCCIK.js → chunk-GFV5RSHS.js} +3 -3
- package/dist/{chunk-JAAUNU4D.cjs → chunk-H6YTDIDW.cjs} +436 -357
- package/dist/chunk-H6YTDIDW.cjs.map +1 -0
- package/dist/{chunk-PUJKIYSL.js → chunk-HYACQOK6.js} +10 -10
- package/dist/{chunk-WKWEETPH.js → chunk-IM66ER3N.js} +6 -6
- package/dist/{chunk-7YTK74IH.cjs → chunk-JRWQEYSV.cjs} +186 -124
- package/dist/chunk-JRWQEYSV.cjs.map +1 -0
- package/dist/{chunk-XOIAIDR2.js → chunk-JSLRB4XE.js} +2 -2
- package/dist/{chunk-ZOMGHI3B.js → chunk-KR6UDBIV.js} +2 -2
- package/dist/{chunk-W7OSON66.js → chunk-L4WWG3U7.js} +4 -4
- package/dist/{chunk-Z35AEUSH.js → chunk-MTOZEYOT.js} +760 -711
- package/dist/chunk-MTOZEYOT.js.map +1 -0
- package/dist/{chunk-QXA6TBIT.js → chunk-MYYXPR42.js} +2 -2
- package/dist/{chunk-NVYIWJ5U.js → chunk-N2Y5LEOQ.js} +2 -2
- package/dist/{chunk-KW2ZZ2YM.js → chunk-N3LJARDG.js} +15 -15
- package/dist/{chunk-3WWMQS26.cjs → chunk-NLP5AB6W.cjs} +3 -3
- package/dist/{chunk-3WWMQS26.cjs.map → chunk-NLP5AB6W.cjs.map} +1 -1
- package/dist/{chunk-2LYNOQQO.js → chunk-PZO3WTII.js} +2 -2
- package/dist/{chunk-24XMCOWF.js → chunk-QIM4I2IO.js} +2 -2
- package/dist/{chunk-2MZ73PTH.cjs → chunk-QQXNGBN2.cjs} +77 -77
- package/dist/{chunk-2MZ73PTH.cjs.map → chunk-QQXNGBN2.cjs.map} +1 -1
- package/dist/{chunk-GEMWP24J.js → chunk-SFFX26HF.js} +2 -2
- package/dist/{chunk-BWUC36DH.js → chunk-SJMAND23.js} +18 -4
- package/dist/chunk-SJMAND23.js.map +1 -0
- package/dist/{chunk-RSCXIVO4.js → chunk-TXYE3JUL.js} +5 -5
- package/dist/{chunk-XZ5BYEHI.js → chunk-VNTU326I.js} +204 -125
- package/dist/chunk-VNTU326I.js.map +1 -0
- package/dist/{chunk-5NALEQEL.js → chunk-VOF2VCUF.js} +117 -68
- package/dist/chunk-VOF2VCUF.js.map +1 -0
- package/dist/{chunk-263KNYS6.js → chunk-WRZDSWMV.js} +2 -2
- package/dist/{chunk-L2E7FKSR.js → chunk-WW47MOC6.js} +5 -3
- package/dist/{chunk-L2E7FKSR.js.map → chunk-WW47MOC6.js.map} +1 -1
- package/dist/{chunk-PNW4B5W5.js → chunk-XNCPKOIP.js} +207 -128
- package/dist/chunk-XNCPKOIP.js.map +1 -0
- package/dist/{chunk-W5FIJEBK.cjs → chunk-XXFF4HE4.cjs} +2 -2
- package/dist/{chunk-W5FIJEBK.cjs.map → chunk-XXFF4HE4.cjs.map} +1 -1
- package/dist/chunks-EMHL6JYG.js +11 -0
- package/dist/cli.js +43 -43
- package/dist/{formula-MF3OTYTH.js → formula-4IAJ4J5W.js} +4 -4
- package/dist/{formula-QJSZPODL.cjs → formula-E3VGHFAI.cjs} +9 -9
- package/dist/{formula-QJSZPODL.cjs.map → formula-E3VGHFAI.cjs.map} +1 -1
- package/dist/{formula-TOVULTIT.js → formula-NJZUDYQO.js} +3 -3
- package/dist/generator-GPT76OML.js +17 -0
- package/dist/generator-MIX4R7HL.js +10 -0
- package/dist/generator-SUPBH2Q6.cjs +11 -0
- package/dist/{generator-2YABZHQ4.cjs.map → generator-SUPBH2Q6.cjs.map} +1 -1
- package/dist/{image-ocr-INZPDSJH.js → image-ocr-2ZA6RJB2.js} +6 -6
- package/dist/{image-ocr-LJ3WXDKU.js → image-ocr-7DKSLHV3.js} +9 -9
- package/dist/{image-ocr-4YJU3TJG.cjs → image-ocr-KOZT553E.cjs} +17 -17
- package/dist/{image-ocr-4YJU3TJG.cjs.map → image-ocr-KOZT553E.cjs.map} +1 -1
- package/dist/index.cjs +2033 -1984
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +489 -440
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +36 -36
- package/dist/memo-GFUUEHGA.js +17 -0
- package/dist/{model-bundle-PXUYQSHW.js → model-bundle-DFIFP2XF.js} +5 -5
- package/dist/{models-SBKYVIBF.js → models-25SH2DS7.js} +5 -5
- package/dist/{parse-worker-v2-LRC5HCT6.js → parse-worker-v2-RJ3ED73F.js} +22 -22
- package/dist/{parser-H3C7RXWN.cjs → parser-3ODQI4QF.cjs} +157 -157
- package/dist/{parser-H3C7RXWN.cjs.map → parser-3ODQI4QF.cjs.map} +1 -1
- package/dist/{parser-ARQ34S4N.js → parser-GBYPD4QF.js} +12 -12
- package/dist/{parser-OXELKPM7.js → parser-NEYOWPAK.js} +9 -9
- package/dist/{pdf-ocr-TTLDKJSL.js → pdf-ocr-5LHY3NXV.js} +6 -6
- package/dist/pdf-ocr-76NT4TCS.cjs +36 -0
- package/dist/{pdf-ocr-O5VNFKRB.cjs.map → pdf-ocr-76NT4TCS.cjs.map} +1 -1
- package/dist/{pdf-ocr-ZQHLCBSN.js → pdf-ocr-N6VQ72SP.js} +9 -9
- package/dist/{profile-io-QIFJ3WF3.js → profile-io-WCBBMCOR.js} +3 -3
- package/dist/{rasterize-EJUDQZTP.js → rasterize-GD325A5X.js} +3 -3
- package/dist/{redact-doc-6JMEZOGL.js → redact-doc-R4F5VYUA.js} +21 -21
- package/dist/{render-SV47YGRO.js → render-7GV7GKZE.js} +12 -12
- package/dist/{rewrite-fallback-QZV4FRPE.js → rewrite-fallback-STVHEDFQ.js} +13 -13
- package/dist/seal-XTZXAGHU.js +16 -0
- package/dist/{setup-FQ22XI2R.js → setup-EG7ZQNBB.js} +3 -3
- package/dist/{to-hwpx-BTJOOZAD.js → to-hwpx-2UZJV377.js} +7 -7
- package/dist/{to-hwpx-3EVHIIRR.js → to-hwpx-XURJVKKH.js} +4 -4
- package/dist/to-hwpx-ZTVZ6SRI.cjs +16 -0
- package/dist/{to-hwpx-GEI76GUY.cjs.map → to-hwpx-ZTVZ6SRI.cjs.map} +1 -1
- package/dist/visual-C33QKCQ6.js +37 -0
- package/dist/{watch-CF76OEMZ.js → watch-NSVI3VIY.js} +22 -22
- package/package.json +1 -1
- package/dist/chunk-5NALEQEL.js.map +0 -1
- package/dist/chunk-7YTK74IH.cjs.map +0 -1
- package/dist/chunk-AZE46MS5.js.map +0 -1
- package/dist/chunk-BWUC36DH.js.map +0 -1
- package/dist/chunk-E2HUJHVO.cjs.map +0 -1
- package/dist/chunk-GLUA5OVR.js.map +0 -1
- package/dist/chunk-JAAUNU4D.cjs.map +0 -1
- package/dist/chunk-KNJFLPCP.js.map +0 -1
- package/dist/chunk-PNW4B5W5.js.map +0 -1
- package/dist/chunk-XZ5BYEHI.js.map +0 -1
- package/dist/chunk-Z35AEUSH.js.map +0 -1
- package/dist/chunks-DFHM4S4R.js +0 -11
- package/dist/generator-2YABZHQ4.cjs +0 -11
- package/dist/generator-SH3TOHPH.js +0 -17
- package/dist/generator-SST2TDKE.js +0 -10
- package/dist/memo-DBSP7EDT.js +0 -17
- package/dist/pdf-ocr-O5VNFKRB.cjs +0 -36
- package/dist/seal-Z4E7DZ75.js +0 -16
- package/dist/to-hwpx-GEI76GUY.cjs +0 -16
- package/dist/visual-GGB2DRCT.js +0 -37
- /package/dist/{-R5BXEKN7.js.map → -LTYXURUV.js.map} +0 -0
- /package/dist/{chunk-7D3YXOZB.js.map → chunk-2P7Y3BT3.js.map} +0 -0
- /package/dist/{chunk-GEJLVYIV.js.map → chunk-44Y7SP3W.js.map} +0 -0
- /package/dist/{chunk-X323YP65.js.map → chunk-4LOXBT7W.js.map} +0 -0
- /package/dist/{chunk-FWVOXMFA.js.map → chunk-6KXAVROI.js.map} +0 -0
- /package/dist/{chunk-6EC4PI6I.js.map → chunk-7LEWA5WH.js.map} +0 -0
- /package/dist/{chunk-K6Z6LKX4.js.map → chunk-ACMWKNEF.js.map} +0 -0
- /package/dist/{chunk-O57FU2GJ.js.map → chunk-AI2YUNVV.js.map} +0 -0
- /package/dist/{chunk-H7M6SO2O.js.map → chunk-AL6DVHWS.js.map} +0 -0
- /package/dist/{chunk-HATKKA2U.js.map → chunk-C4NF2E7X.js.map} +0 -0
- /package/dist/{chunk-H77XXKSA.js.map → chunk-CAAW52SA.js.map} +0 -0
- /package/dist/{chunk-EW4RSALL.js.map → chunk-CATJO2L2.js.map} +0 -0
- /package/dist/{chunk-NXX3ZNCD.js.map → chunk-EH744WIF.js.map} +0 -0
- /package/dist/{chunk-LGJYCCIK.js.map → chunk-GFV5RSHS.js.map} +0 -0
- /package/dist/{chunk-PUJKIYSL.js.map → chunk-HYACQOK6.js.map} +0 -0
- /package/dist/{chunk-WKWEETPH.js.map → chunk-IM66ER3N.js.map} +0 -0
- /package/dist/{chunk-XOIAIDR2.js.map → chunk-JSLRB4XE.js.map} +0 -0
- /package/dist/{chunk-ZOMGHI3B.js.map → chunk-KR6UDBIV.js.map} +0 -0
- /package/dist/{chunk-W7OSON66.js.map → chunk-L4WWG3U7.js.map} +0 -0
- /package/dist/{chunk-QXA6TBIT.js.map → chunk-MYYXPR42.js.map} +0 -0
- /package/dist/{chunk-NVYIWJ5U.js.map → chunk-N2Y5LEOQ.js.map} +0 -0
- /package/dist/{chunk-KW2ZZ2YM.js.map → chunk-N3LJARDG.js.map} +0 -0
- /package/dist/{chunk-2LYNOQQO.js.map → chunk-PZO3WTII.js.map} +0 -0
- /package/dist/{chunk-24XMCOWF.js.map → chunk-QIM4I2IO.js.map} +0 -0
- /package/dist/{chunk-GEMWP24J.js.map → chunk-SFFX26HF.js.map} +0 -0
- /package/dist/{chunk-RSCXIVO4.js.map → chunk-TXYE3JUL.js.map} +0 -0
- /package/dist/{chunk-263KNYS6.js.map → chunk-WRZDSWMV.js.map} +0 -0
- /package/dist/{chunks-DFHM4S4R.js.map → chunks-EMHL6JYG.js.map} +0 -0
- /package/dist/{formula-MF3OTYTH.js.map → formula-4IAJ4J5W.js.map} +0 -0
- /package/dist/{formula-TOVULTIT.js.map → formula-NJZUDYQO.js.map} +0 -0
- /package/dist/{generator-SH3TOHPH.js.map → generator-GPT76OML.js.map} +0 -0
- /package/dist/{generator-SST2TDKE.js.map → generator-MIX4R7HL.js.map} +0 -0
- /package/dist/{image-ocr-INZPDSJH.js.map → image-ocr-2ZA6RJB2.js.map} +0 -0
- /package/dist/{image-ocr-LJ3WXDKU.js.map → image-ocr-7DKSLHV3.js.map} +0 -0
- /package/dist/{memo-DBSP7EDT.js.map → memo-GFUUEHGA.js.map} +0 -0
- /package/dist/{model-bundle-PXUYQSHW.js.map → model-bundle-DFIFP2XF.js.map} +0 -0
- /package/dist/{models-SBKYVIBF.js.map → models-25SH2DS7.js.map} +0 -0
- /package/dist/{parse-worker-v2-LRC5HCT6.js.map → parse-worker-v2-RJ3ED73F.js.map} +0 -0
- /package/dist/{parser-ARQ34S4N.js.map → parser-GBYPD4QF.js.map} +0 -0
- /package/dist/{parser-OXELKPM7.js.map → parser-NEYOWPAK.js.map} +0 -0
- /package/dist/{pdf-ocr-TTLDKJSL.js.map → pdf-ocr-5LHY3NXV.js.map} +0 -0
- /package/dist/{pdf-ocr-ZQHLCBSN.js.map → pdf-ocr-N6VQ72SP.js.map} +0 -0
- /package/dist/{profile-io-QIFJ3WF3.js.map → profile-io-WCBBMCOR.js.map} +0 -0
- /package/dist/{rasterize-EJUDQZTP.js.map → rasterize-GD325A5X.js.map} +0 -0
- /package/dist/{redact-doc-6JMEZOGL.js.map → redact-doc-R4F5VYUA.js.map} +0 -0
- /package/dist/{render-SV47YGRO.js.map → render-7GV7GKZE.js.map} +0 -0
- /package/dist/{rewrite-fallback-QZV4FRPE.js.map → rewrite-fallback-STVHEDFQ.js.map} +0 -0
- /package/dist/{seal-Z4E7DZ75.js.map → seal-XTZXAGHU.js.map} +0 -0
- /package/dist/{setup-FQ22XI2R.js.map → setup-EG7ZQNBB.js.map} +0 -0
- /package/dist/{to-hwpx-3EVHIIRR.js.map → to-hwpx-2UZJV377.js.map} +0 -0
- /package/dist/{to-hwpx-BTJOOZAD.js.map → to-hwpx-XURJVKKH.js.map} +0 -0
- /package/dist/{visual-GGB2DRCT.js.map → visual-C33QKCQ6.js.map} +0 -0
- /package/dist/{watch-CF76OEMZ.js.map → watch-NSVI3VIY.js.map} +0 -0
|
@@ -39,12 +39,12 @@ import {
|
|
|
39
39
|
sanitizeText,
|
|
40
40
|
tidyScriptTags,
|
|
41
41
|
unframeLayoutTables
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-AI2YUNVV.js";
|
|
43
43
|
import {
|
|
44
44
|
KordocError,
|
|
45
45
|
VERSION,
|
|
46
46
|
sanitizeHref
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-JSLRB4XE.js";
|
|
48
48
|
|
|
49
49
|
// src/hwp5/to-hwpx/index.ts
|
|
50
50
|
import JSZip from "jszip";
|
|
@@ -306,11 +306,13 @@ function appendParaText(state, data2, resolveControl) {
|
|
|
306
306
|
};
|
|
307
307
|
while (i + 1 < data2.length) {
|
|
308
308
|
const ch3 = data2.readUInt16LE(i);
|
|
309
|
+
const script = state.scriptAt ? ch3 >= 32 ? state.scriptAt(wbase + i / 2) : null : void 0;
|
|
310
|
+
if (script !== void 0 && state.script && state.script !== script) setScript(null);
|
|
309
311
|
if (state.emphAt && ch3 >= 32) {
|
|
310
312
|
const key = state.emphAt(wbase + i / 2), runs = state.emphRuns ??= [];
|
|
311
313
|
if (runs.length === 0 || runs[runs.length - 1][1] !== key) runs.push([base + result.length, key]);
|
|
312
314
|
}
|
|
313
|
-
if (
|
|
315
|
+
if (script !== void 0) setScript(script);
|
|
314
316
|
i += 2;
|
|
315
317
|
switch (ch3) {
|
|
316
318
|
// ── char 타입 (2바이트만, 확장 데이터 없음) ──
|
|
@@ -1789,7 +1791,7 @@ function emitParagraphBlocks(p) {
|
|
|
1789
1791
|
if (p.tocEntry) TOC_ENTRY_BLOCKS.add(block);
|
|
1790
1792
|
if (style2) {
|
|
1791
1793
|
block.style = style2;
|
|
1792
|
-
if (style2.strike || style2.underline) block.text = headMarker ? `${headMarker} ${decorate(trimmed)}` : decorate(trimmed);
|
|
1794
|
+
if ((style2.strike || style2.underline) && !block.spans) block.text = headMarker ? `${headMarker} ${decorate(trimmed)}` : decorate(trimmed);
|
|
1793
1795
|
}
|
|
1794
1796
|
if (footnotes.length > 0) block.footnoteText = footnotes.join("; ");
|
|
1795
1797
|
if (footnoteBlocks) block.footnoteBlocks = footnoteBlocks;
|
|
@@ -1938,6 +1940,8 @@ var CTRL_OLE = cid("ole ");
|
|
|
1938
1940
|
var FIELD_HLK = cid("%hlk");
|
|
1939
1941
|
var FIELD_CLK = cid("%clk");
|
|
1940
1942
|
var FIELD_UNK = cid("%unk");
|
|
1943
|
+
var NO_SPAN_CTRLS = /* @__PURE__ */ new Set([cid("tbl "), cid("gso "), cid("eqed"), cid("form"), cid("ole "), cid("tcps"), cid("tdut"), cid("idxm")]);
|
|
1944
|
+
var TEXT_CTRLS = /* @__PURE__ */ new Set([cid("fn "), cid("en "), cid("head"), cid("foot"), cid("tcmt")]);
|
|
1941
1945
|
var KNOWN_CTRL_IDS = /* @__PURE__ */ new Set([
|
|
1942
1946
|
CTRL_TBL,
|
|
1943
1947
|
CTRL_GSO,
|
|
@@ -2147,7 +2151,17 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
2147
2151
|
text = tidyScriptTags(text);
|
|
2148
2152
|
const toc = takeTocLeaders(text);
|
|
2149
2153
|
text = toc.text;
|
|
2150
|
-
const
|
|
2154
|
+
const holdsText = (c) => {
|
|
2155
|
+
for (let k = c.childStart; k < c.childEnd; k++) {
|
|
2156
|
+
if (records[k].tagId !== TAG_PARA_TEXT) continue;
|
|
2157
|
+
const st = createParaTextState();
|
|
2158
|
+
appendParaText(st, records[k].data);
|
|
2159
|
+
if (st.text.trim()) return true;
|
|
2160
|
+
}
|
|
2161
|
+
return false;
|
|
2162
|
+
};
|
|
2163
|
+
const noSpan = ctx.plainText || inlined || fieldsApplied || toc.tocEntry || text.includes("\n") || ctrls.some((c) => NO_SPAN_CTRLS.has(c.id) || TEXT_CTRLS.has(c.id) && holdsText(c));
|
|
2164
|
+
const spans = !noSpan ? emphasisSpans(state, text) : void 0;
|
|
2151
2165
|
if (memoAnchors.length) {
|
|
2152
2166
|
const plain = (t) => resolveLiteralLt(t.replaceAll(LITERAL_DOLLAR_MARK, "$")).replace(/\\</g, "<").replace(/[ \t]+/g, " ").trim();
|
|
2153
2167
|
const paragraph = plain(text.replaceAll(INLINE_TABLE_MARK, ""));
|
|
@@ -2483,7 +2497,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
2483
2497
|
if (cs > 0) colSpan = Math.min(cs, MAX_COLS);
|
|
2484
2498
|
if (rs > 0) rowSpan = Math.min(rs, MAX_ROWS);
|
|
2485
2499
|
}
|
|
2486
|
-
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
2500
|
+
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1, plainText: false }) : [];
|
|
2487
2501
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
2488
2502
|
const cell = { text, colSpan, rowSpan, colAddr, rowAddr };
|
|
2489
2503
|
if (hasStructure && blocks.length > 0) cell.blocks = blocks;
|
|
@@ -2552,7 +2566,7 @@ function parseGsoControl(ctrl2, records, ctx) {
|
|
|
2552
2566
|
}
|
|
2553
2567
|
}
|
|
2554
2568
|
if (textListIdx >= 0) {
|
|
2555
|
-
blocks.push(...parseParagraphList(records, textListIdx + 1, childEnd, { ...ctx, depth: ctx.depth + 1 }));
|
|
2569
|
+
blocks.push(...parseParagraphList(records, textListIdx + 1, childEnd, { ...ctx, depth: ctx.depth + 1, plainText: true }));
|
|
2556
2570
|
}
|
|
2557
2571
|
return blocks;
|
|
2558
2572
|
}
|
|
@@ -3494,7 +3508,7 @@ function borderFill(r, id, ref) {
|
|
|
3494
3508
|
const left = side(), right = side(), top = side(), bottom = side();
|
|
3495
3509
|
const dType = c.u8(), dWidth = c.u8(), dColor = c.u32();
|
|
3496
3510
|
const slash = bits(a, 2, 3), back = bits(a, 5, 3);
|
|
3497
|
-
let inner = el("hh:slash", [["type", pick(SLASH_TYPES, slash)], ["Crooked", bits(a, 8, 2)
|
|
3511
|
+
let inner = el("hh:slash", [["type", pick(SLASH_TYPES, slash)], ["Crooked", bits(a, 8, 2)], ["isCounter", bit(a, 11)]]) + el("hh:backSlash", [["type", pick(SLASH_TYPES, back)], ["Crooked", 0], ["isCounter", bit(a, 12)]]) + el("hh:leftBorder", left) + el("hh:rightBorder", right) + el("hh:topBorder", top) + el("hh:bottomBorder", bottom);
|
|
3498
3512
|
if (dType) inner += el("hh:diagonal", [["type", pick(BORDER_TYPES, dType)], ["width", pick(BORDER_WIDTHS, dWidth)], ["color", color(dColor)]]);
|
|
3499
3513
|
inner += fillBrushXml(c, ref);
|
|
3500
3514
|
return el("hh:borderFill", [
|
|
@@ -3502,7 +3516,7 @@ function borderFill(r, id, ref) {
|
|
|
3502
3516
|
["threeD", bit(a, 0)],
|
|
3503
3517
|
["shadow", bit(a, 1)],
|
|
3504
3518
|
["centerLine", bit(a, 13) ? "VERTICAL" : "NONE"],
|
|
3505
|
-
["breakCellSeparateLine", bit(a,
|
|
3519
|
+
["breakCellSeparateLine", bit(a, 10)]
|
|
3506
3520
|
], inner);
|
|
3507
3521
|
}
|
|
3508
3522
|
function charPr(r, id) {
|
|
@@ -3526,7 +3540,7 @@ function charPr(r, id) {
|
|
|
3526
3540
|
inner += el("hh:underline", [
|
|
3527
3541
|
["type", underType === 2 ? "NONE" : pick(UNDERLINE_TYPES, underType)],
|
|
3528
3542
|
["shape", underType === 2 ? "SOLID" : pick(LINE_SHAPES, bits(a, 4, 4))],
|
|
3529
|
-
["color", color(underColor)]
|
|
3543
|
+
["color", underType === 2 ? "#000000" : color(underColor)]
|
|
3530
3544
|
]);
|
|
3531
3545
|
inner += el("hh:strikeout", [["shape", bits(a, 18, 3) ? pick(LINE_SHAPES, bits(a, 26, 4)) : "NONE"], ["color", color(strikeColor)]]);
|
|
3532
3546
|
inner += el("hh:outline", [["type", pick(OUTLINE_TYPES, bits(a, 8, 3))]]);
|
|
@@ -3555,7 +3569,7 @@ function tabPr(r, id) {
|
|
|
3555
3569
|
const pos = c.i32(), type = c.u8(), leader = c.u8();
|
|
3556
3570
|
c.skip(2);
|
|
3557
3571
|
const common = [["type", pick(TAB_TYPES, type)], ["leader", pick(BORDER_TYPES, leader)]];
|
|
3558
|
-
inner += unitSwitch(el("hh:tabItem", [["pos", Math.trunc(pos / 2)], ...common, ["unit", "HWPUNIT"]]), el("hh:tabItem", [["pos", pos], ...common]));
|
|
3572
|
+
inner += unitSwitch(el("hh:tabItem", [["pos", Math.trunc(pos / 2)], ...common, ["unit", pos % 2 ? "CHAR" : "HWPUNIT"]]), el("hh:tabItem", [["pos", pos], ...common]));
|
|
3559
3573
|
}
|
|
3560
3574
|
return el("hh:tabPr", [["id", id], ["autoTabLeft", bit(a, 0)], ["autoTabRight", bit(a, 1)]], inner || void 0);
|
|
3561
3575
|
}
|
|
@@ -3597,16 +3611,13 @@ function bullet(r, id) {
|
|
|
3597
3611
|
const head = paraHeadAttrs(c);
|
|
3598
3612
|
const ch3 = String.fromCharCode(c.u16());
|
|
3599
3613
|
const imageId = c.i32();
|
|
3600
|
-
const
|
|
3601
|
-
c.skip(4);
|
|
3602
|
-
const checked = c.rest >= 2 ? c.u16() : 0;
|
|
3614
|
+
const checked = r.data.length >= 24 ? r.data.readUInt16LE(r.data.length - 2) : 0;
|
|
3603
3615
|
let inner = el("hh:paraHead", [["level", 0], ...head]);
|
|
3604
3616
|
if (imageId) inner = el("hc:img", []) + inner;
|
|
3605
|
-
void imgStart;
|
|
3606
3617
|
return el("hh:bullet", [
|
|
3607
3618
|
["id", id],
|
|
3608
3619
|
["char", ch3],
|
|
3609
|
-
...checked ? [["checkedChar", String.fromCharCode(checked)]] : [],
|
|
3620
|
+
...checked > 32 ? [["checkedChar", String.fromCharCode(checked)]] : [],
|
|
3610
3621
|
["useImage", imageId ? 1 : 0]
|
|
3611
3622
|
], inner);
|
|
3612
3623
|
}
|
|
@@ -3625,10 +3636,9 @@ function paraPr(r, id) {
|
|
|
3625
3636
|
const level = r.data.length >= 58 ? c.u32() : bits(a1, 25, 3);
|
|
3626
3637
|
const headType = pick(HEADING_TYPES, bits(a1, 23, 2));
|
|
3627
3638
|
const heading = level >= 7 ? `<hp:switch><hp:case hp:required-namespace="http://www.hancom.co.kr/hwpml/2016/paragraph">${el("hh:heading", [["type", headType], ["idRef", headId], ["level", level]])}</hp:case><hp:default>${el("hh:heading", [["type", "NONE"], ["idRef", 0], ["level", 0]])}</hp:default></hp:switch>` : el("hh:heading", [["type", headType], ["idRef", headId], ["level", level]]);
|
|
3628
|
-
const margins = (div
|
|
3629
|
-
const
|
|
3630
|
-
|
|
3631
|
-
return "<hh:margin>" + el("hc:intent", [["value", v(indent)], ...u]) + el("hc:left", [["value", v(left)], ...u]) + el("hc:right", [["value", v(right)], ...u]) + el("hc:prev", [["value", v(prev)], ...u]) + el("hc:next", [["value", v(next)], ...u]) + "</hh:margin>";
|
|
3639
|
+
const margins = (div) => {
|
|
3640
|
+
const m = (tag, x) => el(tag, [["value", div === 1 ? x : Math.trunc(x / div)], ["unit", div !== 1 && x % 2 ? "CHAR" : "HWPUNIT"]]);
|
|
3641
|
+
return "<hh:margin>" + m("hc:intent", indent) + m("hc:left", left) + m("hc:right", right) + m("hc:prev", prev) + m("hc:next", next) + "</hh:margin>";
|
|
3632
3642
|
};
|
|
3633
3643
|
const lineSpacing = (div) => el("hh:lineSpacing", [
|
|
3634
3644
|
["type", pick(LINE_SPACINGS, spType)],
|
|
@@ -3643,7 +3653,7 @@ function paraPr(r, id) {
|
|
|
3643
3653
|
["keepLines", bit(a1, 18)],
|
|
3644
3654
|
["pageBreakBefore", bit(a1, 19)],
|
|
3645
3655
|
["lineWrap", pick(LINE_WRAPS, bits(a2, 0, 2))]
|
|
3646
|
-
]) + el("hh:autoSpacing", [["eAsianEng", bit(a2, 4)], ["eAsianNum", bit(a2, 5)]]) + unitSwitch(margins(2
|
|
3656
|
+
]) + el("hh:autoSpacing", [["eAsianEng", bit(a2, 4)], ["eAsianNum", bit(a2, 5)]]) + unitSwitch(margins(2) + lineSpacing(2), margins(1) + lineSpacing(1)) + el("hh:border", [
|
|
3647
3657
|
["borderFillIDRef", borderFillId],
|
|
3648
3658
|
["offsetLeft", off[0]],
|
|
3649
3659
|
["offsetRight", off[1]],
|
|
@@ -3659,10 +3669,11 @@ function paraPr(r, id) {
|
|
|
3659
3669
|
["fontLineHeight", bit(a1, 22)],
|
|
3660
3670
|
["snapToGrid", bit(a1, 8)],
|
|
3661
3671
|
["suppressLineNumbers", bit(a2, 2)],
|
|
3662
|
-
["checked", 0]
|
|
3672
|
+
["checked", 0],
|
|
3673
|
+
["textDir", bit(a2, 3) ? "LTR" : "AUTO"]
|
|
3663
3674
|
], inner);
|
|
3664
3675
|
}
|
|
3665
|
-
function style(r, id) {
|
|
3676
|
+
function style(r, id, paraIds) {
|
|
3666
3677
|
const c = new Cur(r.data);
|
|
3667
3678
|
const name = c.str(), engName = c.str();
|
|
3668
3679
|
const a = c.u8(), nextId = c.u8(), langId = c.i16(), paraShape = c.u16(), charShape = c.u16();
|
|
@@ -3671,7 +3682,7 @@ function style(r, id) {
|
|
|
3671
3682
|
["type", bits(a, 0, 2) === 1 ? "CHAR" : "PARA"],
|
|
3672
3683
|
["name", name],
|
|
3673
3684
|
["engName", engName],
|
|
3674
|
-
["paraPrIDRef", paraShape],
|
|
3685
|
+
["paraPrIDRef", paraIds[paraShape] ?? paraShape],
|
|
3675
3686
|
["charPrIDRef", charShape],
|
|
3676
3687
|
["nextStyleIDRef", nextId],
|
|
3677
3688
|
["langID", langId],
|
|
@@ -3699,26 +3710,40 @@ function docProps(recs) {
|
|
|
3699
3710
|
const begin = [c.u16(), c.u16(), c.u16(), c.u16(), c.u16(), c.u16()];
|
|
3700
3711
|
return { secCnt, begin, caret: [c.u32(), c.u32(), c.u32()] };
|
|
3701
3712
|
}
|
|
3702
|
-
|
|
3703
|
-
|
|
3713
|
+
var SLOT = {
|
|
3714
|
+
[TAG.BORDER_FILL]: 8,
|
|
3715
|
+
[TAG.CHAR_SHAPE]: 9,
|
|
3716
|
+
[TAG.TAB_DEF]: 10,
|
|
3717
|
+
[TAG.NUMBERING]: 11,
|
|
3718
|
+
[TAG.BULLET]: 12,
|
|
3719
|
+
[TAG.PARA_SHAPE]: 13,
|
|
3720
|
+
[TAG.STYLE]: 14,
|
|
3721
|
+
[TAG.MEMO_SHAPE]: 15
|
|
3722
|
+
};
|
|
3723
|
+
function idCounts(recs) {
|
|
3704
3724
|
const idm = new Cur(recs.find((r) => r.tagId === TAG.ID_MAPPINGS)?.data ?? Buffer.alloc(0));
|
|
3705
3725
|
const counts = [];
|
|
3706
3726
|
while (idm.rest >= 4) counts.push(idm.i32());
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3727
|
+
return counts;
|
|
3728
|
+
}
|
|
3729
|
+
function recordsOf(recs, counts, tag) {
|
|
3730
|
+
const all = recs.filter((r) => r.tagId === tag);
|
|
3731
|
+
const n = counts[SLOT[tag] ?? -1];
|
|
3732
|
+
return n !== void 0 && n >= 0 ? all.slice(0, n) : all;
|
|
3733
|
+
}
|
|
3734
|
+
function paraShapeIds(recs) {
|
|
3735
|
+
const seen = /* @__PURE__ */ new Map();
|
|
3736
|
+
return recordsOf(recs, idCounts(recs), TAG.PARA_SHAPE).map((r) => {
|
|
3737
|
+
const k = r.data.toString("hex");
|
|
3738
|
+
if (!seen.has(k)) seen.set(k, seen.size);
|
|
3739
|
+
return seen.get(k);
|
|
3740
|
+
});
|
|
3741
|
+
}
|
|
3742
|
+
function headerXml(recs, linkInfo, ref, secCnt) {
|
|
3743
|
+
const props = docProps(recs);
|
|
3744
|
+
const counts = idCounts(recs);
|
|
3745
|
+
const of = (tag) => recordsOf(recs, counts, tag);
|
|
3746
|
+
const paraIds = paraShapeIds(recs);
|
|
3722
3747
|
const list = (name, items) => items.length ? el(name, [["itemCnt", items.length]], items.join("")) : "";
|
|
3723
3748
|
const [bPage, bFoot, bEnd, bPic, bTbl, bEq] = props.begin;
|
|
3724
3749
|
let refList = fontFaces(of(TAG.FACE_NAME), counts.slice(1, 8));
|
|
@@ -3727,8 +3752,8 @@ function headerXml(recs, linkInfo, ref, secCnt) {
|
|
|
3727
3752
|
refList += list("hh:tabProperties", of(TAG.TAB_DEF).map((r, i) => tabPr(r, i)));
|
|
3728
3753
|
refList += list("hh:numberings", of(TAG.NUMBERING).map((r, i) => numbering(r, i + 1)));
|
|
3729
3754
|
refList += list("hh:bullets", of(TAG.BULLET).map((r, i) => bullet(r, i + 1)));
|
|
3730
|
-
refList += list("hh:paraProperties", of(TAG.PARA_SHAPE).
|
|
3731
|
-
refList += list("hh:styles", of(TAG.STYLE).map((r, i) => style(r, i)));
|
|
3755
|
+
refList += list("hh:paraProperties", of(TAG.PARA_SHAPE).flatMap((r, i) => paraIds.indexOf(paraIds[i]) === i ? [paraPr(r, paraIds[i])] : []));
|
|
3756
|
+
refList += list("hh:styles", of(TAG.STYLE).map((r, i) => style(r, i, paraIds)));
|
|
3732
3757
|
refList += list("hh:memoProperties", of(TAG.MEMO_SHAPE).map((r, i) => memoPr(r, i + 1)));
|
|
3733
3758
|
const compat = new Cur(recs.find((r) => r.tagId === TAG.COMPATIBLE_DOCUMENT)?.data ?? Buffer.alloc(0)).u32();
|
|
3734
3759
|
const track = new Cur(recs.find((r) => r.tagId === TAG.TRACKCHANGE)?.data ?? Buffer.alloc(0)).u32();
|
|
@@ -3782,12 +3807,12 @@ function params(type, prop, command) {
|
|
|
3782
3807
|
if (type === "BOOKMARK") return `<hp:parameters cnt="1" name="">${items[0]}</hp:parameters>`;
|
|
3783
3808
|
items.push(str("Command", command, preserve));
|
|
3784
3809
|
if (type === "CLICK_HERE") {
|
|
3785
|
-
items.push(str("Direction", wstringValue(command, "Direction")));
|
|
3810
|
+
if (/Direction:wstring:/.test(command)) items.push(str("Direction", wstringValue(command, "Direction")));
|
|
3786
3811
|
const help = wstringValue(command, "HelpState");
|
|
3787
3812
|
if (help) items.push(str("HelpState", help));
|
|
3788
3813
|
} else if (type === "HYPERLINK") {
|
|
3789
3814
|
const parts = command.split(/(?<!\\);/);
|
|
3790
|
-
items.push(str("Path", parts[0].replace(/\\(.)/g, "$1")));
|
|
3815
|
+
if (parts[0]) items.push(str("Path", parts[0].replace(/\\(.)/g, "$1")));
|
|
3791
3816
|
items.push(str("Category", LINK_CATEGORIES[Number(parts[1])] ?? LINK_CATEGORIES[1]));
|
|
3792
3817
|
items.push(str("TargetType", LINK_TARGETS[Number(parts[2])] ?? LINK_TARGETS[0]));
|
|
3793
3818
|
items.push(str("DocOpenType", LINK_OPENS[Number(parts[3])] ?? LINK_OPENS[0]));
|
|
@@ -3930,7 +3955,7 @@ var SHADOW_TYPES2 = [
|
|
|
3930
3955
|
"SHEAR_LEFTTOP",
|
|
3931
3956
|
"SHEAR_RIGHTTOP"
|
|
3932
3957
|
];
|
|
3933
|
-
function lineShapeXml(lineColor, width, a, outline) {
|
|
3958
|
+
function lineShapeXml(lineColor, width, a, outline, alpha = 0) {
|
|
3934
3959
|
return el("hp:lineShape", [
|
|
3935
3960
|
["color", color(lineColor)],
|
|
3936
3961
|
["width", width],
|
|
@@ -3943,18 +3968,17 @@ function lineShapeXml(lineColor, width, a, outline) {
|
|
|
3943
3968
|
["headSz", pick(ARROW_SIZES, bits(a, 22, 4))],
|
|
3944
3969
|
["tailSz", pick(ARROW_SIZES, bits(a, 26, 4))],
|
|
3945
3970
|
["outlineStyle", pick(OUTLINE_STYLES, outline)],
|
|
3946
|
-
["alpha",
|
|
3971
|
+
["alpha", alpha]
|
|
3947
3972
|
]);
|
|
3948
3973
|
}
|
|
3949
3974
|
function drawingStyle(k, ctx) {
|
|
3950
3975
|
const c = k.rest;
|
|
3951
3976
|
const lineColor = c.u32(), width = c.i32(), a = c.u32(), outline = c.u8();
|
|
3952
|
-
const line = lineShapeXml(lineColor, width, a, outline);
|
|
3953
3977
|
const fill = fillBrushXml(c, ctx.binRef);
|
|
3954
3978
|
const sType = c.u32(), sColor = c.u32(), sx = c.i32(), sy = c.i32();
|
|
3955
3979
|
const instId = c.u32();
|
|
3956
|
-
c.u8();
|
|
3957
|
-
const
|
|
3980
|
+
const lineAlpha = c.u8(), sAlpha = c.u8();
|
|
3981
|
+
const line = lineShapeXml(lineColor, width, a, outline, lineAlpha);
|
|
3958
3982
|
const shadow = el("hp:shadow", [["type", pick(SHADOW_TYPES2, sType)], ["color", color(sColor)], ["offsetX", sx], ["offsetY", sy], ["alpha", sAlpha]]);
|
|
3959
3983
|
return { xml: line + fill + shadow, instId };
|
|
3960
3984
|
}
|
|
@@ -3977,14 +4001,14 @@ var pt = (name, c) => el(name, [["x", c.i32()], ["y", c.i32()]]);
|
|
|
3977
4001
|
function shapeHref(comp) {
|
|
3978
4002
|
const cd = comp.kids.find((x) => x.rec.tagId === TAG_CTRL_DATA);
|
|
3979
4003
|
const v = cd ? subSet(readParamSet(cd.rec.data, { o: 0 }), 623)?.[613] : void 0;
|
|
3980
|
-
return typeof v === "string" ? v : "";
|
|
4004
|
+
return typeof v === "string" ? v.replace(/\\:/g, ":") : "";
|
|
3981
4005
|
}
|
|
3982
4006
|
function shapeXml(comp, o, description, ctx, caption) {
|
|
3983
4007
|
const k = readComponent(comp);
|
|
3984
4008
|
const sub = (tag) => new Cur(comp.kids.find((x) => x.rec.tagId === tag)?.rec.data ?? Buffer.alloc(0));
|
|
3985
4009
|
const head = o ? objHeadAttrs(o) : [["id", 0], ["zOrder", 0], ["numberingType", "NONE"], ["textWrap", "TOP_AND_BOTTOM"], ["textFlow", "BOTH_SIDES"], ["lock", 0], ["dropcapstyle", "None"]];
|
|
3986
4010
|
const comment = o && description ? `<hp:shapeComment>${escText(description)}</hp:shapeComment>` : "";
|
|
3987
|
-
const tail =
|
|
4011
|
+
const tail = o ? objPlacementXml(o) + comment + caption : comment;
|
|
3988
4012
|
const common = componentHeadXml(k);
|
|
3989
4013
|
const href = shapeHref(comp);
|
|
3990
4014
|
if (k.kind === "$pic") {
|
|
@@ -4104,6 +4128,7 @@ function oleXml(comp, k, head, common, o, caption, comment, ctx) {
|
|
|
4104
4128
|
const r = new Cur(comp.kids.find((x) => x.rec.tagId === TAG_SHAPE.OLE)?.rec.data ?? Buffer.alloc(0));
|
|
4105
4129
|
const a = r.u32(), ex = r.i32(), ey = r.i32(), binId = r.u16();
|
|
4106
4130
|
const lineColor = r.u32(), lineWidth = r.i32(), la = r.u32();
|
|
4131
|
+
const instId = r.rest >= 4 ? r.u32() : 0;
|
|
4107
4132
|
const line = el("hp:lineShape", [
|
|
4108
4133
|
["color", color(lineColor)],
|
|
4109
4134
|
["width", lineWidth],
|
|
@@ -4126,9 +4151,9 @@ function oleXml(comp, k, head, common, o, caption, comment, ctx) {
|
|
|
4126
4151
|
...head,
|
|
4127
4152
|
["href", shapeHref(comp)],
|
|
4128
4153
|
["groupLevel", k.groupLevel],
|
|
4129
|
-
["instid",
|
|
4154
|
+
["instid", instId],
|
|
4130
4155
|
["objectType", pick(OLE_TYPES, bits(a, 16, 6))],
|
|
4131
|
-
["binaryItemIDRef", ctx.oleRef(binId
|
|
4156
|
+
["binaryItemIDRef", ctx.oleRef(binId)],
|
|
4132
4157
|
["hasMoniker", bit(a, 8)],
|
|
4133
4158
|
["drawAspect", OLE_ASPECTS[bits(a, 0, 8)] ?? "CONTENT"],
|
|
4134
4159
|
["eqBaseLine", bits(a, 9, 7)]
|
|
@@ -4220,10 +4245,11 @@ function otherControlXml(id, node, ctx) {
|
|
|
4220
4245
|
case "fn ":
|
|
4221
4246
|
case "en ": {
|
|
4222
4247
|
const c = data(node);
|
|
4223
|
-
const
|
|
4224
|
-
c.u32();
|
|
4248
|
+
const num = c.u32(), prefix = c.u16(), suffix = c.u16();
|
|
4249
|
+
const flag = c.u32();
|
|
4225
4250
|
const instId = c.u32();
|
|
4226
|
-
const attrs2 = [["number",
|
|
4251
|
+
const attrs2 = [...flag ? [["flag", flag]] : [], ["number", num & 65535]];
|
|
4252
|
+
if (num >>> 16) attrs2.push(["userChar", num >>> 16]);
|
|
4227
4253
|
if (id === "en " || prefix) attrs2.push(["prefixChar", prefix]);
|
|
4228
4254
|
attrs2.push(["suffixChar", suffix], ["instId", instId]);
|
|
4229
4255
|
return ctrl(el(id === "fn " ? "hp:footNote" : "hp:endNote", attrs2, subListXml(node, ctx, false)));
|
|
@@ -4694,7 +4720,7 @@ function paragraphXml(p, ctx) {
|
|
|
4694
4720
|
}
|
|
4695
4721
|
return el("hp:p", [
|
|
4696
4722
|
["id", instanceId],
|
|
4697
|
-
["paraPrIDRef", paraShape],
|
|
4723
|
+
["paraPrIDRef", ctx.paraIds[paraShape] ?? paraShape],
|
|
4698
4724
|
["styleIDRef", styleId],
|
|
4699
4725
|
["pageBreak", bit(breaks, 2)],
|
|
4700
4726
|
["columnBreak", bit(breaks, 3)],
|
|
@@ -4906,6 +4932,7 @@ function secPrXml(node, ctx) {
|
|
|
4906
4932
|
}
|
|
4907
4933
|
}
|
|
4908
4934
|
const data2 = node.kids.find((k) => k.rec.tagId === TAG2.CTRL_DATA);
|
|
4935
|
+
const memoShape = node.rec.data.length >= 38 ? node.rec.data.readUInt32LE(34) : ctx.memoShapes ? 1 : 0;
|
|
4909
4936
|
return el(
|
|
4910
4937
|
"hp:secPr",
|
|
4911
4938
|
[
|
|
@@ -4914,9 +4941,9 @@ function secPrXml(node, ctx) {
|
|
|
4914
4941
|
["spaceColumns", spaceColumns],
|
|
4915
4942
|
["tabStop", tabStop],
|
|
4916
4943
|
["tabStopVal", Math.trunc(tabStop / 2)],
|
|
4917
|
-
["tabStopUnit", "HWPUNIT"],
|
|
4944
|
+
["tabStopUnit", tabStop % 2 ? "CHAR" : "HWPUNIT"],
|
|
4918
4945
|
["outlineShapeIDRef", outline],
|
|
4919
|
-
["memoShapeIDRef",
|
|
4946
|
+
["memoShapeIDRef", memoShape],
|
|
4920
4947
|
["textVerticalWidthHead", 0],
|
|
4921
4948
|
["masterPageCnt", masters.length]
|
|
4922
4949
|
],
|
|
@@ -5073,6 +5100,34 @@ function scriptParts(data2) {
|
|
|
5073
5100
|
}
|
|
5074
5101
|
return [parts[0], parts[1]];
|
|
5075
5102
|
}
|
|
5103
|
+
function memoExtendedXml(raw, compressed) {
|
|
5104
|
+
if (!raw) return null;
|
|
5105
|
+
let rec;
|
|
5106
|
+
try {
|
|
5107
|
+
rec = readRecords(compressed ? decompressStream(raw) : raw).find((r) => r.tagId === 101);
|
|
5108
|
+
} catch {
|
|
5109
|
+
return null;
|
|
5110
|
+
}
|
|
5111
|
+
if (!rec || rec.data.length < 4) return null;
|
|
5112
|
+
const c = new Cur(rec.data);
|
|
5113
|
+
const memos = [];
|
|
5114
|
+
for (let n = c.u32(); n > 0 && c.rest >= 8; n--) memos.push(el("he:memo", [["id", c.u32()], ["parentId", c.u32()]]));
|
|
5115
|
+
return memos.length ? XML_DECL + `<he:memosEx xmlns:he="http://www.hancom.co.kr/hwpml/2021/extended">${memos.join("")}</he:memosEx>` : null;
|
|
5116
|
+
}
|
|
5117
|
+
var EMPTY_BORDER_FILL = '<hh:borderFill id="1" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0"><hh:slash type="NONE" Crooked="0" isCounter="0"/><hh:backSlash type="NONE" Crooked="0" isCounter="0"/>' + ["left", "right", "top", "bottom"].map((s) => `<hh:${s}Border type="NONE" width="0.1 mm" color="#000000"/>`).join("") + '<hh:diagonal type="SOLID" width="0.1 mm" color="#000000"/></hh:borderFill>';
|
|
5118
|
+
function shiftZeroBorderFill(parts) {
|
|
5119
|
+
if (![...parts.values()].some((x) => x.includes('borderFillIDRef="0"'))) return parts;
|
|
5120
|
+
const out = /* @__PURE__ */ new Map();
|
|
5121
|
+
for (const [name, xml] of parts) {
|
|
5122
|
+
let x = xml.replace(/borderFillIDRef="(\d+)"/g, (_, n) => `borderFillIDRef="${Number(n) + 1}"`);
|
|
5123
|
+
if (name === "Contents/header.xml") {
|
|
5124
|
+
x = x.replace(/<hh:borderFill id="(\d+)"/g, (_, n) => `<hh:borderFill id="${Number(n) + 1}"`);
|
|
5125
|
+
x = x.includes("<hh:borderFills ") ? x.replace(/<hh:borderFills itemCnt="(\d+)">/, (_, n) => `<hh:borderFills itemCnt="${Number(n) + 1}">${EMPTY_BORDER_FILL}`) : x.replace("</hh:fontfaces>", `</hh:fontfaces><hh:borderFills itemCnt="1">${EMPTY_BORDER_FILL}</hh:borderFills>`);
|
|
5126
|
+
}
|
|
5127
|
+
out.set(name, x);
|
|
5128
|
+
}
|
|
5129
|
+
return out;
|
|
5130
|
+
}
|
|
5076
5131
|
var V13_DEFAULT_SCRIPT = "function OnDocument_New()\r\n{\r\n //todo : \r\n}\r\n\r\n";
|
|
5077
5132
|
async function hwpToHwpx(input, options) {
|
|
5078
5133
|
const buffer = Buffer.from(input instanceof ArrayBuffer ? new Uint8Array(input) : input);
|
|
@@ -5095,11 +5150,12 @@ async function hwpToHwpx(input, options) {
|
|
|
5095
5150
|
const refs = /* @__PURE__ */ new Map();
|
|
5096
5151
|
const refer = (binId, kind) => {
|
|
5097
5152
|
let r = refs.get(binId);
|
|
5098
|
-
if (!r) refs.set(binId, r = { id: `${kind
|
|
5153
|
+
if (!r) refs.set(binId, r = { id: `${kind}${refs.size + 1}`, kind });
|
|
5099
5154
|
return r.id;
|
|
5100
5155
|
};
|
|
5101
5156
|
const ctx = {
|
|
5102
5157
|
memoShapes: docInfo.filter((r) => r.tagId === TAG_MEMO_SHAPE).length,
|
|
5158
|
+
paraIds: paraShapeIds(docInfo),
|
|
5103
5159
|
fields: { stack: [] },
|
|
5104
5160
|
masterPages: [],
|
|
5105
5161
|
tailMasters: [],
|
|
@@ -5115,7 +5171,7 @@ async function hwpToHwpx(input, options) {
|
|
|
5115
5171
|
return name;
|
|
5116
5172
|
},
|
|
5117
5173
|
binRef: (binId) => refer(binId, "image"),
|
|
5118
|
-
oleRef: (binId
|
|
5174
|
+
oleRef: (binId) => refer(binId, "ole")
|
|
5119
5175
|
};
|
|
5120
5176
|
const zip = new JSZip();
|
|
5121
5177
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
@@ -5135,34 +5191,40 @@ async function hwpToHwpx(input, options) {
|
|
|
5135
5191
|
]),
|
|
5136
5192
|
{ compression: "STORE" }
|
|
5137
5193
|
);
|
|
5138
|
-
|
|
5194
|
+
const parts = /* @__PURE__ */ new Map([["Contents/header.xml", headerXml(docInfo, link, ctx.binRef, sections.length)]]);
|
|
5139
5195
|
const sectionNames = [];
|
|
5140
5196
|
const sectionItems = [];
|
|
5141
5197
|
sections.forEach((recs, i) => {
|
|
5142
5198
|
const name = `Contents/section${i}.xml`;
|
|
5143
5199
|
const mp0 = ctx.masterPages.length;
|
|
5144
|
-
|
|
5200
|
+
parts.set(name, sectionXml(recordTree(recs ?? []), ctx));
|
|
5145
5201
|
for (let k = mp0; k < ctx.masterPages.length; k++) {
|
|
5146
|
-
|
|
5202
|
+
parts.set(`Contents/masterpage${k}.xml`, ctx.masterPages[k]);
|
|
5147
5203
|
sectionItems.push(el("opf:item", [["id", `masterpage${k}`], ["href", `Contents/masterpage${k}.xml`], ["media-type", "application/xml"]]));
|
|
5148
5204
|
}
|
|
5149
5205
|
sectionNames.push(name);
|
|
5150
5206
|
sectionItems.push(el("opf:item", [["id", `section${i}`], ["href", name], ["media-type", "application/xml"]]));
|
|
5151
5207
|
});
|
|
5208
|
+
for (const [name, xml] of shiftZeroBorderFill(parts)) zip.file(name, xml);
|
|
5152
5209
|
for (const b of items) if (!refs.has(b.index)) refer(b.index, b.ole ? "ole" : "image");
|
|
5153
5210
|
const manifest = [el("opf:item", [["id", "header"], ["href", "Contents/header.xml"], ["media-type", "application/xml"]])];
|
|
5211
|
+
const memoEx = memoExtendedXml(c.findStream("/MemoExtended"), c.compressed);
|
|
5212
|
+
if (memoEx) {
|
|
5213
|
+
zip.file("Contents/memoExtended.xml", memoEx);
|
|
5214
|
+
manifest.push(el("opf:item", [["id", "memoextended"], ["href", "Contents/memoExtended.xml"], ["media-type", "application/xml"]]));
|
|
5215
|
+
}
|
|
5154
5216
|
for (const [binId, r] of refs) {
|
|
5155
5217
|
const b = items.find((x) => x.index === binId);
|
|
5156
5218
|
const data2 = b && bins.get(b.storageId);
|
|
5157
5219
|
if (!b || !data2) continue;
|
|
5158
|
-
const ext = r.kind === "
|
|
5220
|
+
const ext = r.kind === "ole" ? "ole" : /\.([^.]+)$/.exec(data2.name)?.[1] ?? b.ext;
|
|
5159
5221
|
const name = `BinData/${r.id}.${ext}`;
|
|
5160
5222
|
zip.file(name, data2.data, /^(png|jpe?g|gif)$/i.test(ext) ? { compression: "STORE" } : void 0);
|
|
5161
5223
|
manifest.push(el("opf:item", [
|
|
5162
5224
|
["id", r.id],
|
|
5163
5225
|
["href", name],
|
|
5164
|
-
["media-type", r.kind === "
|
|
5165
|
-
["isEmbeded", r.kind === "
|
|
5226
|
+
["media-type", r.kind === "ole" ? "application/ole" : `image/${ext.toLowerCase()}`],
|
|
5227
|
+
["isEmbeded", r.kind === "ole" ? 0 : 1]
|
|
5166
5228
|
]));
|
|
5167
5229
|
}
|
|
5168
5230
|
manifest.push(...sectionItems);
|
|
@@ -5208,7 +5270,7 @@ async function convertToHwpx(input, options) {
|
|
|
5208
5270
|
if (format === "hwpx") return { data: bytes, mode: "preserve", warnings: ["\uC774\uBBF8 HWPX \uBB38\uC11C\uC785\uB2C8\uB2E4 \u2014 \uADF8\uB300\uB85C \uB461\uB2C8\uB2E4"] };
|
|
5209
5271
|
if (format !== "hwp3" && format !== "hwpml") throw new KordocError(`HWP \uBB38\uC11C\uAC00 \uC544\uB2D9\uB2C8\uB2E4 (${format})`);
|
|
5210
5272
|
const { parse } = await import("./index.js");
|
|
5211
|
-
const { markdownToHwpx } = await import("./generator-
|
|
5273
|
+
const { markdownToHwpx } = await import("./generator-MIX4R7HL.js");
|
|
5212
5274
|
const parsed = await parse(ab, { password: options?.password });
|
|
5213
5275
|
if (!parsed.success) throw new KordocError(parsed.error ?? "\uBB38\uC11C\uB97C \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4");
|
|
5214
5276
|
return {
|
|
@@ -5270,4 +5332,4 @@ export {
|
|
|
5270
5332
|
hwpToHwpx,
|
|
5271
5333
|
convertToHwpx
|
|
5272
5334
|
};
|
|
5273
|
-
//# sourceMappingURL=chunk-
|
|
5335
|
+
//# sourceMappingURL=chunk-64CA5E3N.js.map
|