punctilio 5.5.2 → 5.5.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 +1 -1
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -0
- package/dist/constants.js.map +1 -1
- package/dist/dashes.d.ts +1 -0
- package/dist/dashes.d.ts.map +1 -1
- package/dist/dashes.js +38 -24
- package/dist/dashes.js.map +1 -1
- package/dist/markdown.d.ts +6 -0
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +25 -12
- package/dist/markdown.js.map +1 -1
- package/dist/nbsp.d.ts.map +1 -1
- package/dist/nbsp.js +14 -4
- package/dist/nbsp.js.map +1 -1
- package/dist/quote-classifier.d.ts.map +1 -1
- package/dist/quote-classifier.js +203 -114
- package/dist/quote-classifier.js.map +1 -1
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +14 -11
- package/dist/symbols.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +22 -0
- package/src/dashes.ts +37 -26
- package/src/markdown.ts +36 -18
- package/src/nbsp.ts +14 -4
- package/src/quote-classifier.ts +210 -107
- package/src/symbols.ts +15 -13
package/dist/nbsp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nbsp.js","sourceRoot":"","sources":["../src/nbsp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAClN,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,aAAa,EAAE,SAAS,EAAkB,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEhL,MAAM,EACJ,IAAI,EACJ,iBAAi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C,iCAAiC,CAAC,CAAA;AAEzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,2BAA2B,CAAC,CAAA;AAE7E,8EAA8E;AAC9E,6CAA6C;AAC7C,MAAM,eAAe,GAAkC;IACrD,2BAA2B;IAC3B,uCAAuC;IACvC,+BAA+B;IAC/B,iCAAiC;IACjC,2BAA2B;IAC3B,gCAAgC;CACjC,CAAA;AAID,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;QAC/B,qEAAqE;QACrE,oDAAoD;QACpD,IAAI,CAAC,YAAY,CAAC,IAAI,WAAW,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAM;QAEjE,KAAK,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC;YACjC,EAAE,CAAC,IAAI,CAAC,CAAA;QACV,CAAC;QACD,MAAM,qBAAqB,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAA;QAC/D,0BAA0B,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-classifier.d.ts","sourceRoot":"","sources":["../src/quote-classifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"quote-classifier.d.ts","sourceRoot":"","sources":["../src/quote-classifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAgChD,eAAO,MAAM,kBAAkB,8DAA+D,CAAA;AAC9F,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AAElE,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,cAAc,GACd,cAAc,GACd,cAAc,GACd,SAAS,GACT,aAAa,GACb,aAAa,GACb,OAAO,CAAA;AAiiDX;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,MAAM,GACjB,IAAI,CAuBN;AA6GD,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAWvD"}
|
package/dist/quote-classifier.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { CLOSING_BRACKETS, FOLDED_WORD_CHARS, LATIN_LETTER_RE, OPENING_BRACKETS, QUOTE_GLYPHS, SPACE_CHAR_RE, TERMINAL_PUNCTUATION, UNICODE_SYMBOLS, WORD_RE } from "./constants.js";
|
|
2
|
-
const { EM_DASH, EN_DASH, MINUS, LEFT_DOUBLE_QUOTE, RIGHT_DOUBLE_QUOTE, LEFT_SINGLE_QUOTE, RIGHT_SINGLE_QUOTE, MODIFIER_LETTER_APOSTROPHE, DOUBLE_LOW_9_QUOTE, SINGLE_LOW_9_QUOTE, LEFT_GUILLEMET, RIGHT_GUILLEMET, INVERTED_EXCLAMATION, INVERTED_QUESTION, NBSP, NNBSP, PRIME, DOUBLE_PRIME, ELLIPSIS, DOUBLE_QUESTION, QUESTION_EXCLAMATION, EXCLAMATION_QUESTION,
|
|
3
|
-
/**
|
|
4
|
-
* Glyphs the symbol passes fold `?`/`!` runs and `...` into. The quote rules
|
|
5
|
-
* run before those passes, so every ending-context set that contains the
|
|
6
|
-
* source punctuation must contain the folded glyph too — otherwise a decision
|
|
7
|
-
* gated on `?!` flips once a re-run sees `⁈`.
|
|
8
|
-
*/
|
|
9
|
-
const FOLDED_TERMINALS = [DOUBLE_QUESTION, QUESTION_EXCLAMATION, EXCLAMATION_QUESTION, DOUBLE_EXCLAMATION, INTERROBANG];
|
|
1
|
+
import { CLOSING_BRACKETS, FOLDED_TERMINALS, FOLDED_WORD_CHARS, FRACTION_GLYPHS, LATIN_LETTER_RE, OPENING_BRACKETS, QUOTE_GLYPHS, SPACE_CHAR_RE, TERMINAL_PUNCTUATION, UNICODE_SYMBOLS, WORD_RE } from "./constants.js";
|
|
2
|
+
const { EM_DASH, EN_DASH, MINUS, LEFT_DOUBLE_QUOTE, RIGHT_DOUBLE_QUOTE, LEFT_SINGLE_QUOTE, RIGHT_SINGLE_QUOTE, MODIFIER_LETTER_APOSTROPHE, DOUBLE_LOW_9_QUOTE, SINGLE_LOW_9_QUOTE, LEFT_GUILLEMET, RIGHT_GUILLEMET, INVERTED_EXCLAMATION, INVERTED_QUESTION, NBSP, NNBSP, PRIME, DOUBLE_PRIME, ELLIPSIS, DOUBLE_QUESTION, QUESTION_EXCLAMATION, EXCLAMATION_QUESTION, APPROXIMATE, GREATER_EQUAL, LESS_EQUAL, NOT_EQUAL, PLUS_MINUS, } = UNICODE_SYMBOLS;
|
|
10
3
|
export const PUNCTUATION_STYLES = ["american", "british", "german", "french", "none"];
|
|
11
4
|
/** Internal-alphabet character for each non-LITERAL role. */
|
|
12
5
|
const ROLE_BY_CHAR = new Map([
|
|
@@ -19,6 +12,7 @@ const ROLE_BY_CHAR = new Map([
|
|
|
19
12
|
[DOUBLE_PRIME, "DOUBLE_PRIME"],
|
|
20
13
|
]);
|
|
21
14
|
const SPACE_RE = /\s/;
|
|
15
|
+
const FRACTION_GLYPH_SET = new Set(FRACTION_GLYPHS);
|
|
22
16
|
const DIGIT_RE = /\d/;
|
|
23
17
|
/** Fast path: text without any quote-like character is returned untouched. */
|
|
24
18
|
const QUOTE_CANDIDATE_RE = new RegExp(`[${QUOTE_GLYPHS}]`);
|
|
@@ -73,7 +67,9 @@ function makeItemTester(test) {
|
|
|
73
67
|
}
|
|
74
68
|
const isLetterItem = makeItemTester((ch) => LATIN_LETTER_RE.test(ch));
|
|
75
69
|
const isDigitItem = makeItemTester((ch) => DIGIT_RE.test(ch));
|
|
76
|
-
|
|
70
|
+
/** Word test that reads a vulgar fraction glyph as the digit it folds from
|
|
71
|
+
* (`7/8'B` and `⅞'B` must agree on the leading-apostrophe gate). */
|
|
72
|
+
const isWordItem = makeItemTester((ch) => WORD_RE.test(ch) || FRACTION_GLYPH_SET.has(ch) || FOLDED_WORD_CHARS.has(ch));
|
|
77
73
|
const isLetterOrDigitItem = makeItemTester((ch) => LATIN_LETTER_RE.test(ch) || DIGIT_RE.test(ch) || FOLDED_WORD_CHARS.has(ch));
|
|
78
74
|
/** Letter test that treats folded word glyphs as the letters they fold from
|
|
79
75
|
* (`X` → `×`, `st` → `ˢᵗ`); see {@link FOLDED_WORD_CHARS}. */
|
|
@@ -84,6 +80,24 @@ function isCharItem(items, index, ch) {
|
|
|
84
80
|
const item = items[index];
|
|
85
81
|
return !item.boundary && item.ch === ch;
|
|
86
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* French only: whether the run of space items from `start` (walking by `step`)
|
|
85
|
+
* ends at a `glyph` item and collapses to one space once an unpadded glyph's
|
|
86
|
+
* padding absorbs the NBSP/NNBSP beside it. A re-run reads that space between
|
|
87
|
+
* the straight quote and the padded glyph, so the first run must too.
|
|
88
|
+
*/
|
|
89
|
+
function spaceRunReadsAsSingle(items, start, step, glyph) {
|
|
90
|
+
let index = start;
|
|
91
|
+
while (index >= 0 && index < items.length && !items[index].boundary && SPACE_CHAR_RE.test(items[index].ch))
|
|
92
|
+
index += step;
|
|
93
|
+
const runLength = (index - start) * step;
|
|
94
|
+
if (!isCharItem(items, index, glyph))
|
|
95
|
+
return false;
|
|
96
|
+
// A glyph the source already pads absorbs nothing further.
|
|
97
|
+
const glyphSide = items[index - step].ch;
|
|
98
|
+
const absorbs = items[index].end - items[index].start === 1 && (glyphSide === NBSP || glyphSide === NNBSP);
|
|
99
|
+
return runLength === 1 || (runLength === 2 && absorbs);
|
|
100
|
+
}
|
|
87
101
|
/**
|
|
88
102
|
* Index of the previous item, treating up to `maxBoundaries` boundary items as
|
|
89
103
|
* transparent. Returns -1 at start of text; returns the blocking boundary's
|
|
@@ -119,6 +133,46 @@ function nextIndex(items, index, maxBoundaries) {
|
|
|
119
133
|
function makeItem(boundary, ch, start, end) {
|
|
120
134
|
return { boundary, ch, start, end, moved: false, anchorOffset: 0, anchorBind: "left" };
|
|
121
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* The internal-alphabet reading of a glyph in German text, or null when German
|
|
138
|
+
* leaves the glyph alone. Closers are depth-gated: U+201C/U+2018 close only
|
|
139
|
+
* below an open low-9 quote; orphans and the glyphs German does not use fall
|
|
140
|
+
* back to straight-quote candidates re-derived by position.
|
|
141
|
+
*/
|
|
142
|
+
function readGermanGlyph(glyph, afterDigit, depth) {
|
|
143
|
+
if (glyph === DOUBLE_LOW_9_QUOTE) {
|
|
144
|
+
depth.double++;
|
|
145
|
+
return LEFT_DOUBLE_QUOTE;
|
|
146
|
+
}
|
|
147
|
+
if (glyph === LEFT_DOUBLE_QUOTE) {
|
|
148
|
+
if (depth.double === 0)
|
|
149
|
+
return '"';
|
|
150
|
+
depth.double--;
|
|
151
|
+
return RIGHT_DOUBLE_QUOTE;
|
|
152
|
+
}
|
|
153
|
+
if (glyph === SINGLE_LOW_9_QUOTE) {
|
|
154
|
+
depth.single++;
|
|
155
|
+
return LEFT_SINGLE_QUOTE;
|
|
156
|
+
}
|
|
157
|
+
if (glyph === LEFT_SINGLE_QUOTE) {
|
|
158
|
+
if (depth.single === 0)
|
|
159
|
+
return "'";
|
|
160
|
+
depth.single--;
|
|
161
|
+
return RIGHT_SINGLE_QUOTE;
|
|
162
|
+
}
|
|
163
|
+
// Not used in German typography; re-derive by position.
|
|
164
|
+
if (glyph === RIGHT_DOUBLE_QUOTE)
|
|
165
|
+
return '"';
|
|
166
|
+
if (glyph === RIGHT_SINGLE_QUOTE || glyph === MODIFIER_LETTER_APOSTROPHE) {
|
|
167
|
+
// U+02BC and U+2019 read alike: the next run re-derives the rendered U+2019
|
|
168
|
+
// by position, so re-derive here too. Directly after a digit the mark is a
|
|
169
|
+
// separator (Swiss "5’000"), so keep the apostrophe role: a straight quote
|
|
170
|
+
// there would reach the next run's prime pass ("5′000"), destroying the
|
|
171
|
+
// separator and the fixed point.
|
|
172
|
+
return afterDigit ? MODIFIER_LETTER_APOSTROPHE : "'";
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
122
176
|
/**
|
|
123
177
|
* Builds the working item sequence over the view's clean text, applying the
|
|
124
178
|
* locale's pre-label rows: German low-9/depth-gated quotes and French
|
|
@@ -130,11 +184,7 @@ function buildItems(view, style) {
|
|
|
130
184
|
const boundaries = view.boundaries;
|
|
131
185
|
const items = [];
|
|
132
186
|
let b = 0;
|
|
133
|
-
|
|
134
|
-
// low-9 quote; orphans fall back to straight-quote candidates re-derived by
|
|
135
|
-
// position (the depth-0 branch).
|
|
136
|
-
let doubleDepth = 0;
|
|
137
|
-
let singleDepth = 0;
|
|
187
|
+
const germanDepth = { double: 0, single: 0 };
|
|
138
188
|
let i = 0;
|
|
139
189
|
while (i <= text.length) {
|
|
140
190
|
while (b < boundaries.length && boundaries[b] === i) {
|
|
@@ -165,39 +215,7 @@ function buildItems(view, style) {
|
|
|
165
215
|
}
|
|
166
216
|
}
|
|
167
217
|
else if (style === "german") {
|
|
168
|
-
|
|
169
|
-
if (ch === DOUBLE_LOW_9_QUOTE) {
|
|
170
|
-
mapped = LEFT_DOUBLE_QUOTE;
|
|
171
|
-
doubleDepth++;
|
|
172
|
-
}
|
|
173
|
-
else if (ch === LEFT_DOUBLE_QUOTE) {
|
|
174
|
-
mapped = doubleDepth > 0 ? RIGHT_DOUBLE_QUOTE : '"';
|
|
175
|
-
if (doubleDepth > 0)
|
|
176
|
-
doubleDepth--;
|
|
177
|
-
}
|
|
178
|
-
else if (ch === SINGLE_LOW_9_QUOTE) {
|
|
179
|
-
mapped = LEFT_SINGLE_QUOTE;
|
|
180
|
-
singleDepth++;
|
|
181
|
-
}
|
|
182
|
-
else if (ch === LEFT_SINGLE_QUOTE) {
|
|
183
|
-
mapped = singleDepth > 0 ? RIGHT_SINGLE_QUOTE : "'";
|
|
184
|
-
if (singleDepth > 0)
|
|
185
|
-
singleDepth--;
|
|
186
|
-
}
|
|
187
|
-
else if (ch === RIGHT_DOUBLE_QUOTE) {
|
|
188
|
-
// Not used in German typography — re-derive by position.
|
|
189
|
-
mapped = '"';
|
|
190
|
-
}
|
|
191
|
-
else if (ch === RIGHT_SINGLE_QUOTE || ch === MODIFIER_LETTER_APOSTROPHE) {
|
|
192
|
-
// U+02BC renders as U+2019, which the next run re-derives by position;
|
|
193
|
-
// re-derive it the same way now so both runs agree. Directly after a
|
|
194
|
-
// digit the mark is a separator (Swiss "5’000"), never a German quote
|
|
195
|
-
// glyph: keep the apostrophe role, which renders U+2019 unchanged.
|
|
196
|
-
// Re-deriving to a straight quote there hands correct typography to
|
|
197
|
-
// the next run's prime pass ("5'000" → "5′000") — a destroyed
|
|
198
|
-
// separator and a broken fixed point.
|
|
199
|
-
mapped = DIGIT_RE.test(text[i - 1] ?? "") ? MODIFIER_LETTER_APOSTROPHE : "'";
|
|
200
|
-
}
|
|
218
|
+
const mapped = readGermanGlyph(ch, DIGIT_RE.test(text[i - 1] ?? ""), germanDepth);
|
|
201
219
|
if (mapped !== null) {
|
|
202
220
|
const item = makeItem(false, mapped, i, i + 1);
|
|
203
221
|
if (mapped === '"' || mapped === "'")
|
|
@@ -431,14 +449,17 @@ function classifyLeadingApostrophes(items) {
|
|
|
431
449
|
}
|
|
432
450
|
}
|
|
433
451
|
/** Opener-position straight single quote → OPEN_SINGLE. */
|
|
434
|
-
function classifyOpeningSingles(items) {
|
|
452
|
+
function classifyOpeningSingles(items, style) {
|
|
435
453
|
for (let i = 0; i < items.length; i++) {
|
|
436
454
|
const item = items[i];
|
|
437
455
|
if (item.boundary || item.ch !== "'")
|
|
438
456
|
continue;
|
|
439
|
-
// Ahead: a boundary item satisfies \S (a boundary is non-space)
|
|
457
|
+
// Ahead: a boundary item satisfies \S (a boundary is non-space), and a
|
|
458
|
+
// French space the closer's padding absorbs reads as none on a re-run.
|
|
440
459
|
const next = items[i + 1];
|
|
441
|
-
|
|
460
|
+
const spaceAhead = next !== undefined && !next.boundary && SPACE_RE.test(next.ch);
|
|
461
|
+
const blockedBySpace = spaceAhead && !(style === "french" && spaceRunReadsAsSingle(items, i + 1, 1, RIGHT_DOUBLE_QUOTE));
|
|
462
|
+
if (next === undefined || blockedBySpace)
|
|
442
463
|
continue;
|
|
443
464
|
// Behind: up to one boundary, then line start or an opener-context char.
|
|
444
465
|
const j = prevIndex(items, i, 1);
|
|
@@ -493,7 +514,7 @@ function classifySingles(items, style) {
|
|
|
493
514
|
classifyPossessivesAndClosers(items);
|
|
494
515
|
classifyContractions(items);
|
|
495
516
|
classifyLeadingApostrophes(items);
|
|
496
|
-
classifyOpeningSingles(items);
|
|
517
|
+
classifyOpeningSingles(items, style);
|
|
497
518
|
// The rules above rewrite neighbors the closer/possessive lookbehind keyed
|
|
498
519
|
// on: in a `''` chain the left quote becomes an apostrophe, which renders
|
|
499
520
|
// as U+2019 — exactly the glyph a re-run reads in that slot, where the
|
|
@@ -689,7 +710,7 @@ function classifyOpeningDoubles(items, style) {
|
|
|
689
710
|
const j = nextIndex(items, i, 1);
|
|
690
711
|
if (j < items.length && !items[j].boundary) {
|
|
691
712
|
const ch = items[j].ch;
|
|
692
|
-
const absorbedIntoCloser = style === "french" &&
|
|
713
|
+
const absorbedIntoCloser = style === "french" && spaceRunReadsAsSingle(items, j, 1, RIGHT_DOUBLE_QUOTE);
|
|
693
714
|
opens = isEllipsisDots(items, j) || foldsToNotEqual(items, j)
|
|
694
715
|
|| (!SPACE_RE.test(ch) && !DOUBLE_OPEN_ENDING_SET.has(ch))
|
|
695
716
|
|| absorbedIntoCloser;
|
|
@@ -804,7 +825,7 @@ function classifyClosingDoubles(items, style) {
|
|
|
804
825
|
continue;
|
|
805
826
|
const before = items[i - 1];
|
|
806
827
|
if (!before.boundary && (SPACE_RE.test(before.ch) || OPEN_BRACKETS.has(before.ch))) {
|
|
807
|
-
const absorbedIntoOpener = style === "french" &&
|
|
828
|
+
const absorbedIntoOpener = style === "french" && spaceRunReadsAsSingle(items, i - 1, -1, LEFT_DOUBLE_QUOTE);
|
|
808
829
|
if (!absorbedIntoOpener)
|
|
809
830
|
continue;
|
|
810
831
|
}
|
|
@@ -838,32 +859,6 @@ function classifySinglesBeforeClosingDoubles(items) {
|
|
|
838
859
|
}
|
|
839
860
|
}
|
|
840
861
|
}
|
|
841
|
-
/**
|
|
842
|
-
* German reads its rendered glyphs by depth: a U+201C below an open „ closes
|
|
843
|
-
* it. A curly orphan that kept its source glyph (see {@link Item.curlySource})
|
|
844
|
-
* below a quote opened in this same pass is therefore that quote's closer on
|
|
845
|
-
* the next run; label it one now so both runs agree. Singles need no
|
|
846
|
-
* counterpart: a single opener is only recognized when a closer follows it
|
|
847
|
-
* with no straight single in between, and an orphan U+2018 is one.
|
|
848
|
-
*/
|
|
849
|
-
function closeCurlyOrphansBelowOpeners(items) {
|
|
850
|
-
let depth = 0;
|
|
851
|
-
for (const item of items) {
|
|
852
|
-
if (item.boundary)
|
|
853
|
-
continue;
|
|
854
|
-
if (item.ch === LEFT_DOUBLE_QUOTE) {
|
|
855
|
-
depth++;
|
|
856
|
-
}
|
|
857
|
-
else if (item.ch === RIGHT_DOUBLE_QUOTE) {
|
|
858
|
-
if (depth > 0)
|
|
859
|
-
depth--;
|
|
860
|
-
}
|
|
861
|
-
else if (item.ch === '"' && item.curlySource === LEFT_DOUBLE_QUOTE && depth > 0) {
|
|
862
|
-
item.ch = RIGHT_DOUBLE_QUOTE;
|
|
863
|
-
depth--;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
862
|
function classifyDoubles(items, style) {
|
|
868
863
|
classifyEmptyDoublePairs(items, style);
|
|
869
864
|
classifyOpeningDoubles(items, style);
|
|
@@ -1046,7 +1041,7 @@ function movePunctuationInside(order, isMovable, closingSet) {
|
|
|
1046
1041
|
// suffix would be quadratic on long closer runs. The position-dependent
|
|
1047
1042
|
// lookbehinds (terminal char, A-side wall) instead retry one level in,
|
|
1048
1043
|
// where the preceding item is a closer and can no longer block.
|
|
1049
|
-
if (punctIndex >= order.length || order[punctIndex].boundary || !isMovable(order, punctIndex)) {
|
|
1044
|
+
if (punctIndex >= order.length || order[punctIndex].boundary || isWholeNodeText(order, punctIndex) || !isMovable(order, punctIndex)) {
|
|
1050
1045
|
position = Math.max(runEnd, position + 1);
|
|
1051
1046
|
continue;
|
|
1052
1047
|
}
|
|
@@ -1123,7 +1118,10 @@ const CHAIN_PUNCT_SET = new Set([".", ",", ELLIPSIS]);
|
|
|
1123
1118
|
* dot triple, which the double-opener rule reads as `…`;
|
|
1124
1119
|
* - `.` + digit at the removal site: a period directly before a digit blocks
|
|
1125
1120
|
* the dash pass's number-range detection, so vacating the slot converts a
|
|
1126
|
-
* range this run left alone
|
|
1121
|
+
* range this run left alone;
|
|
1122
|
+
* - a closer directly after a still-straight `'` + two digits: that adjacency
|
|
1123
|
+
* is what keeps {@link isDecadeElision} from reading the quote as an
|
|
1124
|
+
* elision, so the re-run of `.'47,’` would turn it into `’`.
|
|
1127
1125
|
*/
|
|
1128
1126
|
function insideMoveFlipsContext(order, runStart, punctIndex) {
|
|
1129
1127
|
if (order[punctIndex].ch === ".") {
|
|
@@ -1134,7 +1132,14 @@ function insideMoveFlipsContext(order, runStart, punctIndex) {
|
|
|
1134
1132
|
if (afterPunct < order.length && !order[afterPunct].boundary && DIGIT_RE.test(order[afterPunct].ch))
|
|
1135
1133
|
return true;
|
|
1136
1134
|
}
|
|
1137
|
-
return
|
|
1135
|
+
return closesStraightQuotedDigits(order, runStart);
|
|
1136
|
+
}
|
|
1137
|
+
/** `'` + two digits, then the single closer at `runStart`. */
|
|
1138
|
+
function closesStraightQuotedDigits(order, runStart) {
|
|
1139
|
+
return isCharItem(order, runStart, RIGHT_SINGLE_QUOTE)
|
|
1140
|
+
&& isDigitItem(order, runStart - 1)
|
|
1141
|
+
&& isDigitItem(order, runStart - 2)
|
|
1142
|
+
&& isCharItem(order, runStart - 3, "'");
|
|
1138
1143
|
}
|
|
1139
1144
|
/** True iff the run [start, end) contains a single-quote closer or apostrophe. */
|
|
1140
1145
|
function runContainsSingleCloser(order, start, end) {
|
|
@@ -1147,9 +1152,8 @@ function runContainsSingleCloser(order, start, end) {
|
|
|
1147
1152
|
}
|
|
1148
1153
|
/**
|
|
1149
1154
|
* Mirror of {@link singleEndingAfter} at the run end as the post-move item
|
|
1150
|
-
* sequence reads it: the vacating punctuation leaves
|
|
1151
|
-
*
|
|
1152
|
-
* lookahead's one-boundary budget.
|
|
1155
|
+
* sequence reads it: the vacating punctuation leaves the boundary items around
|
|
1156
|
+
* it behind, and they all count against the lookahead's one-boundary budget.
|
|
1153
1157
|
*/
|
|
1154
1158
|
function endingContextAfterMove(order, runEnd, punctIndex) {
|
|
1155
1159
|
let boundaries = 0;
|
|
@@ -1222,6 +1226,15 @@ function moveWallAt(items, index) {
|
|
|
1222
1226
|
const item = items[index];
|
|
1223
1227
|
return !item.boundary && MOVE_WALL_CHARS.has(item.ch);
|
|
1224
1228
|
}
|
|
1229
|
+
/**
|
|
1230
|
+
* True iff the item at `index` is the only text of its node: a boundary or the
|
|
1231
|
+
* view edge on each side. Moving it would empty the node, and an emptied inline
|
|
1232
|
+
* mark (`_,_`) serializes as bare delimiters that the next run reads as literal
|
|
1233
|
+
* text.
|
|
1234
|
+
*/
|
|
1235
|
+
function isWholeNodeText(order, index) {
|
|
1236
|
+
return (order[index - 1]?.boundary ?? true) && (order[index + 1]?.boundary ?? true);
|
|
1237
|
+
}
|
|
1225
1238
|
/**
|
|
1226
1239
|
* British/German/French: a period or comma directly before a closing-quote
|
|
1227
1240
|
* run moves past the whole run. No terminal-punctuation guard.
|
|
@@ -1237,7 +1250,7 @@ function movePunctuationOutside(order, punctChar, closingSet, guardRederivation,
|
|
|
1237
1250
|
let position = 0;
|
|
1238
1251
|
while (position < order.length) {
|
|
1239
1252
|
const item = order[position];
|
|
1240
|
-
if (item.boundary || item.ch !== punctChar) {
|
|
1253
|
+
if (item.boundary || item.ch !== punctChar || isWholeNodeText(order, position)) {
|
|
1241
1254
|
position++;
|
|
1242
1255
|
continue;
|
|
1243
1256
|
}
|
|
@@ -1286,10 +1299,9 @@ function movePunctuationOutside(order, punctChar, closingSet, guardRederivation,
|
|
|
1286
1299
|
// Any collapsible space char qualifies, not just a plain space: the
|
|
1287
1300
|
// collapse pass merges tabs and NBSPs into the closer's NNBSP padding
|
|
1288
1301
|
// the same way.
|
|
1289
|
-
if (spaceBeforePaddedCloser && k
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
k++;
|
|
1302
|
+
if (spaceBeforePaddedCloser && spaceRunReadsAsSingle(order, k, 1, RIGHT_DOUBLE_QUOTE)) {
|
|
1303
|
+
while (SPACE_CHAR_RE.test(order[k].ch))
|
|
1304
|
+
k++;
|
|
1293
1305
|
}
|
|
1294
1306
|
if (k >= order.length || order[k].boundary || !closingRunMemberAt(order, k, closingSet))
|
|
1295
1307
|
break;
|
|
@@ -1342,18 +1354,41 @@ function applyPunctuationPlacement(items, style, apostrophe) {
|
|
|
1342
1354
|
// ---------------------------------------------------------------------------
|
|
1343
1355
|
// Rendering
|
|
1344
1356
|
// ---------------------------------------------------------------------------
|
|
1345
|
-
/** A one-char unmoved NBSP/NNBSP item
|
|
1357
|
+
/** A one-char unmoved NBSP/NNBSP item. */
|
|
1346
1358
|
function isPaddingSpaceItem(item) {
|
|
1347
1359
|
return item !== undefined && !item.boundary && !item.moved
|
|
1348
1360
|
&& item.end - item.start === 1 && (item.ch === NBSP || item.ch === NNBSP);
|
|
1349
1361
|
}
|
|
1362
|
+
/**
|
|
1363
|
+
* The closer at `closerIndex` takes the padding space directly before it, or
|
|
1364
|
+
* deletes it when moved punctuation leaves them textually apart. A padding
|
|
1365
|
+
* space further left in the same run, textually apart from the next member,
|
|
1366
|
+
* is deleted too: the collapse pass would merge it with the closer's padding
|
|
1367
|
+
* into an NBSP, which a re-run absorbs as the padding and renders NNBSP.
|
|
1368
|
+
*/
|
|
1369
|
+
function absorbSpaceRunBeforeCloser(items, closerIndex) {
|
|
1370
|
+
const closer = items[closerIndex];
|
|
1371
|
+
for (let j = closerIndex - 1; j >= 0; j--) {
|
|
1372
|
+
const member = items[j];
|
|
1373
|
+
if (member.boundary || member.moved || member.end - member.start !== 1 || !SPACE_CHAR_RE.test(member.ch))
|
|
1374
|
+
return;
|
|
1375
|
+
const gapAfter = member.end !== items[j + 1].start;
|
|
1376
|
+
if (isPaddingSpaceItem(member) && (j === closerIndex - 1 || gapAfter)) {
|
|
1377
|
+
if (!gapAfter) {
|
|
1378
|
+
closer.start = member.start;
|
|
1379
|
+
member.end = member.start;
|
|
1380
|
+
}
|
|
1381
|
+
member.ch = "";
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1350
1385
|
/**
|
|
1351
1386
|
* French renders double-quote glyphs with NNBSP padding. A source NBSP/NNBSP
|
|
1352
|
-
*
|
|
1353
|
-
* space whose type wins by priority (NBSP beats NNBSP), which the next
|
|
1354
|
-
* absorbs as the glyph's padding and re-renders NNBSP
|
|
1355
|
-
* Absorb the
|
|
1356
|
-
*
|
|
1387
|
+
* adjacent to the glyph in the placed order would collapse with that padding
|
|
1388
|
+
* into one space whose type wins by priority (NBSP beats NNBSP), which the next
|
|
1389
|
+
* run absorbs as the glyph's padding and re-renders NNBSP, an oscillation.
|
|
1390
|
+
* Absorb the space into the (single-char, i.e. unpadded) glyph item now so its
|
|
1391
|
+
* render replaces both with the padded form.
|
|
1357
1392
|
*/
|
|
1358
1393
|
function absorbGuillemetPadding(items) {
|
|
1359
1394
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -1361,12 +1396,7 @@ function absorbGuillemetPadding(items) {
|
|
|
1361
1396
|
if (item.boundary || item.moved || item.end - item.start !== 1)
|
|
1362
1397
|
continue;
|
|
1363
1398
|
if (item.ch === RIGHT_DOUBLE_QUOTE) {
|
|
1364
|
-
|
|
1365
|
-
if (isPaddingSpaceItem(prev) && prev.end === item.start) {
|
|
1366
|
-
item.start = prev.start;
|
|
1367
|
-
prev.end = prev.start;
|
|
1368
|
-
prev.ch = "";
|
|
1369
|
-
}
|
|
1399
|
+
absorbSpaceRunBeforeCloser(items, i);
|
|
1370
1400
|
}
|
|
1371
1401
|
else if (item.ch === LEFT_DOUBLE_QUOTE) {
|
|
1372
1402
|
const next = items[i + 1];
|
|
@@ -1412,7 +1442,7 @@ function queueRenderEdits(view, items, table) {
|
|
|
1412
1442
|
if (item.boundary)
|
|
1413
1443
|
continue;
|
|
1414
1444
|
const role = ROLE_BY_CHAR.get(item.ch);
|
|
1415
|
-
const rendered = role === undefined ? item.ch : table[role];
|
|
1445
|
+
const rendered = role === undefined ? (item.curlySource ?? item.ch) : table[role];
|
|
1416
1446
|
if (item.moved) {
|
|
1417
1447
|
view.replace(item.start, item.end, "");
|
|
1418
1448
|
const key = `${item.anchorOffset}|${item.anchorBind}`;
|
|
@@ -1430,11 +1460,9 @@ function queueRenderEdits(view, items, table) {
|
|
|
1430
1460
|
}
|
|
1431
1461
|
continue;
|
|
1432
1462
|
}
|
|
1433
|
-
if (role === undefined && item.curlySource !== undefined)
|
|
1434
|
-
continue;
|
|
1435
1463
|
// Fast path for ordinary characters; pre-labeled items may have changed
|
|
1436
1464
|
// `ch` without gaining a role (German orphan closers) and must still diff.
|
|
1437
|
-
if (role === undefined && item.ch === text[item.start] && item.end - item.start === 1)
|
|
1465
|
+
if (role === undefined && item.curlySource === undefined && item.ch === text[item.start] && item.end - item.start === 1)
|
|
1438
1466
|
continue;
|
|
1439
1467
|
if (rendered !== text.slice(item.start, item.end)) {
|
|
1440
1468
|
view.replace(item.start, item.end, rendered);
|
|
@@ -1447,6 +1475,60 @@ function queueRenderEdits(view, items, table) {
|
|
|
1447
1475
|
// ---------------------------------------------------------------------------
|
|
1448
1476
|
// Public engine entry points
|
|
1449
1477
|
// ---------------------------------------------------------------------------
|
|
1478
|
+
/**
|
|
1479
|
+
* The items the next run builds from this pass's rendering. German reads its
|
|
1480
|
+
* rendered glyphs by depth, and re-derives most of them to straight candidates
|
|
1481
|
+
* classified by position, so the next run's readings depend on the roles this
|
|
1482
|
+
* pass assigned to everything before them. The next run's prime pass turns
|
|
1483
|
+
* the digit-adjacent straight quotes this pass leaves straight into primes,
|
|
1484
|
+
* so they are primes here too.
|
|
1485
|
+
*/
|
|
1486
|
+
function rereadGermanRendering(items, text, apostrophe) {
|
|
1487
|
+
const rendered = renderTable("german", apostrophe);
|
|
1488
|
+
const depth = { double: 0, single: 0 };
|
|
1489
|
+
const reread = items.map((item) => {
|
|
1490
|
+
if (item.boundary)
|
|
1491
|
+
return makeItem(true, "", item.start, item.end);
|
|
1492
|
+
const role = ROLE_BY_CHAR.get(item.ch);
|
|
1493
|
+
const glyph = role === undefined ? (item.curlySource ?? item.ch) : rendered[role];
|
|
1494
|
+
const mapped = readGermanGlyph(glyph, DIGIT_RE.test(text[item.start - 1] ?? ""), depth);
|
|
1495
|
+
const next = makeItem(false, mapped ?? item.ch, item.start, item.end);
|
|
1496
|
+
next.moved = item.moved;
|
|
1497
|
+
next.anchorOffset = item.anchorOffset;
|
|
1498
|
+
next.anchorBind = item.anchorBind;
|
|
1499
|
+
if (mapped === '"' || mapped === "'")
|
|
1500
|
+
next.curlySource = glyph;
|
|
1501
|
+
return next;
|
|
1502
|
+
});
|
|
1503
|
+
convertPrimes(reread, new Set());
|
|
1504
|
+
return reread;
|
|
1505
|
+
}
|
|
1506
|
+
/** Runs the single- then double-quote classification rules over `items`. */
|
|
1507
|
+
function classifyBuiltItems(items, style) {
|
|
1508
|
+
classifySingles(items, style);
|
|
1509
|
+
classifyDoubles(items, style);
|
|
1510
|
+
}
|
|
1511
|
+
// Loop guard only: reaching a fixed point is expected within a few rounds. The
|
|
1512
|
+
// worst case found so far takes 4 (`„“„” „(” ““‚`).
|
|
1513
|
+
const MAX_GERMAN_REREADS = 8;
|
|
1514
|
+
/**
|
|
1515
|
+
* Repeats German's classification over its own rereadings until a round
|
|
1516
|
+
* assigns the roles it started from: the next run starts from the first fixed
|
|
1517
|
+
* point.
|
|
1518
|
+
*/
|
|
1519
|
+
function settleGermanRoles(items, text, apostrophe) {
|
|
1520
|
+
for (let round = 0; round < MAX_GERMAN_REREADS; round++) {
|
|
1521
|
+
const reread = rereadGermanRendering(items, text, apostrophe);
|
|
1522
|
+
classifyBuiltItems(reread, "german");
|
|
1523
|
+
const settled = reread.every((item, index) => item.ch === items[index].ch);
|
|
1524
|
+
items = reread;
|
|
1525
|
+
if (settled)
|
|
1526
|
+
return items;
|
|
1527
|
+
}
|
|
1528
|
+
/* istanbul ignore next -- defensive: no input found settles in more than 4
|
|
1529
|
+
rounds; a cap hit means the reread no longer converges. */
|
|
1530
|
+
throw new Error(`German quote classification did not settle within ${MAX_GERMAN_REREADS} rereads`);
|
|
1531
|
+
}
|
|
1450
1532
|
/**
|
|
1451
1533
|
* The quote/apostrophe role classifier: one boundary-aware scan over the
|
|
1452
1534
|
* view's text. Commits its edits.
|
|
@@ -1454,20 +1536,27 @@ function queueRenderEdits(view, items, table) {
|
|
|
1454
1536
|
export function classifyAndRenderQuotes(view, style, apostrophe) {
|
|
1455
1537
|
if (!QUOTE_CANDIDATE_RE.test(view.text))
|
|
1456
1538
|
return;
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
classifyDoubles(items, style);
|
|
1539
|
+
let items = buildItems(view, style);
|
|
1540
|
+
classifyBuiltItems(items, style);
|
|
1460
1541
|
if (style === "german")
|
|
1461
|
-
|
|
1462
|
-
|
|
1542
|
+
items = settleGermanRoles(items, view.text, apostrophe);
|
|
1543
|
+
let placed = applyPunctuationPlacement(items, style, apostrophe);
|
|
1544
|
+
if (style === "german" && placed !== items)
|
|
1545
|
+
placed = settleGermanRoles(placed, view.text, apostrophe);
|
|
1463
1546
|
// Placement can slide a closer past punctuation until it sits directly after
|
|
1464
1547
|
// an s/S (british/french move the closer left, out of "dogs.'" → "dogs'."),
|
|
1465
1548
|
// turning it into a plural possessive the pre-placement scan couldn't see. A
|
|
1466
1549
|
// re-run over the final order relabels it, so the first transform matches what
|
|
1467
1550
|
// a re-run reads (classifyApostrophes "dogs.'" → "dogsʼ." in one pass).
|
|
1468
1551
|
classifyPluralPossessives(placed, style);
|
|
1469
|
-
if (style === "french")
|
|
1552
|
+
if (style === "french") {
|
|
1553
|
+
// Punctuation moved out from between a straight quote's trailing space and
|
|
1554
|
+
// a closer leaves the closer directly after that space, which the opener
|
|
1555
|
+
// rules read as the closer's padding. Re-run them on the placed order.
|
|
1556
|
+
classifyOpeningSingles(placed, style);
|
|
1557
|
+
classifyOpeningDoubles(placed, style);
|
|
1470
1558
|
absorbGuillemetPadding(placed);
|
|
1559
|
+
}
|
|
1471
1560
|
queueRenderEdits(view, placed, renderTable(style, apostrophe));
|
|
1472
1561
|
view.commit();
|
|
1473
1562
|
}
|
|
@@ -1510,7 +1599,7 @@ function convertPrimes(items, swissSeparators) {
|
|
|
1510
1599
|
let balance = 0;
|
|
1511
1600
|
for (let i = 0; i < items.length; i++) {
|
|
1512
1601
|
const item = items[i];
|
|
1513
|
-
if (item.boundary || item.ch !== quote)
|
|
1602
|
+
if (item.boundary || item.ch !== quote || item.curlySource !== undefined)
|
|
1514
1603
|
continue;
|
|
1515
1604
|
// A Swiss/Liechtenstein digit-group separator (5'000) is an apostrophe,
|
|
1516
1605
|
// not a foot/minute prime; curl it and leave the quote balance untouched.
|