kordoc 4.0.1 → 4.0.2
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/{-O3AWNVPH.js → -XMKVL3NX.js} +7 -7
- package/dist/{chunk-3H3CVOZ3.js → chunk-3IYQYBUF.js} +2 -2
- package/dist/{chunk-JMLK6NTW.js → chunk-67RANGFQ.js} +3 -3
- package/dist/{chunk-C5ABJ7PB.js → chunk-6SD4X5PT.js} +3 -3
- package/dist/{chunk-33OUI7HC.js → chunk-6YIYFWO2.js} +2 -2
- package/dist/{chunk-SHVV3BD6.js → chunk-AHWRAGXN.js} +299 -71
- package/dist/chunk-AHWRAGXN.js.map +1 -0
- package/dist/{chunk-YEC7VG6O.js → chunk-IKBIIEVJ.js} +2 -2
- package/dist/{chunk-EH2KYFFO.js → chunk-STMLZDKR.js} +2 -2
- package/dist/{chunk-NIZXIVEI.cjs → chunk-WN7LZHII.cjs} +2 -2
- package/dist/{chunk-NIZXIVEI.cjs.map → chunk-WN7LZHII.cjs.map} +1 -1
- package/dist/cli.js +36 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +552 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -3
- package/dist/index.d.ts +56 -3
- package/dist/index.js +294 -66
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +53 -11
- package/dist/mcp.js.map +1 -1
- package/dist/{parser-G433UZMX.js → parser-2Q2YKEJG.js} +2 -2
- package/dist/{parser-ZOMDHCA7.js → parser-3HM2VYKK.js} +3 -3
- package/dist/{parser-44OPXZMP.cjs → parser-6AYYGX6J.cjs} +14 -14
- package/dist/{parser-44OPXZMP.cjs.map → parser-6AYYGX6J.cjs.map} +1 -1
- package/dist/render-W4VCJE6N.js +10 -0
- package/dist/seal-DRPTNHOP.js +10 -0
- package/dist/{watch-UYT3ZCBM.js → watch-6OHF727O.js} +7 -7
- package/package.json +1 -1
- package/dist/chunk-SHVV3BD6.js.map +0 -1
- package/dist/render-SQVQBORJ.js +0 -10
- package/dist/seal-6E26L45Z.js +0 -10
- /package/dist/{-O3AWNVPH.js.map → -XMKVL3NX.js.map} +0 -0
- /package/dist/{chunk-3H3CVOZ3.js.map → chunk-3IYQYBUF.js.map} +0 -0
- /package/dist/{chunk-JMLK6NTW.js.map → chunk-67RANGFQ.js.map} +0 -0
- /package/dist/{chunk-C5ABJ7PB.js.map → chunk-6SD4X5PT.js.map} +0 -0
- /package/dist/{chunk-33OUI7HC.js.map → chunk-6YIYFWO2.js.map} +0 -0
- /package/dist/{chunk-YEC7VG6O.js.map → chunk-IKBIIEVJ.js.map} +0 -0
- /package/dist/{chunk-EH2KYFFO.js.map → chunk-STMLZDKR.js.map} +0 -0
- /package/dist/{parser-G433UZMX.js.map → parser-2Q2YKEJG.js.map} +0 -0
- /package/dist/{parser-ZOMDHCA7.js.map → parser-3HM2VYKK.js.map} +0 -0
- /package/dist/{render-SQVQBORJ.js.map → render-W4VCJE6N.js.map} +0 -0
- /package/dist/{seal-6E26L45Z.js.map → seal-DRPTNHOP.js.map} +0 -0
- /package/dist/{watch-UYT3ZCBM.js.map → watch-6OHF727O.js.map} +0 -0
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
dedupeRunningHeaders,
|
|
12
12
|
flattenLayoutTables,
|
|
13
13
|
mapPuaText
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6YIYFWO2.js";
|
|
15
15
|
import {
|
|
16
16
|
detectFormat,
|
|
17
17
|
detectOle2Format,
|
|
@@ -32,14 +32,14 @@ import {
|
|
|
32
32
|
paraTextPureT,
|
|
33
33
|
patchZipEntries,
|
|
34
34
|
scanSectionXml
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-67RANGFQ.js";
|
|
36
36
|
import {
|
|
37
37
|
SPACE_EM_FIXED,
|
|
38
38
|
charWidthEm1000,
|
|
39
39
|
fitRatioForFewerLines,
|
|
40
40
|
measureTextWidth,
|
|
41
41
|
simulateWrap
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-6SD4X5PT.js";
|
|
43
43
|
import {
|
|
44
44
|
MAX_DECOMPRESS_SIZE,
|
|
45
45
|
MAX_XML_DEPTH,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
createXmlParser,
|
|
51
51
|
extractTextFromNode,
|
|
52
52
|
findChildByLocalName
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-IKBIIEVJ.js";
|
|
54
54
|
import {
|
|
55
55
|
KordocError,
|
|
56
56
|
classifyError,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
sanitizeHref,
|
|
62
62
|
stripDtd,
|
|
63
63
|
toArrayBuffer
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-STMLZDKR.js";
|
|
65
65
|
|
|
66
66
|
// src/index.ts
|
|
67
67
|
import { readFile } from "fs/promises";
|
|
@@ -19747,7 +19747,8 @@ import JSZip6 from "jszip";
|
|
|
19747
19747
|
|
|
19748
19748
|
// src/hwpx/gaejosik.ts
|
|
19749
19749
|
var GAEJOSIK_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
|
|
19750
|
-
function gaejosikMarker(depth) {
|
|
19750
|
+
function gaejosikMarker(depth, bullet2 = "\u25CB") {
|
|
19751
|
+
if (depth === 1) return bullet2;
|
|
19751
19752
|
return GAEJOSIK_BULLETS[Math.min(depth, GAEJOSIK_BULLETS.length - 1)];
|
|
19752
19753
|
}
|
|
19753
19754
|
function gaejosikSizes(bodyHeight, ov = {}) {
|
|
@@ -19783,11 +19784,11 @@ function gaejosikSpaceBefore(depth, bodyHeight) {
|
|
|
19783
19784
|
const ui = [3e3, 2e3, 1200, 600][Math.min(depth, 3)];
|
|
19784
19785
|
return Math.round(ui * s);
|
|
19785
19786
|
}
|
|
19786
|
-
function gaejosikLevelIndent(depth, bodyHeight, sizes = {}) {
|
|
19787
|
+
function gaejosikLevelIndent(depth, bodyHeight, sizes = {}, bullet2 = "\u25CB") {
|
|
19787
19788
|
const lefts = [0, 1, 1.5, 2];
|
|
19788
19789
|
const left = depth <= 3 ? Math.round(lefts[depth] * bodyHeight) : Math.round((2 + (depth - 3) * 0.5) * bodyHeight);
|
|
19789
19790
|
const h = depth === 0 ? gaejosikSizes(bodyHeight, sizes).dae : bodyHeight;
|
|
19790
|
-
return { left, indent: -markerWidth(gaejosikMarker(depth), h) };
|
|
19791
|
+
return { left, indent: -markerWidth(gaejosikMarker(depth, bullet2), h) };
|
|
19791
19792
|
}
|
|
19792
19793
|
function gaejosikChamIndent(bodyHeight, sizes = {}) {
|
|
19793
19794
|
const cham = gaejosikSizes(bodyHeight, sizes).cham;
|
|
@@ -19855,7 +19856,7 @@ function bodyTitleGeom(bodyHeight, ov = {}) {
|
|
|
19855
19856
|
}
|
|
19856
19857
|
|
|
19857
19858
|
// src/hwpx/gongmun.ts
|
|
19858
|
-
var OFFICIAL_MARGINS = { top: 20, bottom:
|
|
19859
|
+
var OFFICIAL_MARGINS = { top: 20, bottom: 15, left: 20, right: 15 };
|
|
19859
19860
|
var GAEJOSIK_MARGINS = { top: 15, bottom: 15, left: 20, right: 20 };
|
|
19860
19861
|
var GAEJOSIK_HEADER_FOOTER = 4251;
|
|
19861
19862
|
var PRESET_DEFAULTS = {
|
|
@@ -19864,7 +19865,9 @@ var PRESET_DEFAULTS = {
|
|
|
19864
19865
|
plan: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
|
|
19865
19866
|
notice: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
|
|
19866
19867
|
minutes: { bodyPt: 14, lineSpacing: 130, numbering: "standard" },
|
|
19867
|
-
gaejosik: { bodyPt: 15, lineSpacing: 160, numbering: "gaejosik" }
|
|
19868
|
+
gaejosik: { bodyPt: 15, lineSpacing: 160, numbering: "gaejosik" },
|
|
19869
|
+
// 보도자료 — 실측(국토부 실물): 본문 바탕 14pt 160%, □→ㅇ→*(각주) 부호
|
|
19870
|
+
press: { bodyPt: 14, lineSpacing: 160, numbering: "report" }
|
|
19868
19871
|
};
|
|
19869
19872
|
var PRESET_ALIAS = {
|
|
19870
19873
|
official: "official",
|
|
@@ -19887,7 +19890,9 @@ var PRESET_ALIAS = {
|
|
|
19887
19890
|
\uAC1C\uC870\uC2DD: "gaejosik",
|
|
19888
19891
|
\uAC1C\uC870\uC2DD\uBCF4\uACE0\uC11C: "gaejosik",
|
|
19889
19892
|
\uC815\uBD80\uBCF4\uACE0\uC11C: "gaejosik",
|
|
19890
|
-
\uC815\uBD80\uD45C\uC900\uAC1C\uC870\uC2DD\uBCF4\uACE0\uC11C: "gaejosik"
|
|
19893
|
+
\uC815\uBD80\uD45C\uC900\uAC1C\uC870\uC2DD\uBCF4\uACE0\uC11C: "gaejosik",
|
|
19894
|
+
press: "press",
|
|
19895
|
+
\uBCF4\uB3C4\uC790\uB8CC: "press"
|
|
19891
19896
|
};
|
|
19892
19897
|
function normalizeGongmunPreset(preset) {
|
|
19893
19898
|
if (!preset) return "official";
|
|
@@ -19904,13 +19909,14 @@ function resolveGongmun(opts) {
|
|
|
19904
19909
|
const coverOn = opts.cover !== void 0 ? opts.cover !== false : preset === "gaejosik";
|
|
19905
19910
|
const coverOpts = typeof opts.cover === "object" ? opts.cover : {};
|
|
19906
19911
|
const gaejosik = preset === "gaejosik";
|
|
19912
|
+
const reportFamily = gaejosik || preset === "report" || preset === "plan" || preset === "notice" || preset === "press";
|
|
19907
19913
|
return {
|
|
19908
19914
|
preset,
|
|
19909
19915
|
bodyFont: opts.bodyFont ?? "myeongjo",
|
|
19910
19916
|
bodyHeight: Math.round(bodyPt * 100),
|
|
19911
19917
|
lineSpacing: opts.lineSpacing ?? d.lineSpacing,
|
|
19912
19918
|
numbering: opts.numbering ?? d.numbering,
|
|
19913
|
-
margins: opts.margins ?? (
|
|
19919
|
+
margins: opts.margins ?? (reportFamily ? GAEJOSIK_MARGINS : OFFICIAL_MARGINS),
|
|
19914
19920
|
centerTitle: opts.centerTitle ?? true,
|
|
19915
19921
|
autoFitMinRatio,
|
|
19916
19922
|
cover: coverOn ? { date: coverOpts.date ?? null, org: coverOpts.org ?? "" } : null,
|
|
@@ -19919,14 +19925,26 @@ function resolveGongmun(opts) {
|
|
|
19919
19925
|
sizes: opts.sizes ?? {},
|
|
19920
19926
|
// 쪽번호 — 보고서 계열 관행(실측: 2_보고서 양식·추진계획·공고문 전부 하단 중앙)
|
|
19921
19927
|
pageNumbers: opts.pageNumbers ?? (gaejosik || preset === "report" || preset === "plan"),
|
|
19922
|
-
|
|
19928
|
+
// 머리말·꼬리말 — 실측: 보고서 계열 15mm(GT3·t2·춘천·브라더), 공고·보도 10mm,
|
|
19929
|
+
// 기안문 0(실결재 41/60건 h0/f0)
|
|
19930
|
+
headerFooter: usesReportFonts(preset) ? GAEJOSIK_HEADER_FOOTER : preset === "notice" || preset === "press" ? 2835 : 0,
|
|
19923
19931
|
// "끝." — 기안문 규정(본문 끝 2타+"끝."). 그 외는 opt-in
|
|
19924
19932
|
endMark: opts.endMark ?? preset === "official",
|
|
19925
19933
|
approval: opts.approval && opts.approval.length > 0 ? opts.approval : null,
|
|
19926
19934
|
// 본문 제목박스 — 실측(GT3·GT12): 목차 뒤 본문 시작에 제목 반복. 표지 켜진 개조식 기본
|
|
19927
19935
|
bodyTitleBox: opts.bodyTitleBox ?? (gaejosik && coverOn),
|
|
19928
|
-
// h2 말머리 —
|
|
19929
|
-
h2Marker: opts.h2Marker ?? (preset === "report" || preset === "plan" ? "box" : "none")
|
|
19936
|
+
// h2 말머리 — 실측: 보고서 양식 □ 대항목(QA-2), 공고문 아라비아("1. 사업개요", 바이오헬스 실측)
|
|
19937
|
+
h2Marker: opts.h2Marker ?? (preset === "report" || preset === "plan" ? "box" : preset === "notice" ? "number" : "none"),
|
|
19938
|
+
// 2단계 부호 — 실결재 기안문·공고문 ㅇ 지배(60건 중 ㅇ134:○5), 보고서 양식 계열 ○
|
|
19939
|
+
bullet2: opts.bullet2 ?? (preset === "notice" || preset === "press" ? "\u3147" : "\u25CB"),
|
|
19940
|
+
// 단일 형제 부호 생략 — 규정이지만 부호 없는 계단이 실무 눈에 어색 (실무자 QA)
|
|
19941
|
+
suppressSingle: opts.suppressSingle ?? false,
|
|
19942
|
+
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
19943
|
+
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
19944
|
+
reportInfo: opts.reportInfo?.trim() || null,
|
|
19945
|
+
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
19946
|
+
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
19947
|
+
press: preset === "press" ? opts.press ?? {} : null
|
|
19930
19948
|
};
|
|
19931
19949
|
}
|
|
19932
19950
|
var HANGUL_INITIALS = [0, 2, 3, 5, 6, 7, 9, 11, 12, 14, 15, 16, 17, 18];
|
|
@@ -19944,6 +19962,7 @@ function circledHangul(n) {
|
|
|
19944
19962
|
return String.fromCodePoint(12910 + n % 14);
|
|
19945
19963
|
}
|
|
19946
19964
|
var REPORT_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
|
|
19965
|
+
var PRESS_BULLETS = ["\u25A1", "\u3147", "*", "\u318D"];
|
|
19947
19966
|
function standardMarker(depth, n) {
|
|
19948
19967
|
switch (depth) {
|
|
19949
19968
|
case 0:
|
|
@@ -19966,17 +19985,19 @@ function standardMarker(depth, n) {
|
|
|
19966
19985
|
return circledHangul(n);
|
|
19967
19986
|
}
|
|
19968
19987
|
}
|
|
19969
|
-
function reportMarker(depth) {
|
|
19970
|
-
|
|
19988
|
+
function reportMarker(depth, bullet2 = "\u25CB", press = false) {
|
|
19989
|
+
const bullets = press ? PRESS_BULLETS : REPORT_BULLETS;
|
|
19990
|
+
const m = bullets[Math.min(depth, bullets.length - 1)];
|
|
19991
|
+
return depth === 1 && !press ? bullet2 : m;
|
|
19971
19992
|
}
|
|
19972
19993
|
function markerWidth(marker, bodyHeight) {
|
|
19973
19994
|
let em = SPACE_EM_FIXED;
|
|
19974
19995
|
for (const c of marker) em += charWidthEm1000(c.codePointAt(0));
|
|
19975
19996
|
return Math.round(em / 1e3 * bodyHeight);
|
|
19976
19997
|
}
|
|
19977
|
-
function levelIndent(depth, bodyHeight, numbering, sizes = {}) {
|
|
19978
|
-
if (numbering === "gaejosik") return gaejosikLevelIndent(depth, bodyHeight, sizes);
|
|
19979
|
-
const marker = numbering === "report" ? reportMarker(depth) : standardMarker(depth, 0);
|
|
19998
|
+
function levelIndent(depth, bodyHeight, numbering, sizes = {}, bullet2 = "\u25CB", press = false) {
|
|
19999
|
+
if (numbering === "gaejosik") return gaejosikLevelIndent(depth, bodyHeight, sizes, bullet2);
|
|
20000
|
+
const marker = numbering === "report" ? reportMarker(depth, bullet2, press) : standardMarker(depth, 0);
|
|
19980
20001
|
return { left: Math.round(depth * bodyHeight), indent: -markerWidth(marker, bodyHeight) };
|
|
19981
20002
|
}
|
|
19982
20003
|
function computeSuppression(depths) {
|
|
@@ -19993,8 +20014,10 @@ function computeSuppression(depths) {
|
|
|
19993
20014
|
return keys.map((k) => (counts.get(k) ?? 0) <= 1);
|
|
19994
20015
|
}
|
|
19995
20016
|
var GongmunNumberer = class {
|
|
19996
|
-
constructor(numbering) {
|
|
20017
|
+
constructor(numbering, bullet2 = "\u25CB", press = false) {
|
|
19997
20018
|
this.numbering = numbering;
|
|
20019
|
+
this.bullet2 = bullet2;
|
|
20020
|
+
this.press = press;
|
|
19998
20021
|
}
|
|
19999
20022
|
counts = [];
|
|
20000
20023
|
/** depth 항목 하나에 대한 마커. suppress=true면 빈 문자열(부호 없음) */
|
|
@@ -20003,8 +20026,8 @@ var GongmunNumberer = class {
|
|
|
20003
20026
|
const n = this.counts[depth] ?? 0;
|
|
20004
20027
|
this.counts[depth] = n + 1;
|
|
20005
20028
|
if (suppress) return "";
|
|
20006
|
-
if (this.numbering === "gaejosik") return gaejosikMarker(depth);
|
|
20007
|
-
return this.numbering === "report" ? reportMarker(depth) : standardMarker(depth, n);
|
|
20029
|
+
if (this.numbering === "gaejosik") return gaejosikMarker(depth, this.bullet2);
|
|
20030
|
+
return this.numbering === "report" ? reportMarker(depth, this.bullet2, this.press) : standardMarker(depth, n);
|
|
20008
20031
|
}
|
|
20009
20032
|
reset() {
|
|
20010
20033
|
this.counts = [];
|
|
@@ -20126,6 +20149,7 @@ var GJ_PARA_COVER = 21;
|
|
|
20126
20149
|
var GJ_PARA_TOC_ITEM = 22;
|
|
20127
20150
|
var GJ_PARA_CHAPTER = 23;
|
|
20128
20151
|
var GJ_PARA_BAR = 24;
|
|
20152
|
+
var GONGMUN_LIST_PLAIN_BASE = 25;
|
|
20129
20153
|
var GJ_BF_CHAPTER_NUM = 3;
|
|
20130
20154
|
var GJ_BF_CHAPTER_GAP = 4;
|
|
20131
20155
|
var GJ_BF_CHAPTER_TITLE = 5;
|
|
@@ -20164,9 +20188,13 @@ function newPageNumCtrl(num2 = 1) {
|
|
|
20164
20188
|
function pageHidingCtrl(hideHeader = false) {
|
|
20165
20189
|
return `<hp:ctrl><hp:pageHiding hideHeader="${hideHeader ? 1 : 0}" hideFooter="0" hideMasterPage="0" hideBorder="0" hideFill="0" hidePageNum="1"/></hp:ctrl>`;
|
|
20166
20190
|
}
|
|
20191
|
+
var GONGMUN_TBL_CHAR = 11;
|
|
20192
|
+
var GONGMUN_TBL_CHAR_BOLD = 12;
|
|
20193
|
+
var GONGMUN_TBL_PT = 1200;
|
|
20167
20194
|
var CHAR_VARIANT_BASE = 11;
|
|
20168
|
-
function charVariantBase(measured) {
|
|
20169
|
-
|
|
20195
|
+
function charVariantBase(measured, isGongmun = true) {
|
|
20196
|
+
if (!isGongmun) return CHAR_VARIANT_BASE;
|
|
20197
|
+
return measured ? 11 + GJ_CHAR_COUNT : 11 + 2;
|
|
20170
20198
|
}
|
|
20171
20199
|
var GONGMUN_BODY_RATIO = 95;
|
|
20172
20200
|
|
|
@@ -20441,6 +20469,12 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
20441
20469
|
charPr(CHAR_TABLE_HEADER, body, theme.tableHeaderBold, false, bodyFont, theme.tableHeader),
|
|
20442
20470
|
charPr(CHAR_QUOTE, body, false, true, bodyFont, theme.quote)
|
|
20443
20471
|
];
|
|
20472
|
+
if (gongmun && !measured) {
|
|
20473
|
+
rows.push(
|
|
20474
|
+
charPr(11, GONGMUN_TBL_PT, false, false, bodyFont, theme.body),
|
|
20475
|
+
charPr(12, GONGMUN_TBL_PT, true, false, bodyFont, theme.body)
|
|
20476
|
+
);
|
|
20477
|
+
}
|
|
20444
20478
|
if (measured) {
|
|
20445
20479
|
const sz = gaejosikSizes(body, gongmun.sizes);
|
|
20446
20480
|
rows.push(
|
|
@@ -20519,16 +20553,16 @@ ${base2.join("\n")}
|
|
|
20519
20553
|
paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
|
|
20520
20554
|
];
|
|
20521
20555
|
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
20522
|
-
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes);
|
|
20523
|
-
const sectionGap = gongmun.numbering === "gaejosik"
|
|
20524
|
-
const keepNext = gongmun.numbering === "gaejosik" && d === 0;
|
|
20556
|
+
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset === "press");
|
|
20557
|
+
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
20558
|
+
const keepNext = (gongmun.numbering === "gaejosik" || gongmun.numbering === "report") && d === 0;
|
|
20525
20559
|
base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent, spaceBefore: sectionGap, keepWord: true, keepWithNext: keepNext }));
|
|
20526
20560
|
}
|
|
20527
20561
|
base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls, keepWord: true }));
|
|
20528
20562
|
base.push(paraPr(GONGMUN_RIGHT, { align: "RIGHT", lineSpacing: ls, keepWord: true }));
|
|
20529
20563
|
base.push(paraPr(GONGMUN_TBL_CENTER, { align: "CENTER", lineSpacing: 130, keepWord: true }));
|
|
20530
20564
|
base.push(paraPr(GONGMUN_TBL_LEFT, { align: "LEFT", lineSpacing: 130, keepWord: true }));
|
|
20531
|
-
|
|
20565
|
+
{
|
|
20532
20566
|
const cham = gaejosikChamIndent(gongmun.bodyHeight, gongmun.sizes);
|
|
20533
20567
|
const toc = gaejosikTocItemIndent(gongmun.bodyHeight, gongmun.sizes);
|
|
20534
20568
|
base.push(
|
|
@@ -20540,11 +20574,11 @@ ${base2.join("\n")}
|
|
|
20540
20574
|
// 표지 장식 바 셀 빈 문단 — 저줄간격(실측 71%)으로 바 높이 818 안에 수납
|
|
20541
20575
|
paraPr(GJ_PARA_BAR, { align: "CENTER", lineSpacing: 70, keepWord: true })
|
|
20542
20576
|
);
|
|
20543
|
-
}
|
|
20544
|
-
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
);
|
|
20577
|
+
}
|
|
20578
|
+
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
20579
|
+
const { left } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset === "press");
|
|
20580
|
+
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
20581
|
+
base.push(paraPr(GONGMUN_LIST_PLAIN_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent: 0, spaceBefore: sectionGap, keepWord: true }));
|
|
20548
20582
|
}
|
|
20549
20583
|
return `<hh:paraProperties itemCnt="${base.length}">
|
|
20550
20584
|
${base.join("\n")}
|
|
@@ -20925,7 +20959,9 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
|
|
|
20925
20959
|
if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
|
|
20926
20960
|
const content = plainRenderText(block.text || "");
|
|
20927
20961
|
text = marker ? `${marker} ${content}` : content;
|
|
20928
|
-
const
|
|
20962
|
+
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset === "press");
|
|
20963
|
+
const left = li.left;
|
|
20964
|
+
const indent = marker ? li.indent : 0;
|
|
20929
20965
|
firstW = pageW - left - Math.max(indent, 0);
|
|
20930
20966
|
contW = pageW - left - Math.max(-indent, 0);
|
|
20931
20967
|
} else if (block.type === "paragraph") {
|
|
@@ -20953,7 +20989,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
20953
20989
|
}
|
|
20954
20990
|
function precomputeGongmunList(blocks, gongmun) {
|
|
20955
20991
|
const result = /* @__PURE__ */ new Map();
|
|
20956
|
-
const depthOffset = gongmun.numbering === "gaejosik" && blocks.some((b) => b.type === "heading" && b.level === 3) ? 1 : 0;
|
|
20992
|
+
const depthOffset = gongmun.numbering === "gaejosik" && blocks.some((b) => b.type === "heading" && b.level === 3) || gongmun.numbering === "standard" && gongmun.h2Marker === "number" && blocks.some((b) => b.type === "heading" && b.level === 2) ? 1 : 0;
|
|
20957
20993
|
let i = 0;
|
|
20958
20994
|
while (i < blocks.length) {
|
|
20959
20995
|
if (blocks[i].type !== "list_item") {
|
|
@@ -20980,8 +21016,8 @@ function precomputeGongmunList(blocks, gongmun) {
|
|
|
20980
21016
|
break;
|
|
20981
21017
|
}
|
|
20982
21018
|
const depths = run.map((bi) => Math.min(Math.max((blocks[bi].indent || 0) + depthOffset, 0), GONGMUN_LIST_LEVELS - 1));
|
|
20983
|
-
const suppress = gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
|
|
20984
|
-
const numberer = new GongmunNumberer(gongmun.numbering);
|
|
21019
|
+
const suppress = gongmun.suppressSingle && gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
|
|
21020
|
+
const numberer = new GongmunNumberer(gongmun.numbering, gongmun.bullet2, gongmun.preset === "press");
|
|
20985
21021
|
run.forEach((bi, k) => {
|
|
20986
21022
|
const marker = numberer.next(depths[k], suppress[k]);
|
|
20987
21023
|
result.set(bi, { marker, depth: depths[k] });
|
|
@@ -21011,7 +21047,8 @@ function cell(opts) {
|
|
|
21011
21047
|
return `<hp:tc name="" header="0" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${opts.bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${opts.vertAlign ?? "CENTER"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${paras}</hp:subList><hp:cellAddr colAddr="${opts.col}" rowAddr="${opts.row ?? 0}"/><hp:cellSpan colSpan="${opts.colSpan ?? 1}" rowSpan="1"/><hp:cellSz width="${opts.w}" height="${opts.h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
21012
21048
|
}
|
|
21013
21049
|
function table(rows, w, h, cols, tblBf = 1) {
|
|
21014
|
-
|
|
21050
|
+
const outLR = w + 566 > 48e3 ? 0 : 283;
|
|
21051
|
+
return `<hp:tbl id="${++gjTableId}" zOrder="0" numberingType="TABLE" textWrap="TOP_AND_BOTTOM" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" pageBreak="CELL" repeatHeader="0" rowCnt="${rows.length}" colCnt="${cols}" cellSpacing="0" borderFillIDRef="${tblBf}" noAdjust="1"><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="1" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="${outLR}" right="${outLR}" top="283" bottom="283"/><hp:inMargin left="141" right="141" top="141" bottom="141"/>` + rows.map((r) => `<hp:tr>${r}</hp:tr>`).join("") + `</hp:tbl>`;
|
|
21015
21052
|
}
|
|
21016
21053
|
function buildGaejosikCover(title, gongmun) {
|
|
21017
21054
|
const g = coverGeom(gongmun.bodyHeight, gongmun.sizes);
|
|
@@ -21674,7 +21711,7 @@ function profileColWidths(tp, colCnt) {
|
|
|
21674
21711
|
if (tp.width) return Array(colCnt).fill(Math.floor(tp.width / colCnt));
|
|
21675
21712
|
return null;
|
|
21676
21713
|
}
|
|
21677
|
-
var CELL_PAD =
|
|
21714
|
+
var CELL_PAD = 1200;
|
|
21678
21715
|
function cellContentWidth(text, charHeight) {
|
|
21679
21716
|
let max = 0;
|
|
21680
21717
|
for (const seg of text.replace(/\*\*|__|`/g, "").split(/<br\s*\/?>/i)) {
|
|
@@ -21683,35 +21720,51 @@ function cellContentWidth(text, charHeight) {
|
|
|
21683
21720
|
}
|
|
21684
21721
|
return max;
|
|
21685
21722
|
}
|
|
21686
|
-
function
|
|
21723
|
+
function cellMinWordWidth(text, charHeight) {
|
|
21724
|
+
let max = 0;
|
|
21725
|
+
for (const seg of text.replace(/\*\*|__|`/g, "").split(/<br\s*\/?>/i)) {
|
|
21726
|
+
for (const word of seg.trim().split(/\s+/)) {
|
|
21727
|
+
const w = measureTextWidth(word, charHeight, 100);
|
|
21728
|
+
if (w > max) max = w;
|
|
21729
|
+
}
|
|
21730
|
+
}
|
|
21731
|
+
return max;
|
|
21732
|
+
}
|
|
21733
|
+
function computeColWidths(colMax, totalWidth, colMinWord = []) {
|
|
21687
21734
|
const colCnt = colMax.length;
|
|
21688
21735
|
const minW = Math.min(Math.max(2e3, Math.round(totalWidth * 0.06)), Math.floor(totalWidth / colCnt));
|
|
21689
21736
|
const cap = Math.round(totalWidth * 0.8);
|
|
21690
21737
|
const raw = colMax.map((w) => Math.min(Math.max(w + CELL_PAD, minW), cap));
|
|
21738
|
+
const floor = raw.map((r, i) => Math.min(Math.max(minW, (colMinWord[i] ?? 0) + CELL_PAD), r, cap));
|
|
21691
21739
|
const widths = Array(colCnt).fill(0);
|
|
21692
21740
|
const free = new Set(raw.map((_, i) => i));
|
|
21693
21741
|
let budget = totalWidth;
|
|
21694
|
-
|
|
21695
|
-
for (
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21742
|
+
let sumFloorFree = floor.reduce((a, b) => a + b, 0);
|
|
21743
|
+
for (const i of [...raw.keys()].sort((a, b) => raw[a] - raw[b])) {
|
|
21744
|
+
if (free.size <= 1) break;
|
|
21745
|
+
const fixed = Math.round(raw[i] * 1.12);
|
|
21746
|
+
if (budget - fixed < sumFloorFree - floor[i]) break;
|
|
21747
|
+
widths[i] = fixed;
|
|
21748
|
+
free.delete(i);
|
|
21749
|
+
budget -= fixed;
|
|
21750
|
+
sumFloorFree -= floor[i];
|
|
21751
|
+
}
|
|
21752
|
+
const sumFreeRaw = [...free].reduce((a, i) => a + raw[i], 0);
|
|
21753
|
+
if (budget > sumFreeRaw * 1.6) {
|
|
21704
21754
|
const sumRaw = raw.reduce((a, b) => a + b, 0);
|
|
21705
|
-
for (let i = 0; i < colCnt; i++) widths[i]
|
|
21755
|
+
for (let i = 0; i < colCnt; i++) widths[i] = raw[i] + Math.floor(raw[i] / sumRaw * (totalWidth - sumRaw));
|
|
21756
|
+
free.clear();
|
|
21706
21757
|
} else {
|
|
21707
21758
|
for (; ; ) {
|
|
21708
21759
|
const sum2 = [...free].reduce((a, i) => a + raw[i], 0);
|
|
21709
|
-
const short = [...free].filter((i) => raw[i] / sum2 * budget <
|
|
21760
|
+
const short = [...free].filter((i) => raw[i] / sum2 * budget < floor[i]);
|
|
21710
21761
|
if (short.length === 0) break;
|
|
21762
|
+
const shortSum = short.reduce((a, i) => a + floor[i], 0);
|
|
21763
|
+
const scale = Math.min(1, (budget - (free.size - short.length) * minW) / shortSum);
|
|
21711
21764
|
for (const i of short) {
|
|
21712
|
-
widths[i] = minW;
|
|
21765
|
+
widths[i] = Math.max(minW, Math.floor(floor[i] * scale));
|
|
21713
21766
|
free.delete(i);
|
|
21714
|
-
budget -=
|
|
21767
|
+
budget -= widths[i];
|
|
21715
21768
|
}
|
|
21716
21769
|
if (free.size === 0) break;
|
|
21717
21770
|
}
|
|
@@ -21744,12 +21797,15 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0) {
|
|
|
21744
21797
|
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(rows[0]?.[0] ?? ""), seq);
|
|
21745
21798
|
const colMax = Array(colCnt).fill(0);
|
|
21746
21799
|
const colMaxBody = Array(colCnt).fill(0);
|
|
21800
|
+
const colMinWord = Array(colCnt).fill(0);
|
|
21747
21801
|
rows.forEach((row, r) => row.forEach((cell2, c) => {
|
|
21748
21802
|
const w = cellContentWidth(cell2, measureH);
|
|
21749
21803
|
if (w > colMax[c]) colMax[c] = w;
|
|
21750
21804
|
if (r > 0 && w > colMaxBody[c]) colMaxBody[c] = w;
|
|
21805
|
+
const mw = cellMinWordWidth(cell2, measureH);
|
|
21806
|
+
if (mw > colMinWord[c]) colMinWord[c] = mw;
|
|
21751
21807
|
}));
|
|
21752
|
-
const colWidths = profileColWidths(prof, colCnt) ?? computeColWidths(colMax, totalW);
|
|
21808
|
+
const colWidths = profileColWidths(prof, colCnt) ?? computeColWidths(colMax, totalW, colMinWord);
|
|
21753
21809
|
const colCentered = colWidths.map((w, c) => colMaxBody[c] + CELL_PAD <= w);
|
|
21754
21810
|
const labelCol0 = !!reg && colCnt === 2 && colCentered[0] && rows.every((r) => (r[0] ?? "").replace(/\*\*|__|`/g, "").length <= 12);
|
|
21755
21811
|
const tblId = nextTableId();
|
|
@@ -21828,16 +21884,19 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
21828
21884
|
const prof = takeProfile(remap, rowCnt, colCnt, first ? anchorOfHtmlCell(first.inner) : "", seq);
|
|
21829
21885
|
const colMax = Array(colCnt).fill(0);
|
|
21830
21886
|
const colMaxBody = Array(colCnt).fill(0);
|
|
21887
|
+
const colMinWord = Array(colCnt).fill(0);
|
|
21831
21888
|
const cellLines = placed.map((cell2) => htmlCellInnerToLines(cell2.inner).lines);
|
|
21832
21889
|
placed.forEach((cell2, i) => {
|
|
21833
21890
|
const w = Math.max(...cellLines[i].map((l) => measureTextWidth(unescapeHtml(l).trim(), measureH, 100)), 0) / cell2.colSpan;
|
|
21891
|
+
const mw = cell2.colSpan === 1 ? Math.max(...cellLines[i].map((l) => cellMinWordWidth(unescapeHtml(l), measureH)), 0) : 0;
|
|
21834
21892
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
21835
21893
|
const c = cell2.c + dc;
|
|
21836
21894
|
if (w > colMax[c]) colMax[c] = w;
|
|
21837
21895
|
if (!cell2.isHeader && w > colMaxBody[c]) colMaxBody[c] = w;
|
|
21896
|
+
if (dc === 0 && mw > colMinWord[c]) colMinWord[c] = mw;
|
|
21838
21897
|
}
|
|
21839
21898
|
});
|
|
21840
|
-
const colWidths = profileColWidths(prof, colCnt) ?? computeColWidths(colMax, totalWidth);
|
|
21899
|
+
const colWidths = profileColWidths(prof, colCnt) ?? computeColWidths(colMax, totalWidth, colMinWord);
|
|
21841
21900
|
const colCentered = colWidths.map((w, c) => colMaxBody[c] + CELL_PAD <= w);
|
|
21842
21901
|
const cellH = style ? Math.round(measureH * 1.6) + 282 : 1500;
|
|
21843
21902
|
const tblW = colWidths.reduce((a, b) => a + b, 0);
|
|
@@ -21949,6 +22008,118 @@ function buildTitleBox(title, titleCharPr, bodyWidth, reg) {
|
|
|
21949
22008
|
return `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`;
|
|
21950
22009
|
}
|
|
21951
22010
|
|
|
22011
|
+
// src/hwpx/gen-docframe.ts
|
|
22012
|
+
function docframeIds(base) {
|
|
22013
|
+
return { org: base, sender: base + 1, foot: base + 2, small: base + 3, pressLabel: base + 4, pressHead: base + 5, pressTitle: base + 6, pressSub: base + 7, pressContact: base + 8 };
|
|
22014
|
+
}
|
|
22015
|
+
function docframeActive(g) {
|
|
22016
|
+
return !!(g.docHead || g.docFoot || g.reportInfo || g.noticeHead || g.press);
|
|
22017
|
+
}
|
|
22018
|
+
function docframeCharPrXmls(base, measured) {
|
|
22019
|
+
const body = measured ? 4 : 0;
|
|
22020
|
+
const ids = docframeIds(base);
|
|
22021
|
+
return [
|
|
22022
|
+
charPr(ids.org, 1800, true, false, body),
|
|
22023
|
+
charPr(ids.sender, 2200, true, false, body),
|
|
22024
|
+
charPr(ids.foot, 900, false, false, body),
|
|
22025
|
+
charPr(ids.small, 1200, false, false, body),
|
|
22026
|
+
charPr(ids.pressLabel, 2e3, true, false, body),
|
|
22027
|
+
charPr(ids.pressHead, 1e3, true, false, body),
|
|
22028
|
+
charPr(ids.pressTitle, 2500, true, false, body),
|
|
22029
|
+
charPr(ids.pressSub, 1500, true, false, body),
|
|
22030
|
+
charPr(ids.pressContact, 1e3, false, false, body)
|
|
22031
|
+
];
|
|
22032
|
+
}
|
|
22033
|
+
function labeled(label, value, paraPrId) {
|
|
22034
|
+
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_BOLD}"><hp:t>${escapeXml(label)}</hp:t></hp:run><hp:run charPrIDRef="${CHAR_NORMAL}"><hp:t>${escapeXml(value)}</hp:t></hp:run></hp:p>`;
|
|
22035
|
+
}
|
|
22036
|
+
function blank() {
|
|
22037
|
+
return `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}"><hp:t></hp:t></hp:run></hp:p>`;
|
|
22038
|
+
}
|
|
22039
|
+
function buildDocHead(g, ids) {
|
|
22040
|
+
const h = g.docHead;
|
|
22041
|
+
const out = [];
|
|
22042
|
+
if (h.org) {
|
|
22043
|
+
out.push(para(h.org, GONGMUN_CENTER, ids.org), blank());
|
|
22044
|
+
}
|
|
22045
|
+
if (h.to !== void 0) out.push(labeled("\uC218\uC2E0 ", h.to, PARA_NORMAL));
|
|
22046
|
+
out.push(para(h.via ? `(\uACBD\uC720) ${h.via}` : "(\uACBD\uC720)", PARA_NORMAL, CHAR_NORMAL));
|
|
22047
|
+
if (h.title !== void 0) out.push(labeled("\uC81C\uBAA9 ", h.title, PARA_NORMAL));
|
|
22048
|
+
out.push(blank());
|
|
22049
|
+
return out;
|
|
22050
|
+
}
|
|
22051
|
+
var FOOT_SEP = "\u2500".repeat(46);
|
|
22052
|
+
function buildDocFoot(g, ids) {
|
|
22053
|
+
const f = g.docFoot;
|
|
22054
|
+
const out = [blank()];
|
|
22055
|
+
if (f.sender) {
|
|
22056
|
+
out.push(para(f.sender, GONGMUN_CENTER, ids.sender), blank());
|
|
22057
|
+
}
|
|
22058
|
+
const foot = (text) => para(text, GONGMUN_TBL_LEFT, ids.foot);
|
|
22059
|
+
out.push(foot(FOOT_SEP));
|
|
22060
|
+
if (f.drafter || f.reviewer || f.approver)
|
|
22061
|
+
out.push(foot(`\uAE30\uC548\uC790 ${f.drafter ?? ""} \uAC80\uD1A0\uC790 ${f.reviewer ?? ""} \uACB0\uC7AC\uAD8C\uC790 ${f.approver ?? ""}`));
|
|
22062
|
+
if (f.cooperator) out.push(foot(`\uD611\uC870\uC790 ${f.cooperator}`));
|
|
22063
|
+
if (f.docNum || f.receive) out.push(foot(`\uC2DC\uD589 ${f.docNum ?? ""} \uC811\uC218 ${f.receive ?? ""}`));
|
|
22064
|
+
if (f.address || f.site) out.push(foot(`${f.address ?? ""} / ${f.site ?? ""}`));
|
|
22065
|
+
if (f.phone || f.fax || f.email || f.disclosure)
|
|
22066
|
+
out.push(foot(`\uC804\uD654 ${f.phone ?? ""} \uC804\uC1A1 ${f.fax ?? ""} / ${f.email ?? ""} / ${f.disclosure ?? ""}`));
|
|
22067
|
+
return out;
|
|
22068
|
+
}
|
|
22069
|
+
function buildReportInfo(g, ids) {
|
|
22070
|
+
return para(g.reportInfo, GONGMUN_RIGHT, ids.small);
|
|
22071
|
+
}
|
|
22072
|
+
function buildNoticeHead(g) {
|
|
22073
|
+
const n = g.noticeHead;
|
|
22074
|
+
return n.no ? [para(n.no, PARA_NORMAL, CHAR_BOLD), blank()] : [];
|
|
22075
|
+
}
|
|
22076
|
+
function buildNoticeFoot(g) {
|
|
22077
|
+
const n = g.noticeHead;
|
|
22078
|
+
const out = [];
|
|
22079
|
+
if (n.date) out.push(blank(), para(n.date, GONGMUN_RIGHT, CHAR_NORMAL));
|
|
22080
|
+
if (n.sender) out.push(blank(), para(n.sender, GONGMUN_RIGHT, CHAR_BOLD));
|
|
22081
|
+
return out;
|
|
22082
|
+
}
|
|
22083
|
+
var PRESS_LABEL_H = 3200;
|
|
22084
|
+
var PRESS_HEAD_H = 900;
|
|
22085
|
+
function buildPressHead(g, ids, bodyWidth, reg) {
|
|
22086
|
+
const p = g.press;
|
|
22087
|
+
const w = bodyWidth - 280;
|
|
22088
|
+
const thick = { t: "thick", b: "thick", l: "thick", r: "thick" };
|
|
22089
|
+
const rows = [tc({ bf: reg.get({ ...thick, b: "thin" }), row: 0, col: 0, w, h: PRESS_LABEL_H, paras: para("\uBCF4\uB3C4\uC790\uB8CC", GONGMUN_TBL_CENTER, ids.pressLabel) })];
|
|
22090
|
+
const headLine = [
|
|
22091
|
+
p.release ? `\uBCF4\uB3C4\uC2DC\uC810 : ${p.release}` : "",
|
|
22092
|
+
p.distribute ? `\uBC30\uD3EC : ${p.distribute}` : ""
|
|
22093
|
+
].filter(Boolean).join(" / ");
|
|
22094
|
+
if (headLine) rows.push(tc({ bf: reg.get({ ...thick, t: "thin" }), row: 1, col: 0, w, h: PRESS_HEAD_H, paras: para(headLine, GONGMUN_TBL_CENTER, ids.pressHead) }));
|
|
22095
|
+
const table2 = tbl(rows, w, PRESS_LABEL_H + (headLine ? PRESS_HEAD_H : 0), 1);
|
|
22096
|
+
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
22097
|
+
}
|
|
22098
|
+
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
22099
|
+
const c = g.press?.contact;
|
|
22100
|
+
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
22101
|
+
const w = bodyWidth - 280;
|
|
22102
|
+
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", c.dept ?? ""], ["\uB2F4\uB2F9\uC790", c.manager ?? ""], ["\uC5F0\uB77D\uCC98", c.phone ?? ""]];
|
|
22103
|
+
const labelW = Math.round(w * 0.14);
|
|
22104
|
+
const valueW = Math.round(w / 3) - labelW;
|
|
22105
|
+
let col = 0;
|
|
22106
|
+
const row = cells.flatMap(([label, value], i) => {
|
|
22107
|
+
const bf = (first) => reg.get({
|
|
22108
|
+
t: "thick",
|
|
22109
|
+
b: "thick",
|
|
22110
|
+
l: first && i === 0 ? "thick" : "thin",
|
|
22111
|
+
r: !first && i === cells.length - 1 ? "thick" : "thin",
|
|
22112
|
+
fill: first ? "#E6E6E6" : void 0
|
|
22113
|
+
});
|
|
22114
|
+
return [
|
|
22115
|
+
tc({ bf: bf(true), row: 0, col: col++, w: labelW, h: 1100, paras: para(label, GONGMUN_TBL_CENTER, ids.pressHead) }),
|
|
22116
|
+
tc({ bf: bf(false), row: 0, col: col++, w: valueW, h: 1100, paras: para(value, GONGMUN_TBL_CENTER, ids.pressContact) })
|
|
22117
|
+
];
|
|
22118
|
+
});
|
|
22119
|
+
const table2 = tbl([row.join("")], w, 1100, cells.length * 2);
|
|
22120
|
+
return [blank(), `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`];
|
|
22121
|
+
}
|
|
22122
|
+
|
|
21952
22123
|
// src/hwpx/equation-generate.ts
|
|
21953
22124
|
var MAX_EQUATION_SOURCE = 1e4;
|
|
21954
22125
|
var MAX_GROUP_DEPTH = 64;
|
|
@@ -22241,9 +22412,10 @@ function generateSecPr(gongmun) {
|
|
|
22241
22412
|
m.footer = gongmun.headerFooter;
|
|
22242
22413
|
}
|
|
22243
22414
|
const secPr = `<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>`;
|
|
22244
|
-
|
|
22415
|
+
const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
|
|
22416
|
+
return secPr + colPr + (gongmun?.pageNumbers ? pageNumCtrl() : "");
|
|
22245
22417
|
}
|
|
22246
|
-
function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null, chartParts = null, bfReg = null, remap = null) {
|
|
22418
|
+
function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null, chartParts = null, bfReg = null, remap = null, dfIds = null) {
|
|
22247
22419
|
const paraXmls = [];
|
|
22248
22420
|
let isFirst = true;
|
|
22249
22421
|
let tableSeq = 0;
|
|
@@ -22251,12 +22423,14 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22251
22423
|
let prevWasOrdered = false;
|
|
22252
22424
|
const gaejosik = gongmun?.preset === "gaejosik";
|
|
22253
22425
|
const measured = !!gongmun && usesReportFonts(gongmun.preset);
|
|
22254
|
-
const vBase = charVariantBase(measured);
|
|
22426
|
+
const vBase = charVariantBase(measured, !!gongmun);
|
|
22255
22427
|
const tableStyle = gongmun ? {
|
|
22256
22428
|
totalWidth: mmToHwpunit(210 - gongmun.margins.left - gongmun.margins.right),
|
|
22257
|
-
|
|
22258
|
-
|
|
22259
|
-
|
|
22429
|
+
// 표 셀 크기 — 실측: 실측 프리셋 맑은 고딕 12pt(22·23), 비실측도 12pt(11·12,
|
|
22430
|
+
// 실결재 지배값 — 본문 크기 셀은 열폭 부족으로 서술 열 세로 신장, v4.0.2 QA)
|
|
22431
|
+
charPr: measured ? GJ_CHAR_TABLE : GONGMUN_TBL_CHAR,
|
|
22432
|
+
boldCharPr: measured ? GJ_CHAR_TABLE_BOLD : GONGMUN_TBL_CHAR_BOLD,
|
|
22433
|
+
charHeight: measured ? gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).table : GONGMUN_TBL_PT,
|
|
22260
22434
|
headerBf: gongmunTableHeaderBf(gaejosik),
|
|
22261
22435
|
centerParaPr: GONGMUN_CENTER,
|
|
22262
22436
|
tblCenterParaPr: GONGMUN_TBL_CENTER,
|
|
@@ -22271,11 +22445,24 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22271
22445
|
let pendingPageBreak = false;
|
|
22272
22446
|
let pendingNewNum = false;
|
|
22273
22447
|
let titleBoxH1Idx = -1;
|
|
22448
|
+
let pressH1Idx = -1;
|
|
22274
22449
|
let hasFrontPages = false;
|
|
22275
22450
|
const preamble = [];
|
|
22451
|
+
if (gongmun?.reportInfo && dfIds) {
|
|
22452
|
+
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
22453
|
+
}
|
|
22276
22454
|
if (gongmun?.approval && bfReg) {
|
|
22277
22455
|
preamble.push(buildApprovalTable(gongmun.approval, gongmun, bfReg));
|
|
22278
22456
|
}
|
|
22457
|
+
if (gongmun?.docHead && dfIds) {
|
|
22458
|
+
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
22459
|
+
}
|
|
22460
|
+
if (gongmun?.noticeHead && dfIds) {
|
|
22461
|
+
preamble.push(...buildNoticeHead(gongmun));
|
|
22462
|
+
}
|
|
22463
|
+
if (gongmun?.press && dfIds && bfReg && tableStyle) {
|
|
22464
|
+
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
22465
|
+
}
|
|
22279
22466
|
if (gaejosik && gongmun) {
|
|
22280
22467
|
const h1Idx = blocks.findIndex((b) => b.type === "heading" && (b.level ?? 1) === 1);
|
|
22281
22468
|
const chapters = blocks.filter((b) => b.type === "heading" && b.level === 2).map((b) => stripChapterNumber(b.text || ""));
|
|
@@ -22300,6 +22487,8 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22300
22487
|
}
|
|
22301
22488
|
} else if (gongmun && !gaejosik && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
22302
22489
|
titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (b.level ?? 1) === 1);
|
|
22490
|
+
} else if (gongmun?.press && dfIds) {
|
|
22491
|
+
pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (b.level ?? 1) === 1);
|
|
22303
22492
|
}
|
|
22304
22493
|
if (preamble.length > 0) {
|
|
22305
22494
|
preamble[0] = preamble[0].replace(` pageBreak="1"`, "").replace(/<hp:run charPrIDRef="(\d+)">/, `<hp:run charPrIDRef="$1">${generateSecPr(gongmun)}`);
|
|
@@ -22319,6 +22508,14 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22319
22508
|
}
|
|
22320
22509
|
switch (block.type) {
|
|
22321
22510
|
case "heading": {
|
|
22511
|
+
if (gongmun && blockIdx === pressH1Idx && dfIds) {
|
|
22512
|
+
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
22513
|
+
for (const s of gongmun.press?.sub ?? []) {
|
|
22514
|
+
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
22515
|
+
}
|
|
22516
|
+
xml = parts.join("\n ");
|
|
22517
|
+
break;
|
|
22518
|
+
}
|
|
22322
22519
|
if (gongmun && blockIdx === titleBoxH1Idx && tableStyle && bfReg) {
|
|
22323
22520
|
xml = buildTitleBox((block.text || "").trim(), measured ? GJ_CHAR_BODY_TITLE : CHAR_H1, tableStyle.totalWidth, bfReg);
|
|
22324
22521
|
break;
|
|
@@ -22337,7 +22534,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22337
22534
|
(id) => id === CHAR_BOLD ? GJ_CHAR_DAE_BOLD : id
|
|
22338
22535
|
);
|
|
22339
22536
|
} else {
|
|
22340
|
-
xml = generateParagraph(
|
|
22537
|
+
xml = generateParagraph(`${gongmun.bullet2} ${block.text || ""}`, GONGMUN_LIST_BASE + 1, CHAR_NORMAL);
|
|
22341
22538
|
}
|
|
22342
22539
|
break;
|
|
22343
22540
|
}
|
|
@@ -22353,7 +22550,8 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22353
22550
|
break;
|
|
22354
22551
|
}
|
|
22355
22552
|
case "paragraph": {
|
|
22356
|
-
|
|
22553
|
+
const pTrim = (block.text || "").trimStart();
|
|
22554
|
+
if (measured && (pTrim.startsWith("\u203B") || /^\*\s/.test(pTrim))) {
|
|
22357
22555
|
xml = generateParagraph((block.text || "").trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
|
|
22358
22556
|
break;
|
|
22359
22557
|
}
|
|
@@ -22420,14 +22618,26 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22420
22618
|
xml = generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
|
|
22421
22619
|
break;
|
|
22422
22620
|
}
|
|
22621
|
+
if (measured && block.marker === "*") {
|
|
22622
|
+
xml = generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
|
|
22623
|
+
break;
|
|
22624
|
+
}
|
|
22423
22625
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
22626
|
+
const listParaPr = marker2 ? GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
22424
22627
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
22425
22628
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
22426
22629
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
22427
22630
|
listCharPr = GJ_CHAR_DAE;
|
|
22428
22631
|
mapId = (id) => id === CHAR_BOLD ? GJ_CHAR_DAE_BOLD : id;
|
|
22429
22632
|
}
|
|
22430
|
-
|
|
22633
|
+
if (gongmun.preset === "press") {
|
|
22634
|
+
if (depth === 0) listCharPr = CHAR_NORMAL;
|
|
22635
|
+
if (depth >= 2 && dfIds) {
|
|
22636
|
+
listCharPr = dfIds.small;
|
|
22637
|
+
mapId = void 0;
|
|
22638
|
+
}
|
|
22639
|
+
}
|
|
22640
|
+
xml = generateParagraph(text, listParaPr, listCharPr, mapId);
|
|
22431
22641
|
break;
|
|
22432
22642
|
}
|
|
22433
22643
|
const indent = block.indent || 0;
|
|
@@ -22501,10 +22711,19 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
22501
22711
|
}
|
|
22502
22712
|
paraXmls.push(xml);
|
|
22503
22713
|
}
|
|
22714
|
+
if (gongmun?.noticeHead && dfIds) {
|
|
22715
|
+
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
22716
|
+
}
|
|
22504
22717
|
if (gongmun?.endMark && paraXmls.length > 0) {
|
|
22505
22718
|
const lastText = [...blocks].reverse().find((b) => (b.type === "paragraph" || b.type === "list_item") && (b.text || "").trim())?.text ?? "";
|
|
22506
22719
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
22507
22720
|
}
|
|
22721
|
+
if (gongmun?.docFoot && dfIds) {
|
|
22722
|
+
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
22723
|
+
}
|
|
22724
|
+
if (gongmun?.press && dfIds && bfReg && tableStyle) {
|
|
22725
|
+
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
22726
|
+
}
|
|
22508
22727
|
if (paraXmls.length === 0) {
|
|
22509
22728
|
paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run></hp:p>`);
|
|
22510
22729
|
}
|
|
@@ -22524,10 +22743,13 @@ async function markdownToHwpx(markdown, options) {
|
|
|
22524
22743
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
22525
22744
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
22526
22745
|
const staticBfEnd = gongmun ? gaejosik ? 11 : 4 : 3;
|
|
22527
|
-
const remap = options?.profile ? buildProfileRemap(options.profile, charVariantBase(measured) + (fit?.variants?.length ?? 0) * 4, staticBfEnd) : null;
|
|
22746
|
+
const remap = options?.profile ? buildProfileRemap(options.profile, charVariantBase(measured, !!gongmun) + (fit?.variants?.length ?? 0) * 4, staticBfEnd) : null;
|
|
22528
22747
|
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (remap?.borderFillXmls.length ?? 0)) : null;
|
|
22748
|
+
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
22749
|
+
const dfBase = charVariantBase(measured, !!gongmun) + (fit?.variants?.length ?? 0) * 4 + (remap?.charPrXmls.length ?? 0);
|
|
22750
|
+
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
22529
22751
|
const chartParts = [];
|
|
22530
|
-
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap);
|
|
22752
|
+
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds);
|
|
22531
22753
|
if (remap && remap.tables.length > 0) {
|
|
22532
22754
|
const unused = remap.tables.filter((t) => !t.used).length;
|
|
22533
22755
|
if (unused === remap.tables.length) {
|
|
@@ -22539,7 +22761,13 @@ async function markdownToHwpx(markdown, options) {
|
|
|
22539
22761
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
22540
22762
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
22541
22763
|
zip.file("Contents/content.hpf", generateManifest(chartParts));
|
|
22542
|
-
zip.file("Contents/header.xml", generateHeaderXml(
|
|
22764
|
+
zip.file("Contents/header.xml", generateHeaderXml(
|
|
22765
|
+
theme,
|
|
22766
|
+
gongmun,
|
|
22767
|
+
fit?.variants ?? [],
|
|
22768
|
+
extraBorderFills,
|
|
22769
|
+
[...remap?.charPrXmls ?? [], ...dfActive ? docframeCharPrXmls(dfBase, measured) : []]
|
|
22770
|
+
));
|
|
22543
22771
|
zip.file("Contents/section0.xml", sectionXml);
|
|
22544
22772
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
22545
22773
|
zip.file("Preview/PrvText.txt", buildPrvText(blocks));
|
|
@@ -25892,7 +26120,7 @@ async function parseHwp(buffer, options) {
|
|
|
25892
26120
|
async function parsePdf(buffer, options) {
|
|
25893
26121
|
let parsePdfDocument;
|
|
25894
26122
|
try {
|
|
25895
|
-
const mod = await import("./parser-
|
|
26123
|
+
const mod = await import("./parser-3HM2VYKK.js");
|
|
25896
26124
|
parsePdfDocument = mod.parsePdfDocument;
|
|
25897
26125
|
} catch {
|
|
25898
26126
|
return {
|
|
@@ -26024,4 +26252,4 @@ export {
|
|
|
26024
26252
|
parseHwpml,
|
|
26025
26253
|
fillForm
|
|
26026
26254
|
};
|
|
26027
|
-
//# sourceMappingURL=chunk-
|
|
26255
|
+
//# sourceMappingURL=chunk-AHWRAGXN.js.map
|