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
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
HEADING_RATIO_H3,
|
|
10
10
|
tidyScriptTags,
|
|
11
11
|
unframeLayoutTables
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UVUKT3IQ.js";
|
|
13
13
|
import {
|
|
14
14
|
parsePageRange
|
|
15
15
|
} from "./chunk-VQFA55IC.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
findChildByLocalName,
|
|
23
23
|
hwpFaceToCssStack,
|
|
24
24
|
parseRenderStyles
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RSDUH4XF.js";
|
|
26
26
|
import {
|
|
27
27
|
MAX_COLS,
|
|
28
28
|
MAX_ROWS,
|
|
@@ -33,18 +33,18 @@ import {
|
|
|
33
33
|
flattenLayoutTables,
|
|
34
34
|
mapPuaText,
|
|
35
35
|
markNonLayoutTable
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-W3RADOLO.js";
|
|
37
37
|
import {
|
|
38
38
|
loadSharp,
|
|
39
39
|
rasterizePageSvg
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-KSJ7GKNQ.js";
|
|
41
41
|
import {
|
|
42
42
|
KordocError,
|
|
43
43
|
escapeHtml,
|
|
44
44
|
precheckZipSize,
|
|
45
45
|
sanitizeHref,
|
|
46
46
|
toArrayBuffer
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-VGDTONTB.js";
|
|
48
48
|
|
|
49
49
|
// src/render/svg-render.ts
|
|
50
50
|
import JSZip from "jszip";
|
|
@@ -1732,7 +1732,7 @@ var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "nbSpace",
|
|
|
1732
1732
|
function pushFillers(chars, n, prId) {
|
|
1733
1733
|
for (let i = 0; i < n; i++) chars.push({ ch: "", prId });
|
|
1734
1734
|
}
|
|
1735
|
-
function pushTextSlots(t, chars, prId, depth) {
|
|
1735
|
+
function pushTextSlots(t, chars, prId, depth, del = { deleted: 0 }) {
|
|
1736
1736
|
if (depth > 32) return;
|
|
1737
1737
|
const kids = t.childNodes;
|
|
1738
1738
|
if (!kids) return;
|
|
@@ -1740,19 +1740,24 @@ function pushTextSlots(t, chars, prId, depth) {
|
|
|
1740
1740
|
const c = kids[i];
|
|
1741
1741
|
if (c.nodeType === 3 || c.nodeType === 4) {
|
|
1742
1742
|
for (const cp of c.textContent ?? "") {
|
|
1743
|
-
chars.push({ ch: cp, prId });
|
|
1743
|
+
chars.push({ ch: del.deleted ? "" : cp, prId });
|
|
1744
1744
|
if (cp.length === 2) chars.push({ ch: "", prId });
|
|
1745
1745
|
}
|
|
1746
1746
|
} else if (c.nodeType === 1) {
|
|
1747
1747
|
const el = c;
|
|
1748
1748
|
const tag = ln(el);
|
|
1749
|
-
if (tag === "
|
|
1750
|
-
|
|
1751
|
-
|
|
1749
|
+
if (tag === "deleteBegin" || tag === "deleteEnd") {
|
|
1750
|
+
del.deleted = deletionDelta(el, del.deleted);
|
|
1751
|
+
} else if (tag === "tab") {
|
|
1752
|
+
if (del.deleted) pushFillers(chars, 8, prId);
|
|
1753
|
+
else {
|
|
1754
|
+
chars.push({ ch: "", prId, tab: true, tabW: num(el, "width") });
|
|
1755
|
+
pushFillers(chars, 7, prId);
|
|
1756
|
+
}
|
|
1752
1757
|
} else if (CHAR_CTRL_1SLOT.has(tag)) {
|
|
1753
|
-
chars.push(tag === "nbSpace" ? { ch: " ", prId, nb: true } : { ch: tag === "fwSpace" ? " " : "", prId });
|
|
1758
|
+
chars.push(del.deleted ? { ch: "", prId } : tag === "nbSpace" ? { ch: " ", prId, nb: true } : { ch: tag === "fwSpace" ? " " : "", prId });
|
|
1754
1759
|
} else {
|
|
1755
|
-
pushTextSlots(el, chars, prId, depth + 1);
|
|
1760
|
+
pushTextSlots(el, chars, prId, depth + 1, del);
|
|
1756
1761
|
}
|
|
1757
1762
|
}
|
|
1758
1763
|
}
|
|
@@ -1777,7 +1782,7 @@ function prepareDeletedRanges(root, depth = 0) {
|
|
|
1777
1782
|
deletedStarts.set(p, deleted);
|
|
1778
1783
|
const scan = (el, xmlDepth) => {
|
|
1779
1784
|
if (xmlDepth > 64) return;
|
|
1780
|
-
if (ln(el) === "ctrl") for (const ch of elements(el)) scan(ch, xmlDepth + 1);
|
|
1785
|
+
if (ln(el) === "ctrl" || ln(el) === "t") for (const ch of elements(el)) scan(ch, xmlDepth + 1);
|
|
1781
1786
|
else {
|
|
1782
1787
|
if (ln(el) === "deleteBegin" || ln(el) === "deleteEnd") deleted = deletionDelta(el, deleted);
|
|
1783
1788
|
deletedControls.set(el, deleted > 0);
|
|
@@ -1809,9 +1814,9 @@ function buildPara(p) {
|
|
|
1809
1814
|
for (const ch of elements(runEl)) {
|
|
1810
1815
|
const cn = ln(ch);
|
|
1811
1816
|
if (cn === "t") {
|
|
1812
|
-
const
|
|
1813
|
-
pushTextSlots(ch, chars, prId, 0);
|
|
1814
|
-
|
|
1817
|
+
const del = { deleted };
|
|
1818
|
+
pushTextSlots(ch, chars, prId, 0, del);
|
|
1819
|
+
deleted = del.deleted;
|
|
1815
1820
|
} else if (OBJ_TAGS.has(cn)) {
|
|
1816
1821
|
const sz = findChildByLocalName(ch, "sz");
|
|
1817
1822
|
const pos = findChildByLocalName(ch, "pos");
|
|
@@ -2333,14 +2338,15 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
2333
2338
|
const color = esc(line?.getAttribute("color") || "#000000");
|
|
2334
2339
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num(line, "width", 33) / 100 * 2.834645);
|
|
2335
2340
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
2336
|
-
const
|
|
2341
|
+
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
2342
|
+
const stroke = strokeW ? ` stroke="${color}" stroke-width="${strokeW.toFixed(2)}"${dash}${keepWidth}` : "";
|
|
2337
2343
|
const fill = ` fill="${shapeFill(el, defs, images, warn)}"`;
|
|
2338
2344
|
let svg = "";
|
|
2339
2345
|
if (o.tag === "rect") svg = `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}"${fill}${stroke}/>`;
|
|
2340
2346
|
else if (o.tag === "ellipse") svg = `<ellipse cx="${pt(x + w / 2)}" cy="${pt(y + h / 2)}" rx="${pt(w / 2)}" ry="${pt(h / 2)}"${fill}${stroke}/>`;
|
|
2341
2347
|
else if (o.tag === "line") {
|
|
2342
2348
|
const s = findChildByLocalName(el, "startPt"), e = findChildByLocalName(el, "endPt");
|
|
2343
|
-
svg = `<line x1="${pt(x + num(s, "x") * sx)}" y1="${pt(y + num(s, "y") * sy)}" x2="${pt(x + num(e, "x") * sx)}" y2="${pt(y + num(e, "y") * sy)}" stroke="${color}" stroke-width="${(strokeW || 0.3).toFixed(2)}"${dash}/>`;
|
|
2349
|
+
svg = `<line x1="${pt(x + num(s, "x") * sx)}" y1="${pt(y + num(s, "y") * sy)}" x2="${pt(x + num(e, "x") * sx)}" y2="${pt(y + num(e, "y") * sy)}" stroke="${color}" stroke-width="${(strokeW || 0.3).toFixed(2)}"${dash}${keepWidth}/>`;
|
|
2344
2350
|
} else if (o.tag === "polygon" || o.tag === "curv") {
|
|
2345
2351
|
const pts = elements(el).filter((c) => ln(c) === "pt").map((c) => `${pt(x + num(c, "x") * sx)},${pt(y + num(c, "y") * sy)}`);
|
|
2346
2352
|
if (pts.length >= 2) svg = `<polygon points="${pts.join(" ")}"${fill}${stroke}/>`;
|
|
@@ -2696,15 +2702,15 @@ function drawGroupByMatrix(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
2696
2702
|
emit(ctx, `<g transform="matrix(${m.slice(0, 4).map((v) => Math.round(v * 1e6) / 1e6).join(" ")} ${pt2(m[4])} ${pt2(m[5])})">`);
|
|
2697
2703
|
const sub = { el: leaf, tag, index: 0, inline: true, width: w, height: h, omL: 0, omR: 0 };
|
|
2698
2704
|
if (tag === "pic") drawPicFrame(leaf, 0, 0, w, h, "", ctx);
|
|
2699
|
-
else if (SHAPE_TAGS.has(tag)) drawShape(sub, 0, 0, ctx, depth + 1,
|
|
2705
|
+
else if (SHAPE_TAGS.has(tag)) drawShape(sub, 0, 0, ctx, depth + 1, [Math.hypot(m[0], m[1]) || 1, Math.hypot(m[2], m[3]) || 1]);
|
|
2700
2706
|
else drawObject(sub, 0, 0, baseV, areaW, ctx, depth + 1);
|
|
2701
2707
|
emit(ctx, "</g>");
|
|
2702
2708
|
ctx.regionRotations.pop();
|
|
2703
2709
|
}
|
|
2704
2710
|
return true;
|
|
2705
2711
|
}
|
|
2706
|
-
function drawShape(o, x, y, ctx, depth,
|
|
2707
|
-
const geometry = shapeGeometry(o, x, y, ctx.defs, ctx.images, (key, msg) => warnOnce(ctx, key, msg),
|
|
2712
|
+
function drawShape(o, x, y, ctx, depth, groupScale) {
|
|
2713
|
+
const geometry = shapeGeometry(o, x, y, ctx.defs, ctx.images, (key, msg) => warnOnce(ctx, key, msg), !!groupScale);
|
|
2708
2714
|
const b = geometry;
|
|
2709
2715
|
if (geometry.rotation) ctx.regionRotations.push(geometry.rotation);
|
|
2710
2716
|
ctx.stats.shapes++;
|
|
@@ -2716,7 +2722,17 @@ function drawShape(o, x, y, ctx, depth, local = false) {
|
|
|
2716
2722
|
const dt = findChildByLocalName(o.el, "drawText");
|
|
2717
2723
|
const sub = dt ? findChildByLocalName(dt, "subList") : null;
|
|
2718
2724
|
if (sub) {
|
|
2719
|
-
|
|
2725
|
+
const [sx, sy] = groupScale ?? [1, 1];
|
|
2726
|
+
const unscale = sx !== 1 || sy !== 1;
|
|
2727
|
+
if (unscale) {
|
|
2728
|
+
emit(ctx, `<g transform="scale(${1 / sx} ${1 / sy})">`);
|
|
2729
|
+
ctx.regionRotations.push([1 / sx, 0, 0, 1 / sy, 0, 0]);
|
|
2730
|
+
}
|
|
2731
|
+
for (const p of elements(sub)) if (ln(p) === "p") drawPara(p, geometry.x * sx, geometry.y * sy, geometry.w * sx, ctx, depth + 1);
|
|
2732
|
+
if (unscale) {
|
|
2733
|
+
ctx.regionRotations.pop();
|
|
2734
|
+
emit(ctx, "</g>");
|
|
2735
|
+
}
|
|
2720
2736
|
}
|
|
2721
2737
|
if (geometry.rotation) ctx.regionRotations.pop();
|
|
2722
2738
|
if (geometry.transform) emit(ctx, "</g>");
|
|
@@ -5741,6 +5757,7 @@ function createHwp5DocState() {
|
|
|
5741
5757
|
outlineNumberingId: 0,
|
|
5742
5758
|
autoCounters: /* @__PURE__ */ new Map(),
|
|
5743
5759
|
headerTexts: /* @__PURE__ */ new Set(),
|
|
5760
|
+
tocTexts: /* @__PURE__ */ new Set(),
|
|
5744
5761
|
headerBlocks: [],
|
|
5745
5762
|
footerBlocks: []
|
|
5746
5763
|
};
|
|
@@ -5886,6 +5903,12 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5886
5903
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
5887
5904
|
}
|
|
5888
5905
|
}
|
|
5906
|
+
if (toc.tocEntry) {
|
|
5907
|
+
for (const line of text.split("\n")) if (line.trim()) {
|
|
5908
|
+
ctx.doc.tocTexts.add(line.trim());
|
|
5909
|
+
if (headMarker) ctx.doc.tocTexts.add(`${headMarker} ${line.trim()}`);
|
|
5910
|
+
}
|
|
5911
|
+
}
|
|
5889
5912
|
return emitParagraphBlocks({
|
|
5890
5913
|
text,
|
|
5891
5914
|
headMarker,
|
|
@@ -6445,7 +6468,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6445
6468
|
flatBlocks = deduped;
|
|
6446
6469
|
}
|
|
6447
6470
|
if (docInfo) {
|
|
6448
|
-
detectHwp5Headings(flatBlocks, docInfo);
|
|
6471
|
+
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6449
6472
|
}
|
|
6450
6473
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6451
6474
|
let markdown = blocksToMarkdown(flatBlocks);
|
|
@@ -6478,7 +6501,7 @@ function parseDocInfoFromStream(raw, compressed) {
|
|
|
6478
6501
|
return null;
|
|
6479
6502
|
}
|
|
6480
6503
|
}
|
|
6481
|
-
function detectHwp5Headings(blocks, docInfo) {
|
|
6504
|
+
function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
6482
6505
|
let baseFontSize = 0;
|
|
6483
6506
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
6484
6507
|
for (const b of blocks) {
|
|
@@ -6508,7 +6531,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
6508
6531
|
if (baseFontSize <= 0) return;
|
|
6509
6532
|
for (const block of blocks) {
|
|
6510
6533
|
if (block.type === "heading") continue;
|
|
6511
|
-
if (block.type !== "paragraph" || !block.text || TOC_ENTRY_BLOCKS.has(block)) continue;
|
|
6534
|
+
if (block.type !== "paragraph" || !block.text || TOC_ENTRY_BLOCKS.has(block) || tocTexts?.has(block.text.trim())) continue;
|
|
6512
6535
|
const text = block.text.trim();
|
|
6513
6536
|
if (text.length === 0 || text.length > 200) continue;
|
|
6514
6537
|
if (/^\d+$/.test(text)) continue;
|
|
@@ -7746,4 +7769,4 @@ export {
|
|
|
7746
7769
|
cropRect,
|
|
7747
7770
|
extractRenderedRegions
|
|
7748
7771
|
};
|
|
7749
|
-
//# sourceMappingURL=chunk-
|
|
7772
|
+
//# sourceMappingURL=chunk-ZN3LHNJG.js.map
|