@hawkeyexl/manni 2.8.3 → 2.8.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.
package/README.md CHANGED
@@ -98,7 +98,7 @@ actually reads rather than hand-written:
98
98
  ```yaml
99
99
  repos:
100
100
  - repo: https://github.com/hawkeyexl/manni
101
- rev: v2.8.3
101
+ rev: v2.8.4
102
102
  hooks:
103
103
  - id: manni-meta
104
104
  ```
@@ -61,7 +61,7 @@ import {
61
61
  supportedExtensions,
62
62
  terminalConfirm,
63
63
  toJsonText
64
- } from "./chunk-KGI7B6DD.js";
64
+ } from "./chunk-XHH5OSQQ.js";
65
65
 
66
66
  // src/meta/cli.ts
67
67
  import { existsSync } from "node:fs";
@@ -1517,4 +1517,4 @@ export {
1517
1517
  reportConfig,
1518
1518
  buildProgram
1519
1519
  };
1520
- //# sourceMappingURL=chunk-KYTHN2VT.js.map
1520
+ //# sourceMappingURL=chunk-3QRJR6LM.js.map
@@ -75,7 +75,7 @@ import {
75
75
  withValueAt,
76
76
  writeEncryptionKey,
77
77
  writeFileAtomic
78
- } from "./chunk-KGI7B6DD.js";
78
+ } from "./chunk-XHH5OSQQ.js";
79
79
 
80
80
  // src/meta/core/reencrypt.ts
81
81
  import { extname } from "node:path";
@@ -1036,10 +1036,14 @@ function fenceSpanAt(text, line, format) {
1036
1036
  if (!block || block.line !== line) return void 0;
1037
1037
  return { start: line, end: lineAt(text, block.end) };
1038
1038
  }
1039
- function insideFence(text, bodyOffset, line, format) {
1040
- return fencedBlocks(text, bodyOffset, format).some(
1041
- (block) => line > block.line && line <= lineAt(text, block.end)
1039
+ function fenceAround(text, bodyOffset, line, format) {
1040
+ const block = fencedBlocks(text, bodyOffset, format).find(
1041
+ (b) => line > b.line && line <= lineAt(text, b.end)
1042
1042
  );
1043
+ return block === void 0 ? void 0 : { start: block.line, end: lineAt(text, block.end) };
1044
+ }
1045
+ function insideFence(text, bodyOffset, line, format) {
1046
+ return fenceAround(text, bodyOffset, line, format) !== void 0;
1043
1047
  }
1044
1048
  function unitHolding(text, line, format, body) {
1045
1049
  const textOf = (n) => lineText(text, offsetOfLine(text, n), lineEnd(text, offsetOfLine(text, n)));
@@ -1722,9 +1726,12 @@ function spellElsewhere(spans) {
1722
1726
  const last = named4.pop() ?? "";
1723
1727
  return named4.length === 0 ? `${noun} ${last}` : `${noun} ${named4.join(", ")} and ${last}`;
1724
1728
  }
1725
- function rowsAt(line, lines, recorded, named4) {
1729
+ function spanOf(line, recorded) {
1726
1730
  const width = recorded === void 0 ? 1 : Math.max(1, recorded.end - recorded.start + 1);
1727
- const end = line + width - 1;
1731
+ return { start: line, end: line + width - 1 };
1732
+ }
1733
+ function rowsAt(line, lines, recorded, named4) {
1734
+ const end = spanOf(line, recorded).end;
1728
1735
  if (end > lines.length) return "table-short";
1729
1736
  for (let n = line; n <= end; n++) {
1730
1737
  if (!isTableRow(lines[n - 1] ?? "")) return "table-short";
@@ -1743,7 +1750,11 @@ function unitOrWhy(page, line, lines, recorded, named4 = false) {
1743
1750
  if (block !== void 0) {
1744
1751
  return { lines: block, kind: "block", text: lines.slice(block.start - 1, block.end) };
1745
1752
  }
1746
- if (insideFence(page.content, page.bodyOffset, line, page.format)) return "fenced";
1753
+ const around = fenceAround(page.content, page.bodyOffset, line, page.format);
1754
+ if (around !== void 0) {
1755
+ const span2 = spanOf(line, recorded);
1756
+ return span2.end < around.end ? { lines: span2, kind: "fenced-lines", text: lines.slice(span2.start - 1, span2.end) } : "fence-crossed";
1757
+ }
1747
1758
  if (isTableRow(own)) return rowsAt(line, lines, recorded, named4);
1748
1759
  const paragraph = paragraphAfter(
1749
1760
  page.content,
@@ -4213,8 +4224,8 @@ function sayNoUnit(reason) {
4213
4224
  return "the line is outside the page body";
4214
4225
  case "blank":
4215
4226
  return "the line is blank";
4216
- case "fenced":
4217
- return "the line sits inside a fenced block";
4227
+ case "fence-crossed":
4228
+ return "the claim's lines are not all inside one fenced block";
4218
4229
  case "marker":
4219
4230
  return "that line now holds a cite marker, not claim text";
4220
4231
  case "not-a-paragraph":
@@ -4225,6 +4236,9 @@ function sayNoUnit(reason) {
4225
4236
  return "that line is a table rule, not claim text";
4226
4237
  }
4227
4238
  }
4239
+ function unitNoun(kind) {
4240
+ return kind === "fenced-lines" ? "fenced text" : kind;
4241
+ }
4228
4242
  function settles(plan) {
4229
4243
  switch (plan.kind) {
4230
4244
  case "claim-moved":
@@ -4700,7 +4714,7 @@ async function runUpdate(opts) {
4700
4714
  if (unit !== void 0 && wide !== void 0) {
4701
4715
  declined.set(result.origin.index, {
4702
4716
  rule: "claim-changed",
4703
- why: `Not re-pinned: the ${unit.kind} ${wide}.`
4717
+ why: `Not re-pinned: the ${unitNoun(unit.kind)} ${wide}.`
4704
4718
  });
4705
4719
  } else if (unit === void 0) {
4706
4720
  const why = at2 === void 0 ? void 0 : noUnitAt(page, at2, lines, held, named4);
@@ -4710,7 +4724,12 @@ async function runUpdate(opts) {
4710
4724
  why: `Not re-pinned: ${sayNoUnit(why)}.`
4711
4725
  });
4712
4726
  }
4713
- } else if (pin !== void 0 && (!wantsBlock || unit.kind === "block")) {
4727
+ } else if (wantsBlock && unit.kind !== "block") {
4728
+ declined.set(result.origin.index, {
4729
+ rule: "claim-changed",
4730
+ why: "Not re-pinned: quote: true, and the line no longer opens a fenced block."
4731
+ });
4732
+ } else if (pin !== void 0) {
4714
4733
  const elsewhere = named4 ? [] : otherClaimSpans(lines, unit.lines, pin, page.bodyLine);
4715
4734
  const replaced = replacementAt(claim, unit.text, page.format);
4716
4735
  if (replaced !== void 0 && only === void 0) {
@@ -5356,10 +5375,10 @@ function renderCheckPretty(run3, opts) {
5356
5375
  return lines.join("\n");
5357
5376
  }
5358
5377
  function spellAtSpec(spec) {
5359
- const span = spanOf(spec);
5378
+ const span = spanOf2(spec);
5360
5379
  return span === void 0 ? `lines ${spec}` : spellAt(span);
5361
5380
  }
5362
- function spanOf(spec) {
5381
+ function spanOf2(spec) {
5363
5382
  const [first, second] = spec.split("-");
5364
5383
  const start = Number(first);
5365
5384
  const end = second === void 0 ? start : Number(second);
@@ -5367,8 +5386,8 @@ function spanOf(spec) {
5367
5386
  return { start, end };
5368
5387
  }
5369
5388
  function widening(held, now) {
5370
- const was = spanOf(held);
5371
- const is = spanOf(now);
5389
+ const was = spanOf2(held);
5390
+ const is = spanOf2(now);
5372
5391
  if (was === void 0 || is === void 0) return "";
5373
5392
  const parts = [];
5374
5393
  if (is.start < was.start) {
@@ -6057,4 +6076,4 @@ export {
6057
6076
  runKeyRotate,
6058
6077
  runKeySet
6059
6078
  };
6060
- //# sourceMappingURL=chunk-DGC4CCK3.js.map
6079
+ //# sourceMappingURL=chunk-HZ2KWOOO.js.map