kordoc 3.5.2 → 3.5.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.
Files changed (32) hide show
  1. package/dist/{-LYUGJZQG.js → -KX7VLNW5.js} +3 -3
  2. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  3. package/dist/{chunk-DN5LTND6.js → chunk-DK2IE43H.js} +40 -27
  4. package/dist/{chunk-DN5LTND6.js.map → chunk-DK2IE43H.js.map} +1 -1
  5. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  6. package/dist/{chunk-QXXQIZBH.js → chunk-VEB43O2L.js} +2 -2
  7. package/dist/{chunk-NOIHZQWC.js → chunk-WEAP42T3.js} +2 -2
  8. package/dist/{chunk-G44XLS26.cjs → chunk-XZTDYOZV.cjs} +2 -2
  9. package/dist/chunk-XZTDYOZV.cjs.map +1 -0
  10. package/dist/cli.js +4 -4
  11. package/dist/formula-5NKVS2LR.cjs.map +1 -1
  12. package/dist/index.cjs +149 -136
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.js +39 -26
  15. package/dist/index.js.map +1 -1
  16. package/dist/mcp.js +3 -3
  17. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  18. package/dist/{parser-2O276TRF.cjs → parser-CPTBEGQP.cjs} +14 -14
  19. package/dist/parser-CPTBEGQP.cjs.map +1 -0
  20. package/dist/{parser-KDF76UCB.js → parser-W5TBEAVX.js} +2 -2
  21. package/dist/{parser-4FFTFIYL.js → parser-XT65AEDJ.js} +2 -2
  22. package/dist/provider-G4C2V2PD.cjs.map +1 -1
  23. package/dist/{watch-MF7JFR7S.js → watch-VOSNRZAY.js} +3 -3
  24. package/package.json +1 -1
  25. package/dist/chunk-G44XLS26.cjs.map +0 -1
  26. package/dist/parser-2O276TRF.cjs.map +0 -1
  27. /package/dist/{-LYUGJZQG.js.map → -KX7VLNW5.js.map} +0 -0
  28. /package/dist/{chunk-QXXQIZBH.js.map → chunk-VEB43O2L.js.map} +0 -0
  29. /package/dist/{chunk-NOIHZQWC.js.map → chunk-WEAP42T3.js.map} +0 -0
  30. /package/dist/{parser-KDF76UCB.js.map → parser-W5TBEAVX.js.map} +0 -0
  31. /package/dist/{parser-4FFTFIYL.js.map → parser-XT65AEDJ.js.map} +0 -0
  32. /package/dist/{watch-MF7JFR7S.js.map → watch-VOSNRZAY.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-QXXQIZBH.js";
22
+ } from "./chunk-VEB43O2L.js";
23
23
  import {
24
24
  parsePageRange
25
25
  } from "./chunk-GE43BE46.js";
@@ -20098,11 +20098,21 @@ function standardMarker(depth, n) {
20098
20098
  function reportMarker(depth) {
20099
20099
  return REPORT_BULLETS[Math.min(depth, REPORT_BULLETS.length - 1)];
20100
20100
  }
20101
- function levelIndent(depth, bodyHeight, numbering) {
20101
+ var MARKER_FULLWIDTH = "\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468\u2469\u246A\u246B\u246C\u246D\u246E\u246F\u2470\u2471\u2472\u2473\u326E\u326F\u3270\u3271\u3272\u3273\u3274\u3275\u3276\u3277\u3278\u3279\u327A\u327B\u25A1\u25CB\u25E6\u25AA\u25C7\u25B3\u25B6\u318D";
20102
+ function markerWidth(marker, bodyHeight) {
20102
20103
  const ta = bodyHeight / 2;
20103
- const markerTa = numbering === "standard" && (depth === 4 || depth === 5) ? 3 : 2;
20104
- const hang = Math.round((markerTa + 1) * ta);
20105
- return { left: Math.round(depth * bodyHeight), indent: -hang };
20104
+ let w = 0;
20105
+ for (const c of marker) {
20106
+ if (/[가-힣]/.test(c) || MARKER_FULLWIDTH.includes(c)) w += bodyHeight;
20107
+ else if (c === "." || c === ",") w += Math.round(bodyHeight * 0.25);
20108
+ else if (c === "(" || c === ")") w += Math.round(bodyHeight * 0.45);
20109
+ else w += Math.round(ta);
20110
+ }
20111
+ return Math.round(w + ta);
20112
+ }
20113
+ function levelIndent(depth, bodyHeight, numbering) {
20114
+ const marker = numbering === "report" ? reportMarker(depth) : standardMarker(depth, 0);
20115
+ return { left: Math.round(depth * bodyHeight), indent: -markerWidth(marker, bodyHeight) };
20106
20116
  }
20107
20117
  function computeSuppression(depths) {
20108
20118
  const counts = /* @__PURE__ */ new Map();
@@ -20369,24 +20379,26 @@ function generateManifest() {
20369
20379
  </opf:spine>
20370
20380
  </opf:package>`;
20371
20381
  }
20372
- function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR) {
20382
+ function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR, ratioPct = 100) {
20373
20383
  const boldAttr = bold ? ` bold="1"` : "";
20374
20384
  const italicAttr = italic ? ` italic="1"` : "";
20375
20385
  const effFont = bold ? 2 : fontId;
20376
20386
  return ` <hh:charPr id="${id}" height="${height}" textColor="${textColor}" shadeColor="none" useFontSpace="0" useKerning="0" symMark="NONE" borderFillIDRef="0"${boldAttr}${italicAttr}>
20377
20387
  <hh:fontRef hangul="${effFont}" latin="${effFont}" hanja="${effFont}" japanese="${effFont}" other="${effFont}" symbol="${effFont}" user="${effFont}"/>
20378
- <hh:ratio hangul="100" latin="100" hanja="100" japanese="100" other="100" symbol="100" user="100"/>
20388
+ <hh:ratio hangul="${ratioPct}" latin="${ratioPct}" hanja="${ratioPct}" japanese="100" other="100" symbol="100" user="100"/>
20379
20389
  <hh:spacing hangul="0" latin="0" hanja="0" japanese="0" other="0" symbol="0" user="0"/>
20380
20390
  <hh:relSz hangul="100" latin="100" hanja="100" japanese="100" other="100" symbol="100" user="100"/>
20381
20391
  <hh:offset hangul="0" latin="0" hanja="0" japanese="0" other="0" symbol="0" user="0"/>
20382
20392
  </hh:charPr>`;
20383
20393
  }
20384
20394
  function paraPr(id, opts = {}) {
20385
- const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0 } = opts;
20386
- return ` <hh:paraPr id="${id}" tabPrIDRef="0" condense="0" fontLineHeight="0" snapToGrid="1" suppressLineNumbers="0" checked="0" textDir="AUTO">
20395
+ const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0, keepWord = false } = opts;
20396
+ const breakNonLatin = keepWord ? "KEEP_WORD" : "BREAK_WORD";
20397
+ const snapGrid = keepWord ? "0" : "1";
20398
+ return ` <hh:paraPr id="${id}" tabPrIDRef="0" condense="0" fontLineHeight="0" snapToGrid="${snapGrid}" suppressLineNumbers="0" checked="0" textDir="AUTO">
20387
20399
  <hh:align horizontal="${align}" vertical="BASELINE"/>
20388
20400
  <hh:heading type="NONE" idRef="0" level="0"/>
20389
- <hh:breakSetting breakLatinWord="KEEP_WORD" breakNonLatinWord="BREAK_WORD" widowOrphan="0" keepWithNext="0" keepLines="0" pageBreakBefore="0" lineWrap="BREAK"/>
20401
+ <hh:breakSetting breakLatinWord="KEEP_WORD" breakNonLatinWord="${breakNonLatin}" widowOrphan="0" keepWithNext="0" keepLines="0" pageBreakBefore="0" lineWrap="BREAK"/>
20390
20402
  <hh:autoSpacing eAsianEng="0" eAsianNum="0"/>
20391
20403
  <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>
20392
20404
  <hh:lineSpacing type="PERCENT" value="${lineSpacing}"/>
@@ -20406,11 +20418,12 @@ function buildCharProperties(theme, gongmun) {
20406
20418
  h3 = body;
20407
20419
  h4 = Math.max(body - 100, 1300);
20408
20420
  }
20421
+ const bodyRatio = gongmun ? 95 : 100;
20409
20422
  const rows = [
20410
- charPr(0, body, false, false, 0, theme.body),
20411
- charPr(1, body, true, false, 0, theme.body),
20412
- charPr(2, body, false, true, 0, theme.body),
20413
- charPr(3, body, true, true, 0, theme.body),
20423
+ charPr(0, body, false, false, 0, theme.body, bodyRatio),
20424
+ charPr(1, body, true, false, 0, theme.body, bodyRatio),
20425
+ charPr(2, body, false, true, 0, theme.body, bodyRatio),
20426
+ charPr(3, body, true, true, 0, theme.body, bodyRatio),
20414
20427
  charPr(4, code, false, false, 1),
20415
20428
  charPr(5, h1, true, false, 1, theme.h1),
20416
20429
  charPr(6, h2, true, false, 1, theme.h2),
@@ -20442,21 +20455,21 @@ ${base2.join("\n")}
20442
20455
  const ls = gongmun.lineSpacing;
20443
20456
  const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
20444
20457
  const base = [
20445
- paraPr(0, { lineSpacing: ls }),
20446
- paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls }),
20447
- paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls }),
20448
- paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls }),
20449
- paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls }),
20450
- paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
20451
- paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600 }),
20452
- paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600 })
20458
+ paraPr(0, { lineSpacing: ls, keepWord: true }),
20459
+ paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true }),
20460
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls, keepWord: true }),
20461
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
20462
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
20463
+ paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400, keepWord: true }),
20464
+ paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true }),
20465
+ paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
20453
20466
  ];
20454
20467
  for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
20455
20468
  const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering);
20456
20469
  const sectionGap = gongmun.numbering === "report" && d === 0 ? Math.round(gongmun.bodyHeight * 0.5) : 0;
20457
- base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent, spaceBefore: sectionGap }));
20470
+ base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent, spaceBefore: sectionGap, keepWord: true }));
20458
20471
  }
20459
- base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls }));
20472
+ base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls, keepWord: true }));
20460
20473
  return `<hh:paraProperties itemCnt="${base.length}">
20461
20474
  ${base.join("\n")}
20462
20475
  </hh:paraProperties>`;
@@ -20549,7 +20562,7 @@ function generateHeaderXml(theme, gongmun) {
20549
20562
  <hh:style id="0" type="PARA" name="\uBC14\uD0D5\uAE00" engName="Normal" paraPrIDRef="0" charPrIDRef="0" nextStyleIDRef="0" langIDRef="1042" lockForm="0"/>
20550
20563
  </hh:styles>
20551
20564
  </hh:refList>
20552
- <hh:compatibleDocument targetProgram="HWP2018"/>
20565
+ <hh:compatibleDocument targetProgram="HWP2018"><hh:layoutCompatibility/></hh:compatibleDocument>
20553
20566
  </hh:head>`;
20554
20567
  }
20555
20568
  function generateSecPr(gongmun) {
@@ -23515,7 +23528,7 @@ async function parseHwp(buffer, options) {
23515
23528
  async function parsePdf(buffer, options) {
23516
23529
  let parsePdfDocument;
23517
23530
  try {
23518
- const mod = await import("./parser-4FFTFIYL.js");
23531
+ const mod = await import("./parser-XT65AEDJ.js");
23519
23532
  parsePdfDocument = mod.parsePdfDocument;
23520
23533
  } catch {
23521
23534
  return {