@hawkeyexl/manni 2.3.2 → 2.3.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/README.md +1 -1
- package/dist/{chunk-PTCA7ETL.js → chunk-2I5U4HXR.js} +71 -3
- package/dist/chunk-2I5U4HXR.js.map +1 -0
- package/dist/{chunk-4XNZNHQH.js → chunk-AUWNPYWA.js} +2 -2
- package/dist/{chunk-KFB6EYK3.js → chunk-SN5CEVX7.js} +2 -2
- package/dist/{chunk-KFB6EYK3.js.map → chunk-SN5CEVX7.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-PTCA7ETL.js.map +0 -1
- /package/dist/{chunk-4XNZNHQH.js.map → chunk-AUWNPYWA.js.map} +0 -0
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
withValueAt,
|
|
70
70
|
writeEncryptionKey,
|
|
71
71
|
writeFileAtomic
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-SN5CEVX7.js";
|
|
73
73
|
|
|
74
74
|
// src/meta/core/reencrypt.ts
|
|
75
75
|
import { extname } from "node:path";
|
|
@@ -365,6 +365,10 @@ function parseSrc(src) {
|
|
|
365
365
|
range.end = end;
|
|
366
366
|
return range;
|
|
367
367
|
}
|
|
368
|
+
function tooWide(lines) {
|
|
369
|
+
const width = lines.end - lines.start + 1;
|
|
370
|
+
return width > MAX_RANGE_LINES ? `spans ${String(width)} lines, more than ${String(MAX_RANGE_LINES)}` : void 0;
|
|
371
|
+
}
|
|
368
372
|
function formatSrc(range) {
|
|
369
373
|
const { path, start, end } = range;
|
|
370
374
|
if (start === void 0) return path;
|
|
@@ -840,6 +844,56 @@ function unitHolding(text, line, format, body) {
|
|
|
840
844
|
if (paragraph?.line !== start) return void 0;
|
|
841
845
|
return { start, end: lineAt(text, paragraph.end), kind: "paragraph" };
|
|
842
846
|
}
|
|
847
|
+
var LIST_ITEM = /^([ \t]*)([-*+]|\d{1,9}[.)])([ \t]+|$)/;
|
|
848
|
+
var THEMATIC_BREAK = /^[ \t]*([-*_])(?:[ \t]*\1){2,}[ \t]*$/;
|
|
849
|
+
function textOfLine(text, n) {
|
|
850
|
+
const pos = offsetOfLine(text, n);
|
|
851
|
+
return lineText(text, pos, lineEnd(text, pos));
|
|
852
|
+
}
|
|
853
|
+
function indentOf(line) {
|
|
854
|
+
return /^[ \t]*/.exec(line)?.[0] ?? "";
|
|
855
|
+
}
|
|
856
|
+
function columnOf(indent) {
|
|
857
|
+
let column = 0;
|
|
858
|
+
for (const ch of indent) column = ch === " " ? column + 4 - column % 4 : column + 1;
|
|
859
|
+
return column;
|
|
860
|
+
}
|
|
861
|
+
function listItemOf(line) {
|
|
862
|
+
if (THEMATIC_BREAK.test(line)) return void 0;
|
|
863
|
+
const match = LIST_ITEM.exec(line);
|
|
864
|
+
if (match === null) return void 0;
|
|
865
|
+
const [, lead = "", bullet = "", gap = ""] = match;
|
|
866
|
+
return { lead, bullet, gap };
|
|
867
|
+
}
|
|
868
|
+
function continuesList(text, line, format, bodyLine, column) {
|
|
869
|
+
let n = line - 1;
|
|
870
|
+
while (n >= bodyLine) {
|
|
871
|
+
const above = textOfLine(text, n);
|
|
872
|
+
if (above.trim() !== "" && !isMarkerLine(above, format)) break;
|
|
873
|
+
n--;
|
|
874
|
+
}
|
|
875
|
+
if (n < bodyLine) return false;
|
|
876
|
+
if (columnOf(indentOf(textOfLine(text, n))) > column) return true;
|
|
877
|
+
for (; n >= bodyLine; n--) {
|
|
878
|
+
const above = textOfLine(text, n);
|
|
879
|
+
if (above.trim() === "" || ANY_FENCE.test(above) || isMarkerLine(above, format)) break;
|
|
880
|
+
const item = listItemOf(above);
|
|
881
|
+
if (item !== void 0 && columnOf(item.lead) === column) return true;
|
|
882
|
+
}
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
function markerIndent(text, line, format, bodyLine) {
|
|
886
|
+
if (format === "asciidoc") return "";
|
|
887
|
+
const own = textOfLine(text, line);
|
|
888
|
+
const indent = indentOf(own);
|
|
889
|
+
if (format !== "markdown" && format !== "mdx") return indent;
|
|
890
|
+
const item = listItemOf(own);
|
|
891
|
+
if (item === void 0 || !continuesList(text, line, format, bodyLine, columnOf(item.lead))) {
|
|
892
|
+
return indent;
|
|
893
|
+
}
|
|
894
|
+
const gap = item.gap === "" || columnOf(item.gap) > 4 ? " " : item.gap;
|
|
895
|
+
return item.lead + " ".repeat(item.bullet.length) + gap;
|
|
896
|
+
}
|
|
843
897
|
function anchoredLines(text, after, format, quote = false) {
|
|
844
898
|
if (quote) {
|
|
845
899
|
const block = fencedBlockAfter(text, after, format);
|
|
@@ -1457,6 +1511,16 @@ function readPage(file, content, opts) {
|
|
|
1457
1511
|
);
|
|
1458
1512
|
return;
|
|
1459
1513
|
}
|
|
1514
|
+
const wide = ["claim", "source"].map((end) => {
|
|
1515
|
+
const lines = end === "claim" ? citation.claim?.lines : citation.source.lines;
|
|
1516
|
+
const parsed = lines === void 0 ? void 0 : parseLines(lines);
|
|
1517
|
+
const reason = parsed === void 0 ? void 0 : tooWide(parsed);
|
|
1518
|
+
return reason === void 0 ? void 0 : `${end}.lines "${String(lines)}" ${reason}`;
|
|
1519
|
+
}).find((message) => message !== void 0);
|
|
1520
|
+
if (wide !== void 0) {
|
|
1521
|
+
findings.push(finding("entry-invalid", named(citation.id, wide), subject));
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1460
1524
|
const encrypted = isEncryptedValue(citation.source.file);
|
|
1461
1525
|
if (encrypted !== isKeyedPin(citation.source.integrity)) {
|
|
1462
1526
|
findings.push(
|
|
@@ -2352,6 +2416,8 @@ function refusalFor(reason, path, encrypted) {
|
|
|
2352
2416
|
}
|
|
2353
2417
|
async function mintCitation(opts) {
|
|
2354
2418
|
const range = parseSrc(opts.src);
|
|
2419
|
+
const wide = range.start === void 0 || range.end === void 0 ? void 0 : tooWide({ start: range.start, end: range.end });
|
|
2420
|
+
if (wide !== void 0) throw new CiteError(`Invalid range "${opts.src}": it ${wide}.`);
|
|
2355
2421
|
const { key } = opts;
|
|
2356
2422
|
const encrypt = opts.encrypt === true || range.encrypted;
|
|
2357
2423
|
if (encrypt && !range.encrypted && key === void 0) {
|
|
@@ -2866,6 +2932,8 @@ async function runAdd(opts) {
|
|
|
2866
2932
|
if (marker && opts.id === void 0) {
|
|
2867
2933
|
throw new CiteError("--marker needs --id: the marker names the entry.");
|
|
2868
2934
|
}
|
|
2935
|
+
const wide = pageLines === void 0 ? void 0 : tooWide(pageLines);
|
|
2936
|
+
if (wide !== void 0) throw new CiteError(`Invalid range "${at2}": it ${wide}.`);
|
|
2869
2937
|
if (quote && pageLines === void 0) {
|
|
2870
2938
|
throw new CiteError(`--quote needs the block's lines: ${label}:L1-L2.`);
|
|
2871
2939
|
}
|
|
@@ -2923,7 +2991,7 @@ async function runAdd(opts) {
|
|
|
2923
2991
|
);
|
|
2924
2992
|
}
|
|
2925
2993
|
shifted = shiftedEntries(page.citations, holding.start, page.bodyLine, label);
|
|
2926
|
-
const statement = formatStatement(format, { kind: "ref", id: opts.id ?? "" });
|
|
2994
|
+
const statement = markerIndent(content, holding.start, format, page.bodyLine) + formatStatement(format, { kind: "ref", id: opts.id ?? "" });
|
|
2927
2995
|
const insertAt = offsetOfLine(content, holding.start);
|
|
2928
2996
|
body = insertStatementBefore(content, insertAt, statement);
|
|
2929
2997
|
markerAt = holding.start;
|
|
@@ -4190,4 +4258,4 @@ export {
|
|
|
4190
4258
|
runKeyRotate,
|
|
4191
4259
|
runKeySet
|
|
4192
4260
|
};
|
|
4193
|
-
//# sourceMappingURL=chunk-
|
|
4261
|
+
//# sourceMappingURL=chunk-2I5U4HXR.js.map
|