kordoc 3.8.2 → 3.8.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/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  sanitizeHref,
20
20
  stripDtd,
21
21
  toArrayBuffer
22
- } from "./chunk-553VTUVP.js";
22
+ } from "./chunk-7J73IGMK.js";
23
23
  import {
24
24
  parsePageRange
25
25
  } from "./chunk-GE43BE46.js";
@@ -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) {
@@ -18622,6 +18625,7 @@ function walkContent(node, blocks, paraShapeMap, sectionNum, warnings, inHeaderF
18622
18625
  if (tag === "P") {
18623
18626
  if (!inHeaderFooter) {
18624
18627
  parseParagraph3(el, blocks, paraShapeMap, sectionNum);
18628
+ walkTablesInP(el, blocks, paraShapeMap, sectionNum, warnings);
18625
18629
  }
18626
18630
  continue;
18627
18631
  }
@@ -18638,6 +18642,21 @@ function walkContent(node, blocks, paraShapeMap, sectionNum, warnings, inHeaderF
18638
18642
  walkContent(el, blocks, paraShapeMap, sectionNum, warnings, inHeaderFooter, depth + 1);
18639
18643
  }
18640
18644
  }
18645
+ function walkTablesInP(node, blocks, paraShapeMap, sectionNum, warnings, depth = 0) {
18646
+ if (depth > MAX_XML_DEPTH2) return;
18647
+ const children = node.childNodes;
18648
+ for (let i = 0; i < children.length; i++) {
18649
+ const el = children[i];
18650
+ if (el.nodeType !== 1) continue;
18651
+ const tag = localName(el);
18652
+ if (tag === "TABLE") {
18653
+ parseTable2(el, blocks, paraShapeMap, sectionNum, warnings);
18654
+ continue;
18655
+ }
18656
+ if (tag === "FOOTNOTE" || tag === "ENDNOTE" || tag === "HEADER" || tag === "FOOTER") continue;
18657
+ walkTablesInP(el, blocks, paraShapeMap, sectionNum, warnings, depth + 1);
18658
+ }
18659
+ }
18641
18660
  function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
18642
18661
  const paraShapeId = el.getAttribute("ParaShape") ?? "";
18643
18662
  const shapeInfo = paraShapeMap.get(paraShapeId);
@@ -18733,13 +18752,29 @@ function collectCellText(node, parts, depth) {
18733
18752
  if (tag === "P") {
18734
18753
  const t = extractParagraphText(el);
18735
18754
  if (t) parts.push(t);
18755
+ collectNestedTableText(el, parts, depth + 1);
18736
18756
  } else if (tag === "TABLE") {
18737
- parts.push("[\uC911\uCCA9 \uD14C\uC774\uBE14]");
18757
+ collectCellText(el, parts, depth + 1);
18738
18758
  } else {
18739
18759
  collectCellText(el, parts, depth + 1);
18740
18760
  }
18741
18761
  }
18742
18762
  }
18763
+ function collectNestedTableText(node, parts, depth) {
18764
+ if (depth > 20) return;
18765
+ const children = node.childNodes;
18766
+ for (let i = 0; i < children.length; i++) {
18767
+ const el = children[i];
18768
+ if (el.nodeType !== 1) continue;
18769
+ const tag = localName(el);
18770
+ if (tag === "TABLE") {
18771
+ collectCellText(el, parts, depth + 1);
18772
+ continue;
18773
+ }
18774
+ if (tag === "FOOTNOTE" || tag === "ENDNOTE" || tag === "HEADER" || tag === "FOOTER") continue;
18775
+ collectNestedTableText(el, parts, depth + 1);
18776
+ }
18777
+ }
18743
18778
  function localName(el) {
18744
18779
  return (el.tagName || el.localName || "").replace(/^[^:]+:/, "");
18745
18780
  }
@@ -24515,7 +24550,7 @@ async function parseHwp(buffer, options) {
24515
24550
  async function parsePdf(buffer, options) {
24516
24551
  let parsePdfDocument;
24517
24552
  try {
24518
- const mod = await import("./parser-NR2TYGO3.js");
24553
+ const mod = await import("./parser-TM3AS25T.js");
24519
24554
  parsePdfDocument = mod.parsePdfDocument;
24520
24555
  } catch {
24521
24556
  return {