polytypo 1.17.4 → 1.18.0
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/{chunk-HOVHQ7FV.js → chunk-4PNVRVFN.js} +3 -3
- package/dist/{chunk-MTB7GEW4.cjs → chunk-5BMZQ3LM.cjs} +3 -3
- package/dist/{chunk-MTB7GEW4.cjs.map → chunk-5BMZQ3LM.cjs.map} +1 -1
- package/dist/{chunk-4C6Q4VWE.js → chunk-6OAQCO3S.js} +2 -2
- package/dist/chunk-AQEQJFY7.cjs +34 -0
- package/dist/{chunk-3LFCYGJ2.cjs.map → chunk-AQEQJFY7.cjs.map} +1 -1
- package/dist/{chunk-PJMNCAM6.js → chunk-ATPMHQ6B.js} +3 -3
- package/dist/chunk-C6AMXPGN.cjs +36 -0
- package/dist/{chunk-SUDJFZXB.cjs.map → chunk-C6AMXPGN.cjs.map} +1 -1
- package/dist/{chunk-KFRNMKKO.cjs → chunk-D4KBXHBS.cjs} +4 -4
- package/dist/{chunk-KFRNMKKO.cjs.map → chunk-D4KBXHBS.cjs.map} +1 -1
- package/dist/{chunk-GQKLJ73E.cjs → chunk-DHBLFEQ4.cjs} +6 -6
- package/dist/{chunk-GQKLJ73E.cjs.map → chunk-DHBLFEQ4.cjs.map} +1 -1
- package/dist/{chunk-ZTHGDNKA.cjs → chunk-HQI62OQ3.cjs} +159 -10
- package/dist/chunk-HQI62OQ3.cjs.map +1 -0
- package/dist/{chunk-7ZKTX4XN.js → chunk-IVMLFKWH.js} +2 -2
- package/dist/chunk-JBLZF6GT.cjs +38 -0
- package/dist/{chunk-DKIKUSWJ.cjs.map → chunk-JBLZF6GT.cjs.map} +1 -1
- package/dist/{chunk-SFAHXSBP.cjs → chunk-KD55CPW7.cjs} +23 -23
- package/dist/{chunk-SFAHXSBP.cjs.map → chunk-KD55CPW7.cjs.map} +1 -1
- package/dist/{chunk-67JPAOD6.js → chunk-MKX74SBT.js} +2 -2
- package/dist/{chunk-CBZVCWYE.js → chunk-P2EMJLVF.js} +159 -10
- package/dist/chunk-P2EMJLVF.js.map +1 -0
- package/dist/{chunk-3B7OFB3Z.js → chunk-Q3W7ZJXS.js} +2 -2
- package/dist/{chunk-3YFHGJLX.js → chunk-VIOCUESF.js} +4 -4
- package/dist/{errors-DrNAlWLt.d.cts → errors-CQz5lyjD.d.cts} +1 -1
- package/dist/{errors-DrNAlWLt.d.ts → errors-CQz5lyjD.d.ts} +1 -1
- package/dist/html.cjs +9 -9
- package/dist/html.d.cts +2 -2
- package/dist/html.d.ts +2 -2
- package/dist/html.js +4 -4
- package/dist/index.cjs +17 -17
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/markdown.cjs +10 -10
- package/dist/markdown.d.cts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +5 -5
- package/dist/text.cjs +8 -8
- package/dist/text.d.cts +2 -2
- package/dist/text.d.ts +2 -2
- package/dist/text.js +3 -3
- package/dist/yaml.cjs +9 -9
- package/dist/yaml.d.cts +2 -2
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-3LFCYGJ2.cjs +0 -34
- package/dist/chunk-CBZVCWYE.js.map +0 -1
- package/dist/chunk-DKIKUSWJ.cjs +0 -38
- package/dist/chunk-SUDJFZXB.cjs +0 -36
- package/dist/chunk-ZTHGDNKA.cjs.map +0 -1
- /package/dist/{chunk-HOVHQ7FV.js.map → chunk-4PNVRVFN.js.map} +0 -0
- /package/dist/{chunk-4C6Q4VWE.js.map → chunk-6OAQCO3S.js.map} +0 -0
- /package/dist/{chunk-PJMNCAM6.js.map → chunk-ATPMHQ6B.js.map} +0 -0
- /package/dist/{chunk-7ZKTX4XN.js.map → chunk-IVMLFKWH.js.map} +0 -0
- /package/dist/{chunk-67JPAOD6.js.map → chunk-MKX74SBT.js.map} +0 -0
- /package/dist/{chunk-3B7OFB3Z.js.map → chunk-Q3W7ZJXS.js.map} +0 -0
- /package/dist/{chunk-3YFHGJLX.js.map → chunk-VIOCUESF.js.map} +0 -0
|
@@ -85,7 +85,7 @@ var LOCALES = {
|
|
|
85
85
|
el: { locale: "el", name: "Greek", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "none", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: [], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
86
86
|
"en-GB": { locale: "en-GB", name: "English (United Kingdom)", quotes: { primary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["s"] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "kg", "g", "mg", "km", "m", "cm", "mm", "mi", "ft", "lb", "oz", "L", "mL", "h", "min", "s", "ms", "\xB0C", "\xB0F", "kB", "MB", "GB", "TB", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
87
87
|
"en-US": { locale: "en-US", name: "English (United States)", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [{ left: "rock", elided: "n", right: "roll" }], elisionClitics: { before: [], after: ["s"] } }, dash: { parenthetical: "em-tight", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "kg", "g", "mg", "km", "m", "cm", "mm", "mi", "ft", "lb", "oz", "L", "mL", "h", "min", "s", "ms", "\xB0C", "\xB0F", "kB", "MB", "GB", "TB", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "chain" } },
|
|
88
|
-
es: { locale: "es", name: "Spanish", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "em-
|
|
88
|
+
es: { locale: "es", name: "Spanish", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "em-paired", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ej.", "a. C.", "d. C.", "EE. UU.", "FF. AA.", "N. del T.", "q. e. p. d.", "et al."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "mg", "mL", "min", "dB", "kW", "kWh"], beforeNumber: ["art.", "cap.", "n\xFAm.", "nro.", "p\xE1g.", "p\xE1gs."], beforeWord: ["Sr.", "Sra.", "Srta."], afterSymbols: [], initialBinding: "chain" } },
|
|
89
89
|
fi: { locale: "fi", name: "Finnish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["fil. maist."], beforeUnits: ["%", "\u2030", "\xA7", "kg", "g", "mg", "km", "m", "cm", "mm", "l", "dl", "cl", "ml", "h", "min", "s", "ms", "\xB0C", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
|
|
90
90
|
fr: { locale: "fr", name: "French (France)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] } }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [";", "!", "?"], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
|
|
91
91
|
"fr-CA": { locale: "fr-CA", name: "French (Canada)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] } }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
|
|
@@ -4034,7 +4034,7 @@ function isNoBreakSpace(cp) {
|
|
|
4034
4034
|
return cp === 160 || cp === 8239;
|
|
4035
4035
|
}
|
|
4036
4036
|
function dashCodePoint(style) {
|
|
4037
|
-
return style === "em-tight" || style === "em-spaced" ? EM_DASH : EN_DASH;
|
|
4037
|
+
return style === "em-tight" || style === "em-spaced" || style === "em-paired" ? EM_DASH : EN_DASH;
|
|
4038
4038
|
}
|
|
4039
4039
|
function isSpaced(style) {
|
|
4040
4040
|
return style === "em-spaced" || style === "en-spaced";
|
|
@@ -4130,9 +4130,10 @@ function skipClosedUpSymbol(cp, from, step) {
|
|
|
4130
4130
|
return i + step;
|
|
4131
4131
|
}
|
|
4132
4132
|
function isSpacingTransitionBlocked(cp, left, right) {
|
|
4133
|
-
|
|
4133
|
+
return isSpacingTransitionBlockedLeft(cp, left) || isSpacingTransitionBlockedRight(cp, right);
|
|
4134
|
+
}
|
|
4135
|
+
function isSpacingTransitionBlockedLeft(cp, left) {
|
|
4134
4136
|
const l = isClosedUpSymbol(cp[left]) && left > 0 && isDigit2(cp[left - 1]) ? left - 1 : left;
|
|
4135
|
-
const r = isClosedUpSymbol(cp[right]) && right + 1 < n && isDigit2(cp[right + 1]) ? right + 1 : right;
|
|
4136
4137
|
if (isDigit2(cp[l])) {
|
|
4137
4138
|
let d = l;
|
|
4138
4139
|
while (d > 0 && isDigit2(cp[d - 1])) d -= 1;
|
|
@@ -4142,6 +4143,11 @@ function isSpacingTransitionBlocked(cp, left, right) {
|
|
|
4142
4143
|
if (isDashUnion(one)) return true;
|
|
4143
4144
|
if ((one === SPACE || isNoBreakSpace(one)) && isDashUnion(two)) return true;
|
|
4144
4145
|
}
|
|
4146
|
+
return false;
|
|
4147
|
+
}
|
|
4148
|
+
function isSpacingTransitionBlockedRight(cp, right) {
|
|
4149
|
+
const n = cp.length;
|
|
4150
|
+
const r = isClosedUpSymbol(cp[right]) && right + 1 < n && isDigit2(cp[right + 1]) ? right + 1 : right;
|
|
4145
4151
|
if (isDigit2(cp[r])) {
|
|
4146
4152
|
let d = r;
|
|
4147
4153
|
while (d + 1 < n && isDigit2(cp[d + 1])) d += 1;
|
|
@@ -4208,8 +4214,6 @@ function findDashTokens(cp) {
|
|
|
4208
4214
|
}
|
|
4209
4215
|
return tokens;
|
|
4210
4216
|
}
|
|
4211
|
-
|
|
4212
|
-
// src/rules/dashes.ts
|
|
4213
4217
|
function isRoman(cp) {
|
|
4214
4218
|
return cp === 73 || // I
|
|
4215
4219
|
cp === 86 || // V
|
|
@@ -4230,10 +4234,121 @@ function isRomanFlanked(cp, left, right) {
|
|
|
4230
4234
|
if (b + 1 < n && isLetter(cp[b + 1])) return false;
|
|
4231
4235
|
return true;
|
|
4232
4236
|
}
|
|
4237
|
+
|
|
4238
|
+
// src/rules/dashes-paired.ts
|
|
4239
|
+
function isTerminal(cp) {
|
|
4240
|
+
return cp === 46 || cp === 63 || cp === 33 || cp === 8230;
|
|
4241
|
+
}
|
|
4242
|
+
function endsSegment(cp, i) {
|
|
4243
|
+
if (!isTerminal(cp[i])) return false;
|
|
4244
|
+
if (i + 1 >= cp.length) return true;
|
|
4245
|
+
const next = cp[i + 1];
|
|
4246
|
+
return next === SPACE || isNoBreakSpace(next) || isBreak(next) || isMarker(next);
|
|
4247
|
+
}
|
|
4248
|
+
function classify(cp, s, e) {
|
|
4249
|
+
const n = cp.length;
|
|
4250
|
+
const k = e - s;
|
|
4251
|
+
if (k > 3) return void 0;
|
|
4252
|
+
const lsp = s > 0 && cp[s - 1] === SPACE ? 1 : 0;
|
|
4253
|
+
const rsp = e < n && cp[e] === SPACE ? 1 : 0;
|
|
4254
|
+
const first = cp[s];
|
|
4255
|
+
const isHyphenShaped = first === HYPHEN_MINUS || first === HYPHEN2 || first === MINUS_SIGN;
|
|
4256
|
+
if (k === 1 && isHyphenShaped && lsp === 0 && rsp === 0) return void 0;
|
|
4257
|
+
if (k === 1 && first === HYPHEN_MINUS && s >= 2 && cp[s - 1] === 47 && cp[s - 2] === 43) {
|
|
4258
|
+
return void 0;
|
|
4259
|
+
}
|
|
4260
|
+
const counted = (eligible, left2, right2) => ({
|
|
4261
|
+
s,
|
|
4262
|
+
e,
|
|
4263
|
+
lsp,
|
|
4264
|
+
rsp,
|
|
4265
|
+
left: left2,
|
|
4266
|
+
right: right2,
|
|
4267
|
+
eligible
|
|
4268
|
+
});
|
|
4269
|
+
let left = s - 1 - lsp;
|
|
4270
|
+
let right = e + rsp;
|
|
4271
|
+
if (left < 0 || right >= n) return counted(false, left, right);
|
|
4272
|
+
const joinStart = left + 1;
|
|
4273
|
+
const joinEnd = right;
|
|
4274
|
+
while (left >= 0 && cp[left] === WORD_JOINER) left -= 1;
|
|
4275
|
+
while (right < n && cp[right] === WORD_JOINER) right += 1;
|
|
4276
|
+
if (left < 0 || right >= n) return counted(false, left, right);
|
|
4277
|
+
const crossedJoiner = left + 1 !== joinStart || right !== joinEnd;
|
|
4278
|
+
if (rangeFlanks(cp, left, right) !== void 0) return void 0;
|
|
4279
|
+
if (crossedJoiner) return counted(false, left, right);
|
|
4280
|
+
const leftCp = cp[left];
|
|
4281
|
+
const rightCp = cp[right];
|
|
4282
|
+
if (isBreak(leftCp) || isBreak(rightCp)) return counted(false, left, right);
|
|
4283
|
+
if (isInertDash(leftCp) || isInertDash(rightCp)) return counted(false, left, right);
|
|
4284
|
+
if (isDash(leftCp) || isDash(rightCp)) return counted(false, left, right);
|
|
4285
|
+
if (leftCp === SPACE || isNoBreakSpace(leftCp)) return counted(false, left, right);
|
|
4286
|
+
if (rightCp === SPACE || isNoBreakSpace(rightCp)) return counted(false, left, right);
|
|
4287
|
+
if (isClusterInert(cp, s, e)) return counted(false, left, right);
|
|
4288
|
+
if (lsp !== rsp && !(k === 1 && first === EM_DASH)) return counted(false, left, right);
|
|
4289
|
+
if (lsp === 0 && rsp === 0 && isRomanFlanked(cp, left, right)) return counted(false, left, right);
|
|
4290
|
+
if (k === 1 && first === EN_DASH) return counted(false, left, right);
|
|
4291
|
+
return counted(true, left, right);
|
|
4292
|
+
}
|
|
4293
|
+
function wantsSpace(cp) {
|
|
4294
|
+
return isLetter(cp) || isDigit2(cp);
|
|
4295
|
+
}
|
|
4296
|
+
function scanPaired(cp) {
|
|
4297
|
+
const n = cp.length;
|
|
4298
|
+
const edits = [];
|
|
4299
|
+
let segment = [];
|
|
4300
|
+
let i = 0;
|
|
4301
|
+
const flush = () => {
|
|
4302
|
+
if (segment.length === 2) emitPair(cp, segment[0], segment[1], edits);
|
|
4303
|
+
segment = [];
|
|
4304
|
+
};
|
|
4305
|
+
while (i < n) {
|
|
4306
|
+
if (isDash(cp[i])) {
|
|
4307
|
+
const s = i;
|
|
4308
|
+
let e = s;
|
|
4309
|
+
while (e < n && isDash(cp[e])) e += 1;
|
|
4310
|
+
i = e;
|
|
4311
|
+
const run = classify(cp, s, e);
|
|
4312
|
+
if (run !== void 0) segment.push(run);
|
|
4313
|
+
continue;
|
|
4314
|
+
}
|
|
4315
|
+
if (endsSegment(cp, i)) flush();
|
|
4316
|
+
i += 1;
|
|
4317
|
+
}
|
|
4318
|
+
flush();
|
|
4319
|
+
return edits;
|
|
4320
|
+
}
|
|
4321
|
+
function emitPair(cp, a, b, edits) {
|
|
4322
|
+
if (!a.eligible || !b.eligible) return;
|
|
4323
|
+
if (a.lsp === 0 && a.rsp === 1) return;
|
|
4324
|
+
if (b.lsp === 1 && b.rsp === 0) return;
|
|
4325
|
+
for (let j = a.e; j < b.s; j += 1) {
|
|
4326
|
+
if (isBreak(cp[j])) return;
|
|
4327
|
+
}
|
|
4328
|
+
const insertBefore = a.lsp === 0 && wantsSpace(cp[a.left]);
|
|
4329
|
+
const insertAfter = b.rsp === 0 && wantsSpace(cp[b.right]);
|
|
4330
|
+
if (insertBefore && isSpacingTransitionBlockedLeft(cp, a.left)) return;
|
|
4331
|
+
if (insertAfter && isSpacingTransitionBlockedRight(cp, b.right)) return;
|
|
4332
|
+
const opener = a.lsp === 1 || insertBefore ? [SPACE, EM_DASH] : [EM_DASH];
|
|
4333
|
+
const closer = b.rsp === 1 || insertAfter ? [EM_DASH, SPACE] : [EM_DASH];
|
|
4334
|
+
const pairs = [
|
|
4335
|
+
[a, opener],
|
|
4336
|
+
[b, closer]
|
|
4337
|
+
];
|
|
4338
|
+
for (const [run, replacement] of pairs) {
|
|
4339
|
+
const start = run.s - run.lsp;
|
|
4340
|
+
const end = run.e + run.rsp;
|
|
4341
|
+
if (sameContent(cp, start, end, replacement)) continue;
|
|
4342
|
+
edits.push({ start, end, replacement, ruleId: "dashes" });
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
|
|
4346
|
+
// src/rules/dashes.ts
|
|
4233
4347
|
function scan(ctx) {
|
|
4234
4348
|
const cp = ctx.cp;
|
|
4235
4349
|
const edits = [];
|
|
4236
4350
|
const style = ctx.locale.dash.parenthetical;
|
|
4351
|
+
if (style === "em-paired") return scanPaired(cp);
|
|
4237
4352
|
for (const token of findDashTokens(cp)) {
|
|
4238
4353
|
const { s, e, leftCp, rightCp, left, right, lsp, rsp } = token;
|
|
4239
4354
|
if (rangeFlanks(cp, left, right) !== void 0) continue;
|
|
@@ -4273,7 +4388,7 @@ function at2(cp, i) {
|
|
|
4273
4388
|
function isDotlike(cp) {
|
|
4274
4389
|
return cp === DOT || cp === ELL;
|
|
4275
4390
|
}
|
|
4276
|
-
function
|
|
4391
|
+
function isTerminal2(cp) {
|
|
4277
4392
|
return cp === EXCLAMATION || cp === QUESTION;
|
|
4278
4393
|
}
|
|
4279
4394
|
function isSameRun(cp, s, e, target) {
|
|
@@ -4317,11 +4432,11 @@ var ellipsisRule = {
|
|
|
4317
4432
|
function runTarget(k, q, left, abbreviated) {
|
|
4318
4433
|
if (k === 2 && q === 0) {
|
|
4319
4434
|
if (abbreviated) return null;
|
|
4320
|
-
if (
|
|
4435
|
+
if (isTerminal2(left)) return [ELL];
|
|
4321
4436
|
return null;
|
|
4322
4437
|
}
|
|
4323
4438
|
if (k === 1 && q === 0) return null;
|
|
4324
|
-
if (abbreviated &&
|
|
4439
|
+
if (abbreviated && isTerminal2(left)) return [DOT, DOT];
|
|
4325
4440
|
return [ELL];
|
|
4326
4441
|
}
|
|
4327
4442
|
|
|
@@ -5965,6 +6080,39 @@ function createsReference(cp, p, q, w) {
|
|
|
5965
6080
|
if (left >= 0 && cp[left] === 35) left -= 1;
|
|
5966
6081
|
return left >= 0 && cp[left] === 38;
|
|
5967
6082
|
}
|
|
6083
|
+
var SPACE_CP = 32;
|
|
6084
|
+
var BRACKET_OPEN = 91;
|
|
6085
|
+
var BRACKET_CLOSE = 93;
|
|
6086
|
+
var CARET2 = 94;
|
|
6087
|
+
function isX(c) {
|
|
6088
|
+
return c === 120 || c === 88;
|
|
6089
|
+
}
|
|
6090
|
+
function isLabelCharacter(c) {
|
|
6091
|
+
return c !== void 0 && c >= 0 && c !== SPACE_CP && c !== BRACKET_OPEN && c !== BRACKET_CLOSE;
|
|
6092
|
+
}
|
|
6093
|
+
function skipSpaces(cp, i, step) {
|
|
6094
|
+
let k = i;
|
|
6095
|
+
while (k >= 0 && k < cp.length && cp[k] === SPACE_CP) k += step;
|
|
6096
|
+
return k;
|
|
6097
|
+
}
|
|
6098
|
+
function createsBracketShape(cp, p, q, w) {
|
|
6099
|
+
const isCollapse = w.length === 1 && w[0] === SPACE_CP;
|
|
6100
|
+
if (w.length !== 0 && !isCollapse) return false;
|
|
6101
|
+
const a = skipSpaces(cp, p - 1, -1);
|
|
6102
|
+
const b = skipSpaces(cp, q + 1, 1);
|
|
6103
|
+
if (isCollapse) return cp[a] === BRACKET_OPEN && cp[b] === BRACKET_CLOSE;
|
|
6104
|
+
if (cp[a] === BRACKET_OPEN && cp[b] === BRACKET_CLOSE) return true;
|
|
6105
|
+
if (cp[a] === BRACKET_OPEN) {
|
|
6106
|
+
if (cp[b] === CARET2) return true;
|
|
6107
|
+
return isX(cp[b]) && cp[skipSpaces(cp, b + 1, 1)] === BRACKET_CLOSE;
|
|
6108
|
+
}
|
|
6109
|
+
if (cp[b] !== BRACKET_CLOSE) return false;
|
|
6110
|
+
if (isX(cp[a]) && cp[skipSpaces(cp, a - 1, -1)] === BRACKET_OPEN) return true;
|
|
6111
|
+
let run = a;
|
|
6112
|
+
while (run >= 0 && isLabelCharacter(cp[run])) run -= 1;
|
|
6113
|
+
const first = run + 1;
|
|
6114
|
+
return a - first >= 1 && cp[first] === CARET2 && cp[skipSpaces(cp, run, -1)] === BRACKET_OPEN;
|
|
6115
|
+
}
|
|
5968
6116
|
function filterBoundaryEdits(cp, edits, ranges, mode = void 0, guarded = []) {
|
|
5969
6117
|
const out = [];
|
|
5970
6118
|
for (const edit of edits) {
|
|
@@ -5982,6 +6130,7 @@ function filterBoundaryEdits(cp, edits, ranges, mode = void 0, guarded = []) {
|
|
|
5982
6130
|
const r = edit.replacement.length;
|
|
5983
6131
|
if (mode === "markdown" && changesDelimiterFlank(cp, p, q, edit.replacement)) continue;
|
|
5984
6132
|
if (mode === "markdown" && createsEscape(cp, p, q, edit.replacement)) continue;
|
|
6133
|
+
if (mode === "markdown" && createsBracketShape(cp, p, q, edit.replacement)) continue;
|
|
5985
6134
|
if ((mode === "markdown" || mode === "html") && createsReference(cp, p, q, edit.replacement)) {
|
|
5986
6135
|
continue;
|
|
5987
6136
|
}
|
|
@@ -6245,4 +6394,4 @@ function analyzeProtected(input, holes, planned, locale, narrowTarget) {
|
|
|
6245
6394
|
|
|
6246
6395
|
|
|
6247
6396
|
exports.PolytypoError = PolytypoError; exports.toCodePoints = toCodePoints; exports.fromCodePoints = fromCodePoints; exports.getLocaleData = getLocaleData; exports.resolveNarrowTarget = resolveNarrowTarget; exports.normalizeSpans = normalizeSpans; exports.planRules = planRules; exports.runRules = runRules; exports.runRulesRecording = runRulesRecording; exports.runOverSpans = runOverSpans; exports.runOverUnits = runOverUnits; exports.analyzeOverUnits = analyzeOverUnits; exports.analyzeOverSpans = analyzeOverSpans; exports.resolveProtect = resolveProtect; exports.assertNoProtect = assertNoProtect; exports.runProtected = runProtected; exports.analyzeProtected = analyzeProtected;
|
|
6248
|
-
//# sourceMappingURL=chunk-
|
|
6397
|
+
//# sourceMappingURL=chunk-HQI62OQ3.cjs.map
|