kordoc 3.8.2 → 3.8.4
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 +14 -0
- package/dist/{-FEHSMPVO.js → -ZAIG6FWT.js} +3 -3
- package/dist/{chunk-JHZUFBUV.js → chunk-2UDAEQPW.js} +3 -3
- package/dist/chunk-2UDAEQPW.js.map +1 -0
- package/dist/{chunk-DP37KF2X.js → chunk-6EDNKPXQ.js} +146 -75
- package/dist/chunk-6EDNKPXQ.js.map +1 -0
- package/dist/{chunk-553VTUVP.js → chunk-T4SGNVVS.js} +3 -3
- package/dist/chunk-T4SGNVVS.js.map +1 -0
- package/dist/{chunk-YBPNKFJW.cjs → chunk-Z3O36LBJ.cjs} +3 -3
- package/dist/{chunk-YBPNKFJW.cjs.map → chunk-Z3O36LBJ.cjs.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +399 -328
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +145 -74
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +3 -3
- package/dist/{parser-NR2TYGO3.js → parser-2THIF623.js} +153 -7
- package/dist/parser-2THIF623.js.map +1 -0
- package/dist/{parser-KNQDRLZQ.js → parser-PR7CPMM4.js} +153 -7
- package/dist/parser-PR7CPMM4.js.map +1 -0
- package/dist/{parser-NS4ZPD7B.cjs → parser-ZVKCFXR3.cjs} +177 -31
- package/dist/parser-ZVKCFXR3.cjs.map +1 -0
- package/dist/{watch-XCWADLPU.js → watch-2HYPNMOB.js} +3 -3
- package/package.json +2 -1
- package/dist/chunk-553VTUVP.js.map +0 -1
- package/dist/chunk-DP37KF2X.js.map +0 -1
- package/dist/chunk-JHZUFBUV.js.map +0 -1
- package/dist/parser-KNQDRLZQ.js.map +0 -1
- package/dist/parser-NR2TYGO3.js.map +0 -1
- package/dist/parser-NS4ZPD7B.cjs.map +0 -1
- /package/dist/{-FEHSMPVO.js.map → -ZAIG6FWT.js.map} +0 -0
- /package/dist/{watch-XCWADLPU.js.map → watch-2HYPNMOB.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
sanitizeHref,
|
|
20
20
|
stripDtd,
|
|
21
21
|
toArrayBuffer
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-T4SGNVVS.js";
|
|
23
23
|
import {
|
|
24
24
|
parsePageRange
|
|
25
25
|
} from "./chunk-GE43BE46.js";
|
|
@@ -1150,14 +1150,14 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1150
1150
|
const head = numDef.heads.get(level);
|
|
1151
1151
|
counters[level] = counters[level] === 0 ? head?.start ?? 1 : counters[level] + 1;
|
|
1152
1152
|
for (let l = level + 1; l <= 10; l++) counters[l] = 0;
|
|
1153
|
-
const fmtText = head
|
|
1153
|
+
const fmtText = head ? head.text.trim() : `^${level}.`;
|
|
1154
1154
|
const prefix = fmtText.replace(/\^(10|[1-9])/g, (_, d) => {
|
|
1155
1155
|
const lv = parseInt(d, 10);
|
|
1156
1156
|
const refHead = numDef.heads.get(lv);
|
|
1157
1157
|
const n = counters[lv] || refHead?.start || 1;
|
|
1158
1158
|
return formatHeadNumber(n, refHead?.numFormat || "DIGIT");
|
|
1159
1159
|
});
|
|
1160
|
-
return { prefix, headingLevel };
|
|
1160
|
+
return { prefix: prefix || void 0, headingLevel };
|
|
1161
1161
|
}
|
|
1162
1162
|
|
|
1163
1163
|
// src/hwpx/table-build.ts
|
|
@@ -16799,6 +16799,9 @@ function getElements(parent, tagName) {
|
|
|
16799
16799
|
const nodes = parent.getElementsByTagName(tagName);
|
|
16800
16800
|
const result = [];
|
|
16801
16801
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
16802
|
+
if (result.length > 0) return result;
|
|
16803
|
+
const nsNodes = parent.getElementsByTagNameNS?.("*", tagName);
|
|
16804
|
+
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
16802
16805
|
return result;
|
|
16803
16806
|
}
|
|
16804
16807
|
function getTextContent(el) {
|
|
@@ -18306,74 +18309,79 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
18306
18309
|
if (footnoteText) block.footnoteText = footnoteText;
|
|
18307
18310
|
return block;
|
|
18308
18311
|
}
|
|
18312
|
+
function collectTextboxParagraphs(node, inTxbx = false, out = [], depth = 0) {
|
|
18313
|
+
if (depth > 40) return out;
|
|
18314
|
+
for (const el of effectiveChildElements(node)) {
|
|
18315
|
+
if (matchesLocal(el, "Fallback")) continue;
|
|
18316
|
+
const nowIn = inTxbx || matchesLocal(el, "txbxContent");
|
|
18317
|
+
if (nowIn && matchesLocal(el, "p")) out.push(el);
|
|
18318
|
+
collectTextboxParagraphs(el, nowIn, out, depth + 1);
|
|
18319
|
+
}
|
|
18320
|
+
return out;
|
|
18321
|
+
}
|
|
18309
18322
|
function parseTable(tbl, styles, numbering, footnotes, rels) {
|
|
18310
18323
|
const trElements = getChildElements(tbl, "tr");
|
|
18311
18324
|
if (trElements.length === 0) return null;
|
|
18312
|
-
const
|
|
18313
|
-
let maxCols = 0;
|
|
18325
|
+
const rawRows = [];
|
|
18314
18326
|
for (const tr of trElements) {
|
|
18315
|
-
const tcElements = getChildElements(tr, "tc");
|
|
18316
18327
|
const row = [];
|
|
18317
|
-
|
|
18328
|
+
let col = 0;
|
|
18329
|
+
for (const tc of getChildElements(tr, "tc")) {
|
|
18318
18330
|
let colSpan = 1;
|
|
18319
|
-
let
|
|
18331
|
+
let vMerge = null;
|
|
18320
18332
|
const tcPrEls = getChildElements(tc, "tcPr");
|
|
18321
18333
|
if (tcPrEls.length > 0) {
|
|
18322
18334
|
const gridSpanEls = getChildElements(tcPrEls[0], "gridSpan");
|
|
18323
18335
|
if (gridSpanEls.length > 0) {
|
|
18324
|
-
colSpan = parseInt(getAttr(gridSpanEls[0], "val") ?? "1", 10);
|
|
18336
|
+
colSpan = parseInt(getAttr(gridSpanEls[0], "val") ?? "1", 10) || 1;
|
|
18325
18337
|
}
|
|
18326
18338
|
const vMergeEls = getChildElements(tcPrEls[0], "vMerge");
|
|
18327
18339
|
if (vMergeEls.length > 0) {
|
|
18328
|
-
|
|
18329
|
-
if (val !== "restart" && val !== null) {
|
|
18330
|
-
row.push({ text: "", colSpan, rowSpan: 0 });
|
|
18331
|
-
continue;
|
|
18332
|
-
}
|
|
18340
|
+
vMerge = getAttr(vMergeEls[0], "val") === "restart" ? "restart" : "continue";
|
|
18333
18341
|
}
|
|
18334
18342
|
}
|
|
18335
|
-
const
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18343
|
+
const text = vMerge === "continue" ? "" : collectCellText(tc, styles, numbering, footnotes, rels, 0).join("\n");
|
|
18344
|
+
row.push({ col, colSpan, vMerge, text });
|
|
18345
|
+
col += colSpan;
|
|
18346
|
+
}
|
|
18347
|
+
rawRows.push(row);
|
|
18348
|
+
}
|
|
18349
|
+
const cellRows = rawRows.map(
|
|
18350
|
+
(row, r) => row.filter((cell) => cell.vMerge !== "continue").map((cell) => {
|
|
18351
|
+
let rowSpan = 1;
|
|
18352
|
+
if (cell.vMerge === "restart") {
|
|
18353
|
+
for (let nr = r + 1; nr < rawRows.length; nr++) {
|
|
18354
|
+
if (!rawRows[nr].some((nc) => nc.col === cell.col && nc.vMerge === "continue")) break;
|
|
18355
|
+
rowSpan++;
|
|
18356
|
+
}
|
|
18340
18357
|
}
|
|
18341
|
-
|
|
18342
|
-
}
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18358
|
+
return { text: cell.text, colSpan: cell.colSpan, rowSpan, colAddr: cell.col, rowAddr: r };
|
|
18359
|
+
})
|
|
18360
|
+
);
|
|
18361
|
+
const table = buildTable(cellRows);
|
|
18362
|
+
if (table.rows === 0 || table.cols === 0) return null;
|
|
18363
|
+
return { type: "table", table };
|
|
18364
|
+
}
|
|
18365
|
+
function collectCellText(tc, styles, numbering, footnotes, rels, depth) {
|
|
18366
|
+
const parts = [];
|
|
18367
|
+
if (depth > 20) return parts;
|
|
18368
|
+
for (const el of effectiveChildElements(tc)) {
|
|
18369
|
+
if (matchesLocal(el, "p")) {
|
|
18370
|
+
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
18371
|
+
if (block?.text) parts.push(block.text);
|
|
18372
|
+
for (const tp of collectTextboxParagraphs(el)) {
|
|
18373
|
+
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
18374
|
+
if (tb?.text) parts.push(tb.text);
|
|
18375
|
+
}
|
|
18376
|
+
} else if (matchesLocal(el, "tbl")) {
|
|
18377
|
+
for (const tr of getChildElements(el, "tr")) {
|
|
18378
|
+
for (const nestedTc of getChildElements(tr, "tc")) {
|
|
18379
|
+
parts.push(...collectCellText(nestedTc, styles, numbering, footnotes, rels, depth + 1));
|
|
18380
|
+
}
|
|
18354
18381
|
}
|
|
18355
|
-
cell.rowSpan = span;
|
|
18356
18382
|
}
|
|
18357
18383
|
}
|
|
18358
|
-
|
|
18359
|
-
for (const row of rows) {
|
|
18360
|
-
const clean = row.filter((cell) => cell.rowSpan !== 0);
|
|
18361
|
-
cleanRows.push(clean);
|
|
18362
|
-
}
|
|
18363
|
-
if (cleanRows.length === 0) return null;
|
|
18364
|
-
let cols = 0;
|
|
18365
|
-
for (const row of cleanRows) {
|
|
18366
|
-
let c = 0;
|
|
18367
|
-
for (const cell of row) c += cell.colSpan;
|
|
18368
|
-
if (c > cols) cols = c;
|
|
18369
|
-
}
|
|
18370
|
-
const table = {
|
|
18371
|
-
rows: cleanRows.length,
|
|
18372
|
-
cols,
|
|
18373
|
-
cells: cleanRows,
|
|
18374
|
-
hasHeader: cleanRows.length > 1
|
|
18375
|
-
};
|
|
18376
|
-
return { type: "table", table };
|
|
18384
|
+
return parts;
|
|
18377
18385
|
}
|
|
18378
18386
|
async function extractImages(zip, rels, doc, warnings) {
|
|
18379
18387
|
const blocks = [];
|
|
@@ -18479,6 +18487,10 @@ async function parseDocxDocument(buffer, options) {
|
|
|
18479
18487
|
if (localName2 === "p") {
|
|
18480
18488
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
18481
18489
|
if (block) blocks.push(block);
|
|
18490
|
+
for (const tp of collectTextboxParagraphs(el)) {
|
|
18491
|
+
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
18492
|
+
if (tb) blocks.push(tb);
|
|
18493
|
+
}
|
|
18482
18494
|
} else if (localName2 === "tbl") {
|
|
18483
18495
|
const block = parseTable(el, styles, numbering, footnotes, rels);
|
|
18484
18496
|
if (block) blocks.push(block);
|
|
@@ -18622,6 +18634,7 @@ function walkContent(node, blocks, paraShapeMap, sectionNum, warnings, inHeaderF
|
|
|
18622
18634
|
if (tag === "P") {
|
|
18623
18635
|
if (!inHeaderFooter) {
|
|
18624
18636
|
parseParagraph3(el, blocks, paraShapeMap, sectionNum);
|
|
18637
|
+
walkTablesInP(el, blocks, paraShapeMap, sectionNum, warnings);
|
|
18625
18638
|
}
|
|
18626
18639
|
continue;
|
|
18627
18640
|
}
|
|
@@ -18638,6 +18651,21 @@ function walkContent(node, blocks, paraShapeMap, sectionNum, warnings, inHeaderF
|
|
|
18638
18651
|
walkContent(el, blocks, paraShapeMap, sectionNum, warnings, inHeaderFooter, depth + 1);
|
|
18639
18652
|
}
|
|
18640
18653
|
}
|
|
18654
|
+
function walkTablesInP(node, blocks, paraShapeMap, sectionNum, warnings, depth = 0) {
|
|
18655
|
+
if (depth > MAX_XML_DEPTH2) return;
|
|
18656
|
+
const children = node.childNodes;
|
|
18657
|
+
for (let i = 0; i < children.length; i++) {
|
|
18658
|
+
const el = children[i];
|
|
18659
|
+
if (el.nodeType !== 1) continue;
|
|
18660
|
+
const tag = localName(el);
|
|
18661
|
+
if (tag === "TABLE") {
|
|
18662
|
+
parseTable2(el, blocks, paraShapeMap, sectionNum, warnings);
|
|
18663
|
+
continue;
|
|
18664
|
+
}
|
|
18665
|
+
if (tag === "FOOTNOTE" || tag === "ENDNOTE" || tag === "HEADER" || tag === "FOOTER") continue;
|
|
18666
|
+
walkTablesInP(el, blocks, paraShapeMap, sectionNum, warnings, depth + 1);
|
|
18667
|
+
}
|
|
18668
|
+
}
|
|
18641
18669
|
function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
18642
18670
|
const paraShapeId = el.getAttribute("ParaShape") ?? "";
|
|
18643
18671
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
@@ -18720,10 +18748,10 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
|
|
|
18720
18748
|
}
|
|
18721
18749
|
function extractCellText(cellEl) {
|
|
18722
18750
|
const textParts = [];
|
|
18723
|
-
|
|
18751
|
+
collectCellText2(cellEl, textParts, 0);
|
|
18724
18752
|
return textParts.filter(Boolean).join("\n").trim();
|
|
18725
18753
|
}
|
|
18726
|
-
function
|
|
18754
|
+
function collectCellText2(node, parts, depth) {
|
|
18727
18755
|
if (depth > 20) return;
|
|
18728
18756
|
const children = node.childNodes;
|
|
18729
18757
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -18733,13 +18761,29 @@ function collectCellText(node, parts, depth) {
|
|
|
18733
18761
|
if (tag === "P") {
|
|
18734
18762
|
const t = extractParagraphText(el);
|
|
18735
18763
|
if (t) parts.push(t);
|
|
18764
|
+
collectNestedTableText(el, parts, depth + 1);
|
|
18736
18765
|
} else if (tag === "TABLE") {
|
|
18737
|
-
|
|
18766
|
+
collectCellText2(el, parts, depth + 1);
|
|
18738
18767
|
} else {
|
|
18739
|
-
|
|
18768
|
+
collectCellText2(el, parts, depth + 1);
|
|
18740
18769
|
}
|
|
18741
18770
|
}
|
|
18742
18771
|
}
|
|
18772
|
+
function collectNestedTableText(node, parts, depth) {
|
|
18773
|
+
if (depth > 20) return;
|
|
18774
|
+
const children = node.childNodes;
|
|
18775
|
+
for (let i = 0; i < children.length; i++) {
|
|
18776
|
+
const el = children[i];
|
|
18777
|
+
if (el.nodeType !== 1) continue;
|
|
18778
|
+
const tag = localName(el);
|
|
18779
|
+
if (tag === "TABLE") {
|
|
18780
|
+
collectCellText2(el, parts, depth + 1);
|
|
18781
|
+
continue;
|
|
18782
|
+
}
|
|
18783
|
+
if (tag === "FOOTNOTE" || tag === "ENDNOTE" || tag === "HEADER" || tag === "FOOTER") continue;
|
|
18784
|
+
collectNestedTableText(el, parts, depth + 1);
|
|
18785
|
+
}
|
|
18786
|
+
}
|
|
18743
18787
|
function localName(el) {
|
|
18744
18788
|
return (el.tagName || el.localName || "").replace(/^[^:]+:/, "");
|
|
18745
18789
|
}
|
|
@@ -20692,12 +20736,13 @@ function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_C
|
|
|
20692
20736
|
</hh:charPr>`;
|
|
20693
20737
|
}
|
|
20694
20738
|
function paraPr(id, opts = {}) {
|
|
20695
|
-
const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0, keepWord = false } = opts;
|
|
20739
|
+
const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0, keepWord = false, outlineLevel } = opts;
|
|
20696
20740
|
const breakNonLatin = keepWord ? "KEEP_WORD" : "BREAK_WORD";
|
|
20697
20741
|
const snapGrid = keepWord ? "0" : "1";
|
|
20742
|
+
const heading = outlineLevel !== void 0 ? `<hh:heading type="OUTLINE" idRef="0" level="${outlineLevel}"/>` : `<hh:heading type="NONE" idRef="0" level="0"/>`;
|
|
20698
20743
|
return ` <hh:paraPr id="${id}" tabPrIDRef="0" condense="0" fontLineHeight="0" snapToGrid="${snapGrid}" suppressLineNumbers="0" checked="0" textDir="AUTO">
|
|
20699
20744
|
<hh:align horizontal="${align}" vertical="BASELINE"/>
|
|
20700
|
-
|
|
20745
|
+
${heading}
|
|
20701
20746
|
<hh:breakSetting breakLatinWord="KEEP_WORD" breakNonLatinWord="${breakNonLatin}" widowOrphan="0" keepWithNext="0" keepLines="0" pageBreakBefore="0" lineWrap="BREAK"/>
|
|
20702
20747
|
<hh:autoSpacing eAsianEng="0" eAsianNum="0"/>
|
|
20703
20748
|
<hh:margin><hc:intent value="${indent}" unit="HWPUNIT"/><hc:left value="${left}" unit="HWPUNIT"/><hc:right value="0" unit="HWPUNIT"/><hc:prev value="${spaceBefore}" unit="HWPUNIT"/><hc:next value="${spaceAfter}" unit="HWPUNIT"/></hh:margin>
|
|
@@ -20804,7 +20849,7 @@ function parseMarkdownToBlocks(md2) {
|
|
|
20804
20849
|
if (listMatch) {
|
|
20805
20850
|
const indent = Math.floor(listMatch[1].length / 2);
|
|
20806
20851
|
const ordered = /\d/.test(listMatch[2]);
|
|
20807
|
-
blocks.push({ type: "list_item", text: listMatch[3].trim(), ordered, indent });
|
|
20852
|
+
blocks.push({ type: "list_item", text: listMatch[3].trim(), ordered, indent, marker: listMatch[2] });
|
|
20808
20853
|
i++;
|
|
20809
20854
|
continue;
|
|
20810
20855
|
}
|
|
@@ -20814,6 +20859,11 @@ function parseMarkdownToBlocks(md2) {
|
|
|
20814
20859
|
return blocks;
|
|
20815
20860
|
}
|
|
20816
20861
|
function parseInlineMarkdown(text) {
|
|
20862
|
+
const literals = [];
|
|
20863
|
+
text = text.replace(/\x00/g, "").replace(/\\([\\`*_{}[\]()#+\-.!|>~])/g, (_, c) => {
|
|
20864
|
+
literals.push(c);
|
|
20865
|
+
return `\0${literals.length - 1}\0`;
|
|
20866
|
+
});
|
|
20817
20867
|
text = text.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
20818
20868
|
text = text.replace(/\[([^\]]*)\]\(([^)]*)\)/g, (_, t, u) => t || u);
|
|
20819
20869
|
text = text.replace(/~~([^~]+)~~/g, "$1");
|
|
@@ -20843,6 +20893,13 @@ function parseInlineMarkdown(text) {
|
|
|
20843
20893
|
if (spans.length === 0) {
|
|
20844
20894
|
spans.push({ text, bold: false, italic: false, code: false });
|
|
20845
20895
|
}
|
|
20896
|
+
for (const span of spans) {
|
|
20897
|
+
if (!span.text.includes("\0")) continue;
|
|
20898
|
+
span.text = span.text.replace(/\x00(\d+)\x00/g, (_, i) => {
|
|
20899
|
+
const c = literals[+i] ?? "";
|
|
20900
|
+
return span.code ? "\\" + c : c;
|
|
20901
|
+
});
|
|
20902
|
+
}
|
|
20846
20903
|
return spans;
|
|
20847
20904
|
}
|
|
20848
20905
|
function spanToCharPrId(span) {
|
|
@@ -20930,10 +20987,10 @@ function buildParaProperties(gongmun) {
|
|
|
20930
20987
|
if (!gongmun) {
|
|
20931
20988
|
const base2 = [
|
|
20932
20989
|
paraPr(0),
|
|
20933
|
-
paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180 }),
|
|
20934
|
-
paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170 }),
|
|
20935
|
-
paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160 }),
|
|
20936
|
-
paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160 }),
|
|
20990
|
+
paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180, outlineLevel: 0 }),
|
|
20991
|
+
paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170, outlineLevel: 1 }),
|
|
20992
|
+
paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160, outlineLevel: 2 }),
|
|
20993
|
+
paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160, outlineLevel: 3 }),
|
|
20937
20994
|
paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
|
|
20938
20995
|
paraPr(6, { align: "LEFT", lineSpacing: 150, indent: 600 }),
|
|
20939
20996
|
paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })
|
|
@@ -20946,10 +21003,10 @@ ${base2.join("\n")}
|
|
|
20946
21003
|
const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
|
|
20947
21004
|
const base = [
|
|
20948
21005
|
paraPr(0, { lineSpacing: ls, keepWord: true }),
|
|
20949
|
-
paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true }),
|
|
20950
|
-
paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls, keepWord: true }),
|
|
20951
|
-
paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
|
|
20952
|
-
paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
|
|
21006
|
+
paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true, outlineLevel: 0 }),
|
|
21007
|
+
paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls, keepWord: true, outlineLevel: 1 }),
|
|
21008
|
+
paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true, outlineLevel: 2 }),
|
|
21009
|
+
paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true, outlineLevel: 3 }),
|
|
20953
21010
|
paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400, keepWord: true }),
|
|
20954
21011
|
paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true }),
|
|
20955
21012
|
paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
|
|
@@ -20964,6 +21021,17 @@ ${base2.join("\n")}
|
|
|
20964
21021
|
${base.join("\n")}
|
|
20965
21022
|
</hh:paraProperties>`;
|
|
20966
21023
|
}
|
|
21024
|
+
function buildNumberings() {
|
|
21025
|
+
const heads = Array.from(
|
|
21026
|
+
{ length: 7 },
|
|
21027
|
+
(_, i) => ` <hh:paraHead start="1" level="${i + 1}" align="LEFT" useInstWidth="1" autoIndent="1" widthAdjust="0" textOffsetType="PERCENT" textOffset="50" numFormat="DIGIT" charPrIDRef="4294967295" checkable="0"/>`
|
|
21028
|
+
).join("\n");
|
|
21029
|
+
return `<hh:numberings itemCnt="1">
|
|
21030
|
+
<hh:numbering id="1" start="0">
|
|
21031
|
+
${heads}
|
|
21032
|
+
</hh:numbering>
|
|
21033
|
+
</hh:numberings>`;
|
|
21034
|
+
}
|
|
20967
21035
|
function generateHeaderXml(theme, gongmun, ratioVariants = []) {
|
|
20968
21036
|
const bodyFace = gongmun?.bodyFont === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5";
|
|
20969
21037
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants);
|
|
@@ -21041,7 +21109,7 @@ function generateHeaderXml(theme, gongmun, ratioVariants = []) {
|
|
|
21041
21109
|
</hh:borderFills>
|
|
21042
21110
|
${charPropsXml}
|
|
21043
21111
|
<hh:tabProperties itemCnt="0"/>
|
|
21044
|
-
|
|
21112
|
+
${buildNumberings()}
|
|
21045
21113
|
<hh:bullets itemCnt="0"/>
|
|
21046
21114
|
${paraPropsXml}
|
|
21047
21115
|
<hh:styles itemCnt="1">
|
|
@@ -21306,7 +21374,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
21306
21374
|
return best;
|
|
21307
21375
|
}
|
|
21308
21376
|
function escapeGfm(text) {
|
|
21309
|
-
return text.replace(
|
|
21377
|
+
return text.replace(/([~*])/g, "\\$1");
|
|
21310
21378
|
}
|
|
21311
21379
|
var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
|
|
21312
21380
|
function sanitizeText(text) {
|
|
@@ -21324,7 +21392,7 @@ function normForMatch(text) {
|
|
|
21324
21392
|
return sanitizeText(text).replace(/\s+/g, " ").trim();
|
|
21325
21393
|
}
|
|
21326
21394
|
function unescapeGfm(text) {
|
|
21327
|
-
return text.replace(
|
|
21395
|
+
return text.replace(/\\([~*])/g, "$1");
|
|
21328
21396
|
}
|
|
21329
21397
|
function summarize(text) {
|
|
21330
21398
|
const t = text.replace(/\s+/g, " ").trim();
|
|
@@ -21391,7 +21459,7 @@ function parseGfmTable(lines) {
|
|
|
21391
21459
|
return rows;
|
|
21392
21460
|
}
|
|
21393
21461
|
function unescapeGfmCell(text) {
|
|
21394
|
-
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(
|
|
21462
|
+
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*])/g, "$1");
|
|
21395
21463
|
}
|
|
21396
21464
|
function replicateCellInnerHtml(cell) {
|
|
21397
21465
|
if (cell.blocks?.length) {
|
|
@@ -21650,7 +21718,7 @@ function generateSecPr(gongmun) {
|
|
|
21650
21718
|
header: 0,
|
|
21651
21719
|
footer: 0
|
|
21652
21720
|
} : { top: 8504, bottom: 4252, left: 5670, right: 4252, header: 2835, footer: 2835 };
|
|
21653
|
-
return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="
|
|
21721
|
+
return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="59528" height="84188" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
|
|
21654
21722
|
}
|
|
21655
21723
|
function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null) {
|
|
21656
21724
|
const paraXmls = [];
|
|
@@ -21707,7 +21775,10 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
21707
21775
|
}
|
|
21708
21776
|
const indent = block.indent || 0;
|
|
21709
21777
|
let marker;
|
|
21710
|
-
if (block.
|
|
21778
|
+
if (block.marker) {
|
|
21779
|
+
marker = `${block.marker} `;
|
|
21780
|
+
prevWasOrdered = !!block.ordered;
|
|
21781
|
+
} else if (block.ordered) {
|
|
21711
21782
|
orderedCounters[indent] = (orderedCounters[indent] || 0) + 1;
|
|
21712
21783
|
for (const k of Object.keys(orderedCounters)) {
|
|
21713
21784
|
if (+k > indent) delete orderedCounters[+k];
|
|
@@ -24515,7 +24586,7 @@ async function parseHwp(buffer, options) {
|
|
|
24515
24586
|
async function parsePdf(buffer, options) {
|
|
24516
24587
|
let parsePdfDocument;
|
|
24517
24588
|
try {
|
|
24518
|
-
const mod = await import("./parser-
|
|
24589
|
+
const mod = await import("./parser-2THIF623.js");
|
|
24519
24590
|
parsePdfDocument = mod.parsePdfDocument;
|
|
24520
24591
|
} catch {
|
|
24521
24592
|
return {
|