kordoc 3.16.0 → 3.16.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/README.md +1 -1
- package/dist/{-H7N62NZU.js → -C4FVXHIP.js} +7 -7
- package/dist/{chunk-IC56KHBL.js → chunk-4WI7QXEG.js} +2 -2
- package/dist/{chunk-BIP4JAVG.cjs → chunk-72LLOLFX.cjs} +13 -6
- package/dist/chunk-72LLOLFX.cjs.map +1 -0
- package/dist/{chunk-5RHRQ7HK.js → chunk-E4Y73XRH.js} +8 -4
- package/dist/chunk-E4Y73XRH.js.map +1 -0
- package/dist/{chunk-Q7EGGW3H.js → chunk-EJ2ZIYTO.js} +13 -6
- package/dist/chunk-EJ2ZIYTO.js.map +1 -0
- package/dist/{chunk-WD5NUUU6.js → chunk-EUEKDZ7O.js} +315 -262
- package/dist/chunk-EUEKDZ7O.js.map +1 -0
- package/dist/{chunk-JFNWJFKP.js → chunk-HECUYZZK.js} +2 -2
- package/dist/{chunk-LYL4IL3E.js → chunk-IS3IK7UT.js} +13 -6
- package/dist/chunk-IS3IK7UT.js.map +1 -0
- package/dist/{chunk-FGL7BH4P.js → chunk-WR5LHRXO.js} +49 -20
- package/dist/chunk-WR5LHRXO.js.map +1 -0
- package/dist/cli.js +56 -17
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +586 -502
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +358 -274
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +25 -16
- package/dist/mcp.js.map +1 -1
- package/dist/{parser-HBHCD7TE.js → parser-CMPNM6ZL.js} +25 -12
- package/dist/parser-CMPNM6ZL.js.map +1 -0
- package/dist/{parser-5G247XYD.js → parser-GWL72XYS.js} +24 -11
- package/dist/parser-GWL72XYS.js.map +1 -0
- package/dist/{parser-6V7F3GET.cjs → parser-YVRTKGKO.cjs} +36 -23
- package/dist/parser-YVRTKGKO.cjs.map +1 -0
- package/dist/render-A2LFMJCP.js +10 -0
- package/dist/seal-KA4VAV2Z.js +10 -0
- package/dist/{watch-HIYNOSFD.js → watch-WLI6K3IR.js} +7 -7
- package/package.json +2 -5
- package/dist/chunk-5RHRQ7HK.js.map +0 -1
- package/dist/chunk-BIP4JAVG.cjs.map +0 -1
- package/dist/chunk-FGL7BH4P.js.map +0 -1
- package/dist/chunk-LYL4IL3E.js.map +0 -1
- package/dist/chunk-Q7EGGW3H.js.map +0 -1
- package/dist/chunk-WD5NUUU6.js.map +0 -1
- package/dist/parser-5G247XYD.js.map +0 -1
- package/dist/parser-6V7F3GET.cjs.map +0 -1
- package/dist/parser-HBHCD7TE.js.map +0 -1
- package/dist/render-VA4NHROW.js +0 -10
- package/dist/seal-UVDRGHEF.js +0 -10
- /package/dist/{-H7N62NZU.js.map → -C4FVXHIP.js.map} +0 -0
- /package/dist/{chunk-IC56KHBL.js.map → chunk-4WI7QXEG.js.map} +0 -0
- /package/dist/{chunk-JFNWJFKP.js.map → chunk-HECUYZZK.js.map} +0 -0
- /package/dist/{render-VA4NHROW.js.map → render-A2LFMJCP.js.map} +0 -0
- /package/dist/{seal-UVDRGHEF.js.map → seal-KA4VAV2Z.js.map} +0 -0
- /package/dist/{watch-HIYNOSFD.js.map → watch-WLI6K3IR.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
blocksToMarkdown,
|
|
7
7
|
safeMax,
|
|
8
8
|
safeMin
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EJ2ZIYTO.js";
|
|
10
10
|
import {
|
|
11
11
|
parsePageRange
|
|
12
12
|
} from "./chunk-GE43BE46.js";
|
|
@@ -46,14 +46,14 @@ function extractLines(fnArray, argsArray) {
|
|
|
46
46
|
pushSeg(rx, ry + rh, rx, ry);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function flushPath(isStroke) {
|
|
49
|
+
function flushPath(isStroke, fromFill = false) {
|
|
50
50
|
if (!isStroke) {
|
|
51
51
|
currentPath = [];
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const effWidth = lineWidth * ctmScale();
|
|
55
55
|
for (const seg of currentPath) {
|
|
56
|
-
classifyAndAdd(seg, effWidth, horizontals, verticals);
|
|
56
|
+
classifyAndAdd(seg, effWidth, horizontals, verticals, fromFill);
|
|
57
57
|
}
|
|
58
58
|
currentPath = [];
|
|
59
59
|
}
|
|
@@ -151,7 +151,9 @@ function extractLines(fnArray, argsArray) {
|
|
|
151
151
|
}
|
|
152
152
|
if (afterOp === OPS.stroke || afterOp === OPS.closeStroke) {
|
|
153
153
|
flushPath(true);
|
|
154
|
-
} else if (afterOp === OPS.fill || afterOp === OPS.eoFill
|
|
154
|
+
} else if (afterOp === OPS.fill || afterOp === OPS.eoFill) {
|
|
155
|
+
flushPath(true, true);
|
|
156
|
+
} else if (afterOp === OPS.fillStroke || afterOp === OPS.eoFillStroke || afterOp === OPS.closeFillStroke || afterOp === OPS.closeEOFillStroke) {
|
|
155
157
|
flushPath(true);
|
|
156
158
|
} else if (afterOp === OPS.endPath) {
|
|
157
159
|
flushPath(false);
|
|
@@ -165,6 +167,8 @@ function extractLines(fnArray, argsArray) {
|
|
|
165
167
|
break;
|
|
166
168
|
case OPS.fill:
|
|
167
169
|
case OPS.eoFill:
|
|
170
|
+
flushPath(true, true);
|
|
171
|
+
break;
|
|
168
172
|
case OPS.fillStroke:
|
|
169
173
|
case OPS.eoFillStroke:
|
|
170
174
|
case OPS.closeFillStroke:
|
|
@@ -178,7 +182,7 @@ function extractLines(fnArray, argsArray) {
|
|
|
178
182
|
}
|
|
179
183
|
return { horizontals, verticals };
|
|
180
184
|
}
|
|
181
|
-
function classifyAndAdd(seg, lineWidth, horizontals, verticals) {
|
|
185
|
+
function classifyAndAdd(seg, lineWidth, horizontals, verticals, fromFill = false) {
|
|
182
186
|
const dx = Math.abs(seg.x2 - seg.x1);
|
|
183
187
|
const dy = Math.abs(seg.y2 - seg.y1);
|
|
184
188
|
const length = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -187,12 +191,12 @@ function classifyAndAdd(seg, lineWidth, horizontals, verticals) {
|
|
|
187
191
|
const y = (seg.y1 + seg.y2) / 2;
|
|
188
192
|
const x1 = Math.min(seg.x1, seg.x2);
|
|
189
193
|
const x2 = Math.max(seg.x1, seg.x2);
|
|
190
|
-
horizontals.push({ x1, y1: y, x2, y2: y, lineWidth });
|
|
194
|
+
horizontals.push({ x1, y1: y, x2, y2: y, lineWidth, fromFill });
|
|
191
195
|
} else if (dx <= ORIENTATION_TOL) {
|
|
192
196
|
const x = (seg.x1 + seg.x2) / 2;
|
|
193
197
|
const y1 = Math.min(seg.y1, seg.y2);
|
|
194
198
|
const y2 = Math.max(seg.y1, seg.y2);
|
|
195
|
-
verticals.push({ x1: x, y1, x2: x, y2, lineWidth });
|
|
199
|
+
verticals.push({ x1: x, y1, x2: x, y2, lineWidth, fromFill });
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
function preprocessLines(horizontals, verticals) {
|
|
@@ -240,7 +244,10 @@ function dropShadingStacks(lines, dir) {
|
|
|
240
244
|
for (let j = s + 1; j <= e; j++) pitches.push(coord(group[j]) - coord(group[j - 1]));
|
|
241
245
|
pitches.sort((a, b) => a - b);
|
|
242
246
|
const medPitch = pitches[Math.floor(pitches.length / 2)] ?? 0;
|
|
243
|
-
|
|
247
|
+
let fillN = 0;
|
|
248
|
+
for (let j = s; j <= e; j++) if (group[j].fromFill) fillN++;
|
|
249
|
+
const stackIsFill = fillN * 2 > e - s + 1;
|
|
250
|
+
const edgeAlien = (j, inwardGap) => stackIsFill && !group[j].fromFill || wKey(group[j]) !== domW || medPitch > 0 && inwardGap > medPitch * 1.8;
|
|
244
251
|
while (e - s + 1 >= STACK_MIN_LINES) {
|
|
245
252
|
if (edgeAlien(s, coord(group[s + 1]) - coord(group[s]))) {
|
|
246
253
|
s++;
|
|
@@ -268,6 +275,7 @@ var EDGE_INSET = 15;
|
|
|
268
275
|
var EDGE_NEAR = 10;
|
|
269
276
|
var EDGE_CONNECT_TOL = 5;
|
|
270
277
|
var EDGE_YGAP_SPLIT_K = 2.5;
|
|
278
|
+
var EDGE_YGAP_ABS_MIN = 30;
|
|
271
279
|
var CHAIN_Y_TOL = 1.5;
|
|
272
280
|
var CHAIN_GAP = 3;
|
|
273
281
|
function chainCollinearRules(horizontals) {
|
|
@@ -321,7 +329,12 @@ function closeOpenTableEdges(horizontals, verticals) {
|
|
|
321
329
|
const threshold = median * EDGE_YGAP_SPLIT_K;
|
|
322
330
|
let cur = sorted.length ? [sorted[0]] : [];
|
|
323
331
|
for (let i = 1; i < sorted.length; i++) {
|
|
324
|
-
|
|
332
|
+
const yLo = sorted[i - 1].y1, yHi = sorted[i].y1;
|
|
333
|
+
const gap = yHi - yLo;
|
|
334
|
+
const gx1 = Math.min(sorted[i - 1].x1, sorted[i].x1);
|
|
335
|
+
const gx2 = Math.max(sorted[i - 1].x2, sorted[i].x2);
|
|
336
|
+
const bridged = verticals.some((vl) => vl.y1 <= yLo + EDGE_NEAR && vl.y2 >= yHi - EDGE_NEAR && vl.x1 >= gx1 - EDGE_CONNECT_TOL && vl.x1 <= gx2 + EDGE_CONNECT_TOL);
|
|
337
|
+
if (median > 0 && gap > threshold && gap > EDGE_YGAP_ABS_MIN && !bridged && cur.length >= EDGE_MIN_RULES && sorted.length - i >= EDGE_MIN_RULES) {
|
|
325
338
|
splitGroups.push(cur);
|
|
326
339
|
cur = [];
|
|
327
340
|
}
|
|
@@ -2377,7 +2390,7 @@ function shouldDemoteTable(table) {
|
|
|
2377
2390
|
const t = c.text.trim();
|
|
2378
2391
|
return t.length > 0 && t.length <= 12 && !/[□■◆○●▶ㅇ<>]/.test(t);
|
|
2379
2392
|
}) && table.cells.slice(1).some((row) => row.some((c) => c.text.trim() !== ""))) return false;
|
|
2380
|
-
if (table.rows <= 3 && table.cols <= 3) {
|
|
2393
|
+
if (table.rows <= 3 && table.cols <= 3 && allText.length <= 200) {
|
|
2381
2394
|
const totalCells2 = table.rows * table.cols;
|
|
2382
2395
|
const emptyCells2 = totalCells2 - allCells.length;
|
|
2383
2396
|
if (emptyCells2 >= totalCells2 * 0.3) return true;
|
|
@@ -3571,4 +3584,4 @@ export {
|
|
|
3571
3584
|
parsePdfDocument,
|
|
3572
3585
|
removeHeaderFooterBlocks
|
|
3573
3586
|
};
|
|
3574
|
-
//# sourceMappingURL=parser-
|
|
3587
|
+
//# sourceMappingURL=parser-GWL72XYS.js.map
|