From cfed355aa28191428c7e8847cc9936c51577fecd Mon Sep 17 00:00:00 2001 From: Iurii Rogulia Date: Wed, 9 Sep 2026 21:27:30 +0300 Subject: [PATCH] Implement spec 1.1.0: universal medial-n elision veto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vendors canonical spec 1.1.0 (spec-v1.1.0) and implements the rule change it specifies. _quote_ambiguity.compute_ambiguous_indices narrows the general veto from 1-3 LETTER code points to exactly one, U+006E or U+004E, and widens it from straight ASCII to the whole NARROW class. The widening is an idempotency obligation, not a preference: the veto's marks are now converted to U+2019 by `apostrophe`, so a straight-only predicate would not recognise its own output and pass 2 would pair `rock ’n’ roll` as an ordinary NARROW quotation on the next run. The function now returns a single veto set instead of (veto, preserve). The preserve set existed to stop `apostrophe`'s case ladder from converting marks spec 0.5.0 wanted preserved; conversion is now the specified outcome, so apostrophe.py drops the lookup and its import, skips no position, and reads no locale data again (order.json: localeData [] for `apostrophe`). Observable change, all ten locales: rock 'n' roll -> rock ’n’ roll (was: unchanged outside en-US) "это 'моё' дело" -> «это „моё“ дело» The letter 'n' ... -> The letter ’n’ ... (accepted false positive) --- pyproject.toml | 2 +- .../_engine/rules/_quote_ambiguity.py | 75 +++++++++---------- src/polytypo/_engine/rules/apostrophe.py | 11 ++- src/polytypo/_engine/rules/quotes.py | 2 +- vendor/polytypo-spec/VERSION | 2 +- vendor/polytypo-spec/fixtures/de-CH.json | 6 +- vendor/polytypo-spec/fixtures/de-DE.json | 6 +- vendor/polytypo-spec/fixtures/el.json | 14 ++-- vendor/polytypo-spec/fixtures/en-GB.json | 10 +-- vendor/polytypo-spec/fixtures/en-US.json | 74 +++++++++--------- vendor/polytypo-spec/fixtures/fi.json | 14 +++- vendor/polytypo-spec/fixtures/fr-CA.json | 10 +-- vendor/polytypo-spec/fixtures/fr.json | 10 +-- .../fixtures/locale-resolution.json | 2 +- vendor/polytypo-spec/fixtures/ru.json | 18 +++-- vendor/polytypo-spec/fixtures/sv.json | 6 +- vendor/polytypo-spec/locales/registry.json | 2 +- vendor/polytypo-spec/rules/order.json | 8 +- 18 files changed, 142 insertions(+), 130 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 941d078..1a3d234 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "polytypo" -version = "1.0.1" +version = "1.1.0" description = "Normalize typography across languages: locale-correct quotes, dashes, ellipses and no-break spaces." readme = "README.md" license = "MIT" diff --git a/src/polytypo/_engine/rules/_quote_ambiguity.py b/src/polytypo/_engine/rules/_quote_ambiguity.py index db84b46..f8637d8 100644 --- a/src/polytypo/_engine/rules/_quote_ambiguity.py +++ b/src/polytypo/_engine/rules/_quote_ambiguity.py @@ -1,7 +1,9 @@ -"""Shared ambiguous-medial-span predicate (quotes.md 3.2 "General ambiguous-medial-span veto" -and "Listed elision veto"), consumed identically by `quotes` and `apostrophe` so the two rules -cannot drift apart on what counts as ambiguous (mirrors polytypo-js's -src/rules/quote-ambiguity.ts).""" +"""The two decline-only predicates `quotes` reads (quotes.md 3.2, "Listed elision veto" and +"Universal medial-`n` elision veto"). Both have the same outcome: the marks survive pass 2 +unmatched and `apostrophe` converts each by its own case ladder, giving `rock 'n' roll` -> +`rock ’n’ roll`. Only `quotes` consumes this module -- spec 0.5.0 had `apostrophe` consume it +too, through a preserve set withdrawn in 1.1.0 (apostrophe.md 3.4). Mirrors polytypo-js's +src/rules/quote-ambiguity.ts.""" from __future__ import annotations @@ -10,9 +12,14 @@ from polytypo._engine.sentinels import NONE from polytypo._engine.unicode import is_letter -NARROW_APOSTROPHE = 0x27 # U+0027 -- the only glyph the GENERAL ambiguous-shape veto considers -NARROW = frozenset({0x27, 0x2018, 0x2019, 0x201A, 0x201B, 0x2039, 0x203A}) # the LISTED elision -# veto's own trigger class -- ANY NARROW mark, curly or straight (unlike the general veto above) +NARROW = frozenset({0x27, 0x2018, 0x2019, 0x201A, 0x201B, 0x2039, 0x203A}) # both vetoes' trigger +# class -- ANY NARROW mark, curly or straight. For the universal medial-n veto this is an +# IDEMPOTENCY obligation, not a preference: its marks are converted to U+2019 by `apostrophe`, so +# a straight-ASCII-only predicate would not recognise its own output and pass 2 would pair +# `rock ’n’ roll` as an ordinary NARROW quotation on the next run -- measured as `rock «n» roll` +# in ru and `rock ”n” roll` in fi. +LOWER_N = 0x6E # quotes.md 3.2 -- the one code point the universal veto's span may enclose, +UPPER_N = 0x4E # in either case DIGIT = frozenset(range(0x30, 0x3A)) INLINE_SPACE = frozenset({0x20, 0x09, 0xA0, 0x202F, 0x2007, 0x2009, 0x200A}) @@ -72,17 +79,12 @@ def _word_matches(cp: list[int], start: int, end: int, pattern: str) -> bool: return True -def compute_ambiguous_indices( - cp: list[int], locale_data: dict[str, Any] -) -> tuple[set[int], set[int]]: - """Returns (veto_indices, preserve_indices). +def compute_ambiguous_indices(cp: list[int], locale_data: dict[str, Any]) -> set[int]: + """Every index that must have both quote capabilities forced false in `quotes`' own pass 1 -- + the union of the listed-idiom matches and the universal medial-n matches. - veto_indices: every index that must have both quote capabilities forced false in `quotes`' - own pass 1 -- the union of listed-idiom matches and the general ambiguous-shape matches. - - preserve_indices: veto_indices MINUS the listed-idiom matches -- positions `apostrophe` must - skip entirely rather than curling via its own case ladder (general-shape-but-uncited - positions only; idiom-matched positions get apostrophe's normal elision treatment). + The union is computed rather than assumed: an idiom's `elided` field is not required to be + the single `n` the universal veto matches. """ n = len(cp) idiom_indices: set[int] = set() @@ -119,25 +121,20 @@ def compute_ambiguous_indices( idiom_indices.add(i) idiom_indices.add(j) - general_indices: set[int] = set() - i = 0 - while i < n: - if cp[i] == NARROW_APOSTROPHE: - for enclosed_len in (1, 2, 3): - j = i + 1 + enclosed_len - if j >= n or cp[j] != NARROW_APOSTROPHE: - continue - enclosed = cp[i + 1 : i + 1 + enclosed_len] - if not all(is_letter(c) for c in enclosed): - continue - if _at(cp, i - 1) not in INLINE_SPACE: - continue - if _at(cp, j + 1) not in INLINE_SPACE: - continue - general_indices.add(i) - general_indices.add(j) - i += 1 - - veto_indices = idiom_indices | general_indices - preserve_indices = general_indices - idiom_indices - return veto_indices, preserve_indices + medial_n_indices: set[int] = set() + for i in range(n): + if cp[i] not in NARROW: + continue + if _at(cp, i + 1) not in (LOWER_N, UPPER_N): + continue + j = i + 2 + if _at(cp, j) not in NARROW: + continue + if _at(cp, i - 1) not in INLINE_SPACE: + continue + if _at(cp, j + 1) not in INLINE_SPACE: + continue + medial_n_indices.add(i) + medial_n_indices.add(j) + + return idiom_indices | medial_n_indices diff --git a/src/polytypo/_engine/rules/apostrophe.py b/src/polytypo/_engine/rules/apostrophe.py index 77f4fda..4405d85 100644 --- a/src/polytypo/_engine/rules/apostrophe.py +++ b/src/polytypo/_engine/rules/apostrophe.py @@ -1,5 +1,7 @@ -"""spec/rules/apostrophe.md -- order 50, default on. Locale data: quotes.elisionIdioms -(indirectly, via the shared ambiguity predicate's preserve set).""" +"""spec/rules/apostrophe.md -- order 50, default on. Reads no locale data and skips no position +as of spec 1.1.0: 0.5.0's preserve set (apostrophe.md 3.4) existed to stop the case ladder from +converting the marks `quotes` had vetoed, and conversion is now the specified outcome for exactly +those marks -- cases 4 and 3 are what turn `rock 'n' roll` into `rock ’n’ roll`.""" from __future__ import annotations @@ -7,7 +9,6 @@ from polytypo._engine.edits import Edit from polytypo._engine.registry import RuleContext -from polytypo._engine.rules import _quote_ambiguity from polytypo._engine.sentinels import LINE_MARKER, MARKER, NONE from polytypo._engine.unicode import is_letter @@ -75,11 +76,9 @@ def _is_alnum(v: int) -> bool: def scan(cp: list[int], locale_data: dict[str, Any], ctx: RuleContext) -> list[Edit]: - _veto, preserve = _quote_ambiguity.compute_ambiguous_indices(cp, locale_data) - edits: list[Edit] = [] for i, g in enumerate(cp): - if g != SQ or i in preserve: + if g != SQ: continue left = _at(cp, i - 1) right = _at(cp, i + 1) diff --git a/src/polytypo/_engine/rules/quotes.py b/src/polytypo/_engine/rules/quotes.py index d596620..75ab220 100644 --- a/src/polytypo/_engine/rules/quotes.py +++ b/src/polytypo/_engine/rules/quotes.py @@ -84,7 +84,7 @@ def _skip_right(cp: list[int], i: int) -> int: def _compute_candidates(cp: list[int], locale_data: dict[str, Any]) -> list[Candidate]: space_right, space_left = _locale_skip_sets(locale_data) - veto_indices, _preserve = _quote_ambiguity.compute_ambiguous_indices(cp, locale_data) + veto_indices = _quote_ambiguity.compute_ambiguous_indices(cp, locale_data) candidates: list[Candidate] = [] for i, g in enumerate(cp): diff --git a/vendor/polytypo-spec/VERSION b/vendor/polytypo-spec/VERSION index afaf360..9084fa2 100644 --- a/vendor/polytypo-spec/VERSION +++ b/vendor/polytypo-spec/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.1.0 diff --git a/vendor/polytypo-spec/fixtures/de-CH.json b/vendor/polytypo-spec/fixtures/de-CH.json index 14c0e3a..a5de5b1 100644 --- a/vendor/polytypo-spec/fixtures/de-CH.json +++ b/vendor/polytypo-spec/fixtures/de-CH.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "de-CH", "cases": [ { @@ -494,8 +494,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "spec 0.5.0: de-CH has no cited quotes.elisionIdioms entry for this idiom (quotes.md §7 item 8 — only en-US does, via Chicago Manual of Style Online and the American Heritage Dictionary). The general ambiguous-medial-span veto (quotes.md 3.2) preserves both marks as literal U+0027 rather than pairing them as an ordinary quotation, closing the false positive AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1 named for \"equivalent cases in several locales.\"" + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs." } ] } diff --git a/vendor/polytypo-spec/fixtures/de-DE.json b/vendor/polytypo-spec/fixtures/de-DE.json index 5f9b3d6..c8cbced 100644 --- a/vendor/polytypo-spec/fixtures/de-DE.json +++ b/vendor/polytypo-spec/fixtures/de-DE.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "de-DE", "cases": [ { @@ -540,8 +540,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "spec 0.5.0: de-DE has no cited quotes.elisionIdioms entry for this idiom (quotes.md §7 item 8 — only en-US does, via Chicago Manual of Style Online and the American Heritage Dictionary). The general ambiguous-medial-span veto (quotes.md 3.2) preserves both marks as literal U+0027 rather than pairing them as an ordinary quotation, closing the false positive AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1 named for \"equivalent cases in several locales.\"" + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs." } ] } diff --git a/vendor/polytypo-spec/fixtures/el.json b/vendor/polytypo-spec/fixtures/el.json index ba59df1..0712f8a 100644 --- a/vendor/polytypo-spec/fixtures/el.json +++ b/vendor/polytypo-spec/fixtures/el.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "el", "cases": [ { @@ -133,8 +133,8 @@ "rule": "quotes", "mode": "text", "in": "\"Είπε 'όχι' σε μένα\", σημείωσε.", - "out": "«Είπε 'όχι' σε μένα», σημείωσε.", - "note": "quotes.md §6: one stack, inner pair at depth 2 takes the secondary pair U+201C/U+201D. Greek combines guillemets with curly double quotes, which no other v1 locale does. spec 0.5.0: the inner 'όχι' (3 Greek letters, space-flanked) is preserved by the general ambiguous-medial-span veto — el has no elisionIdioms entry for this shape." + "out": "«Είπε “όχι” σε μένα», σημείωσε.", + "note": "quotes.md §6: one stack, inner pair at depth 2 takes the secondary pair U+201C/U+201D. Greek combines guillemets with curly double quotes, which no other v1 locale does. spec 1.1.0 restores the nesting this case was written for: 0.5.0's general ambiguous-medial-span veto had preserved the inner 'όχι' as literal U+0027 because it was 3 letters, space-flanked; the veto that replaced it matches only a medial n (quotes.md §3.2), so an ordinary short quotation pairs again." }, { "id": "el-quotes-already-guillemets", @@ -205,8 +205,8 @@ "rule": "quotes", "mode": "text", "in": "\"Είπε 'όχι' σε μένα\", σημείωσε.", - "out": "«Είπε 'όχι' σε μένα», σημείωσε.", - "note": "quotes.md §6 row 16: width drift with no gate intervention — el's secondary pair is WIDE (“ ”), so the inner NARROW pair drifts to WIDE on render and all four marks land on one stack in the gate's re-scan; the certification gate certifies without declining anything, evidence the gate's cost is near zero for the common case. spec 0.5.0: same as el-quotes-nested — 'όχι' is preserved by the general ambiguous-medial-span veto rather than pairing as an ordinary same-width quotation." + "out": "«Είπε “όχι” σε μένα», σημείωσε.", + "note": "quotes.md §6 row 16: width drift with no gate intervention — el's secondary pair is WIDE (“ ”), so the inner NARROW pair drifts to WIDE on render and all four marks land on one stack in the gate's re-scan; the certification gate certifies without declining anything, evidence the gate's cost is near zero for the common case. spec 1.1.0: same as el-quotes-nested — the width-drift path this case exists to exercise is reachable again now that a 3-letter medial span is no longer vetoed (quotes.md §3.2). Under 0.5.0 the inner marks never paired, so nothing drifted and the case proved nothing about the gate." }, { "id": "el-quotes-030-adversarial-interleaved", @@ -221,8 +221,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "spec 0.5.0: el has no cited quotes.elisionIdioms entry for this idiom (quotes.md §7 item 8 — only en-US does, via Chicago Manual of Style Online and the American Heritage Dictionary). The general ambiguous-medial-span veto (quotes.md 3.2) preserves both marks as literal U+0027 rather than pairing them as an ordinary quotation, closing the false positive AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1 named for \"equivalent cases in several locales.\"" + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs." }, { "id": "el-ranges-none", diff --git a/vendor/polytypo-spec/fixtures/en-GB.json b/vendor/polytypo-spec/fixtures/en-GB.json index c3f6132..5c9c5fb 100644 --- a/vendor/polytypo-spec/fixtures/en-GB.json +++ b/vendor/polytypo-spec/fixtures/en-GB.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "en-GB", "cases": [ { @@ -632,8 +632,8 @@ "rule": "quotes", "mode": "text", "in": "\"He said 'no' to me,\" she noted.", - "out": "‘He said 'no' to me,’ she noted.", - "note": "quotes.md §6 case 2, inverted: depth 1 → single, depth 2 → double. Compare en-US-quotes-nested, same input. The inner 'no' (2 letters, space-flanked, no matching elisionIdioms entry — en-GB has none) is preserved by the general ambiguous-medial-span veto (quotes.md §3.2) rather than paired as a nested quotation: a documented false negative, not an unresolved gap (History: this was open per quotes.md §7 item 8 through spec 0.4.1, closed by the general veto in spec 0.5.0)." + "out": "‘He said “no” to me,’ she noted.", + "note": "quotes.md §6 case 2, inverted: depth 1 → single, depth 2 → double. Compare en-us-quotes-nested, same input. spec 1.1.0: the inner 'no' pairs as a nested quotation again — 0.5.0's general ambiguous-medial-span veto had preserved it as literal U+0027, and the universal medial-n veto that replaced it does not match a two-letter span (quotes.md §3.2)." }, { "id": "en-gb-quotes-nested-inverted-input", @@ -712,8 +712,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "quotes.md §7.1. The output is accidentally right here — not because a secondary level was selected, but because en-GB declares the single pair as PRIMARY and the pair is at depth 1. spec 0.5.0: en-GB has no cited elisionIdioms entry for this idiom (quotes.md §7 item 8 — elevated ambiguity risk, since en-GB's primary pair is itself the single quote). The general ambiguous-medial-span veto now preserves the marks as literal U+0027 instead of pairing them as an ordinary quotation, which is the pre-0.5.0 behaviour this fixture used to assert. AUDIT_REMEDIATION_AND_RELEASE_PLAN.md §3.1 named exactly this locale as an affected case." + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs. en-GB is the locale quotes.md §7 item 8 flags as carrying the highest genuine-dialogue collision risk, because its primary pair is itself the single quote — that risk is why no elisionIdioms entry was ever cited here, and 1.1.0's veto deliberately does not depend on one." }, { "id": "en-gb-quotes-elision-inside-quotation", diff --git a/vendor/polytypo-spec/fixtures/en-US.json b/vendor/polytypo-spec/fixtures/en-US.json index 71936d9..5c2f127 100644 --- a/vendor/polytypo-spec/fixtures/en-US.json +++ b/vendor/polytypo-spec/fixtures/en-US.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "en-US", "cases": [ { @@ -755,8 +755,8 @@ "rule": "quotes", "mode": "text", "in": "\"He said 'no' to me,\" she noted.", - "out": "“He said 'no' to me,” she noted.", - "note": "quotes.md §6 case 2: one stack, inner pair at depth 2 → secondary. spec 0.5.0: the inner 'no' is now an ambiguous medial span (2 letters, space-flanked, no matching en-US elisionIdioms entry — the idiom list holds only rock/n/roll) and is preserved as literal U+0027 rather than paired as a nested quotation (quotes.md 3.2, general ambiguous-medial-span veto). A documented false negative, not a regression: quotes.md 3.2 explains why a structural, portable predicate cannot distinguish this from rock 'n' roll's shape." + "out": "“He said ‘no’ to me,” she noted.", + "note": "quotes.md §6 case 2: one stack, inner pair at depth 2 → secondary. spec 1.1.0 restores the nesting this case was written for: 0.5.0's general ambiguous-medial-span veto had preserved the inner 'no' as literal U+0027 because it was 2 letters and space-flanked, and the veto that replaced it matches only a medial n (quotes.md §3.2), so an ordinary short quotation pairs again. Compare en-gb-quotes-nested, same input, inverted glyphs." }, { "id": "en-us-quotes-nested-inverted-input", @@ -836,7 +836,7 @@ "mode": "text", "in": "rock 'n' roll", "out": "rock ’n’ roll", - "note": "quotes.md §3.2's listed elision veto (spec 0.4.0): quotes.elisionIdioms = [{ left: \"rock\", elided: \"n\", right: \"roll\" }] (en-US.json sources: Chicago Manual of Style Online on the mark's function, American Heritage Dictionary on the spaced variant) makes both marks decline pairing when the full left/elided/right context matches, so they survive to apostrophe (order 50), which independently renders each as U+2019 — leading elision (case 4) then trailing elision (case 3). apostrophe.md §6 row 11a. Contrast en-GB/fi/sv, which have no citable elisionIdioms entry: the general ambiguous-medial-span veto (quotes.md §3.2) preserves the same bytes unconverted there instead — see en-gb-quotes-rock-n-roll. Matching elided content alone (a bare word list) was tried first and withdrawn: it falsely elided ordinary quotations of the letter n — see en-us-quotes-letter-n-not-elided and en-us-quotes-nested-quote-n-not-elided." + "note": "quotes.md §3.2's listed elision veto (spec 0.4.0): quotes.elisionIdioms = [{ left: \"rock\", elided: \"n\", right: \"roll\" }] (en-US.json sources: Chicago Manual of Style Online on the mark's function, American Heritage Dictionary on the spaced variant) makes both marks decline pairing when the full left/elided/right context matches, so they survive to apostrophe (order 50), which independently renders each as U+2019 — leading elision (case 4) then trailing elision (case 3). apostrophe.md §6 row 11a. This output has been constant since 0.4.0 and is the model every other locale was brought into line with in spec 1.1.0, whose universal medial-n veto (quotes.md §3.2) now vetoes a superset of these positions — see ru-quotes-rock-n-roll for the same output reached without a citation. Matching elided content alone (a bare word list) was tried and withdrawn in 0.4.0; 1.1.0 readmits that cost knowingly and only for a single code point — see en-us-quotes-letter-n-elided." }, { "id": "en-us-quotes-elision-inside-quotation", @@ -844,7 +844,7 @@ "mode": "text", "in": "She said \"it's the '90s\" and left.", "out": "She said “it’s the ’90s” and left.", - "note": "quotes.md §3.3 and §5.5: pass 2 keeps TWO STACKS, one per kind, and a candidate only ever touches the stack for its own kind — no reader opens with `\"` and closes with `'`, in any language. So the two DQ marks pair with each other, and the SQ elision marks find no SQ partner, survive unmatched, and `apostrophe` renders them U+2019. A PORT WITH ONE SHARED STACK PRODUCES `She said \"it’s the “90s” and left.` — the `'` of `'90s` is canClose, it pops the opening `\"`, and the real closing `\"` is stranded. That is damage rather than a miss (§5.5 calls it a release blocker). Contrast the `rock 'n' roll` case, which is a MEDIAL elision between two SQ marks, not this rule's leading/trailing single-mark elision shape — see en-us-quotes-rock-n-roll for how spec 0.5.0's general ambiguous-medial-span veto handles that different shape. History: before the per-kind stack split landed (pre-0.3.0), this exact case's canonical fixture asserted the single-shared-stack damage shown above (the stranded-quote output) as its expected `out` — a previous implementation defect, not a documented limitation; the two-stack design fixed it, and the `out` actually asserted above (the correct, two-stack form) has been correct ever since." + "note": "quotes.md §3.3 and §5.5: pass 2 keeps TWO STACKS, one per kind, and a candidate only ever touches the stack for its own kind — no reader opens with `\"` and closes with `'`, in any language. So the two DQ marks pair with each other, and the SQ elision marks find no SQ partner, survive unmatched, and `apostrophe` renders them U+2019. A PORT WITH ONE SHARED STACK PRODUCES `She said \"it’s the “90s” and left.` — the `'` of `'90s` is canClose, it pops the opening `\"`, and the real closing `\"` is stranded. That is damage rather than a miss (§5.5 calls it a release blocker). Contrast the `rock 'n' roll` case, which is a MEDIAL elision between two SQ marks, not this rule's leading/trailing single-mark elision shape — see en-us-quotes-rock-n-roll for how spec 1.1.0's universal medial-n veto handles that different shape. History: before the per-kind stack split landed (pre-0.3.0), this exact case's canonical fixture asserted the single-shared-stack damage shown above (the stranded-quote output) as its expected `out` — a previous implementation defect, not a documented limitation; the two-stack design fixed it, and the `out` actually asserted above (the correct, two-stack form) has been correct ever since." }, { "id": "en-us-quotes-adjacent-to-punctuation", @@ -1653,47 +1653,47 @@ "mode": "text", "in": "rock ’n’ roll", "out": "rock ’n’ roll", - "note": "quotes.md §3.2/§5, §6 row P4: U+2019 is NARROW, so the veto fires identically on already-correct input — a fixed point. Discharges the idempotency argument's second-pipeline-pass case for this construction." + "note": "quotes.md §3.2/§5: U+2019 is NARROW, so the veto fires identically on already-correct input — a fixed point. This is the witness for spec 1.1.0's widening of the predicate from straight ASCII to the whole NARROW class, which is an idempotency obligation rather than a preference: the veto now lets apostrophe CONVERT both marks, so a straight-ASCII-only predicate would not recognise its own output and pass 2 would pair rock ’n’ roll as an ordinary NARROW quotation on the next pipeline run. See ru-quotes-rock-n-roll-already-curly and fi-quotes-rock-n-roll-already-curly, which fail loudly under a straight-only predicate where this en-US case would not." }, { - "id": "en-us-quotes-letter-n-not-elided", + "id": "en-us-quotes-letter-n-elided", "rule": "quotes", "mode": "text", "in": "The letter 'n' is common.", - "out": "The letter 'n' is common.", - "note": "quotes.md §3.2: no `left`/`right` context matches (\"letter\" is not \"rock\"), so the listed-idiom veto does not fire — but 'n' (1 letter, space-flanked) is preserved by the general ambiguous-medial-span veto regardless (quotes.md §3.2), which does not require a citable idiom, only the structural shape. Pinned because this exact input was falsely elided by the first, context-free `elisionForms` design (spec 0.4.0, withdrawn before release) — see quotes.md §7 item 8. Contrast en-us-quotes-rock-n-roll, where the full left/elided/right context does match a cited idiom and apostrophe independently converts both marks." + "out": "The letter ’n’ is common.", + "note": "quotes.md §3.2, §6 row N1: no left/right context matches (\"letter\" is not \"rock\"), so the listed-idiom veto does not fire — but the universal medial-n veto does, and apostrophe converts both marks. **This is spec 1.1.0's accepted false positive**: a genuine quotation of the letter n comes out as an elision. It is pinned precisely because it is the input that sank the context-free `elisionForms` design in 0.4.0; 1.1.0 accepts it deliberately, against the measured alternative recorded in quotes.md §7 item 8 — spec 0.5.0 avoided this one case by declining every short quotation in every locale, a far larger error class. Through spec 0.5.0 this case asserted the unconverted input and was named en-us-quotes-letter-n-not-elided." }, { - "id": "en-us-quotes-nested-quote-n-not-elided", + "id": "en-us-quotes-nested-quote-n-elided", "rule": "quotes", "mode": "text", "in": "He said \"press 'n' now\".", - "out": "He said “press 'n' now”.", - "note": "quotes.md §3.2: same reason as en-us-quotes-letter-n-not-elided (\"press\" is not \"rock\"), nested one level deeper inside a resolved outer quotation. The inner 'n' (1 letter, space-flanked) is preserved by the general ambiguous-medial-span veto — quotes.md §3.2's predicate is local to the mark's own immediate neighbours, not aware of enclosing pairs, so nesting depth is irrelevant to it. Also pinned as a regression witness for the withdrawn context-free `elisionForms` design (quotes.md §7 item 8)." + "out": "He said “press ’n’ now”.", + "note": "quotes.md §3.2, §6 row N2: the same shape as en-us-quotes-letter-n-elided, one level deeper inside a resolved outer quotation. §3.2's predicate reads a mark's immediate neighbours and knows nothing of enclosing pairs, so nesting depth never reaches it and the inner marks are converted while the outer pair resolves normally. The second half of spec 1.1.0's accepted false positive, pinned for the same reason. Through spec 0.5.0 this case asserted the unconverted inner marks and was named en-us-quotes-nested-quote-n-not-elided." }, { - "id": "en-us-quotes-rock-n-pop-not-elided", + "id": "en-us-quotes-rock-n-pop-elided", "rule": "quotes", "mode": "text", "in": "rock 'n' pop", - "out": "rock 'n' pop", - "note": "quotes.md §3.2, §6 row N3: `right` is \"pop\", not \"roll\" — no configured idiom matches. 'n' (1 letter, space-flanked) is preserved by the general ambiguous-medial-span veto instead (quotes.md §3.2), which does not require a citable idiom to fire, only the structural shape — a documented false negative rather than a pairing." + "out": "rock ’n’ pop", + "note": "quotes.md §3.2, §6 row N3: `right` is \"pop\", not \"roll\", so no configured idiom matches — and since spec 1.1.0 none is needed. The universal medial-n veto fires on the bare medial n and apostrophe converts both marks. Named en-us-quotes-rock-n-pop-not-elided through spec 0.5.0, when the same input was preserved unconverted." }, { - "id": "en-us-quotes-fish-n-chips-not-elided", + "id": "en-us-quotes-fish-n-chips-elided", "rule": "quotes", "mode": "text", "in": "fish 'n' chips", - "out": "fish 'n' chips", - "note": "quotes.md §3.2, §6 row N4: not sourced or listed. en-US.json's AHD citation attests only rock/n/roll; no { left: \"fish\", elided: \"n\", right: \"chips\" } entry exists. 'n' is preserved by the general ambiguous-medial-span veto instead (quotes.md §3.2), the same mechanism as en-us-quotes-rock-n-pop-not-elided — no idiom is required for it to fire." + "out": "fish ’n’ chips", + "note": "quotes.md §3.2, §6 row N4: en-US.json's AHD citation attests only rock/n/roll, and no { left: \"fish\", elided: \"n\", right: \"chips\" } entry exists — the universal medial-n veto covers it anyway, which is the practical reason spec 1.1.0 stopped requiring a citation per phrase: the long tail of X 'n' Y borrowings cannot be enumerated one citation at a time. Named en-us-quotes-fish-n-chips-not-elided through spec 0.5.0." }, { - "id": "en-us-quotes-rock-cap-n-roll-not-elided", + "id": "en-us-quotes-rock-cap-n-roll-elided", "rule": "quotes", "mode": "text", "in": "rock 'N' roll", - "out": "rock 'N' roll", - "note": "quotes.md §3.2, §6 row N5: `elided` is matched exactly, with no case leniency at all — the first-code-point leniency applies only to `left`/`right`. `N` ≠ `n`, so no idiom matches (the en-US elisionIdioms entry requires exactly lower-case \"n\"). 'N' is preserved by the general ambiguous-medial-span veto instead (quotes.md §3.2), which is case-insensitive to the enclosed letter — this fixture is the witness that idiom-matching stays case-sensitive even though the general veto covering the same bytes is not." + "out": "rock ’N’ roll", + "note": "quotes.md §3.2, §6 row N5: `elided` is matched exactly by the LISTED mechanism, with no case leniency at all — the first-code-point leniency applies only to left/right — so `N` ≠ `n` still fails the cited en-US idiom. The universal medial-n veto matches U+004E as well as U+006E and converts both marks. This fixture is the witness that idiom-matching stays case-sensitive even though the veto covering the same bytes is not. Named en-us-quotes-rock-cap-n-roll-not-elided through spec 0.5.0." }, { "id": "en-us-quotes-rock-n-roll-html", @@ -1708,16 +1708,16 @@ "rule": "quotes", "mode": "html", "in": "

rock 'n' roll

", - "out": "

rock 'n' roll

", - "note": "quotes.md §3.2, §6 row H1: modes.md §3.2's boundary marker is not INLINE-SPACE, so `left`'s word is unreachable across the span boundary and the veto does not fire — matches text mode's own boundary behaviour on split input. spec 0.5.0: the general ambiguous-medial-span veto's left-context test only reads the single INLINE-SPACE code point immediately before the mark (quotes.md 3.2), which sits inside the same prose span as the mark itself — unlike idiom word-matching (wordEndsAt), it does not need to see past the span-boundary marker to \"rock\" in the preceding span, so it fires here even though the idiom match (pre-0.5.0 behaviour, still correctly not firing) does not." + "out": "

rock ’n’ roll

", + "note": "quotes.md §3.2, §6 row H1: modes.md §3.2's boundary marker is not INLINE-SPACE, so `left`'s word is unreachable across the span boundary and the LISTED idiom does not match. The universal medial-n veto (spec 1.1.0) reads no context word at all — only the enclosed code point and the single space immediately outside each mark, both of which sit in the same prose span as the marks — so it fires here and apostrophe converts both marks, converging with the unsplit en-us-quotes-rock-n-roll-html. Through spec 0.5.0 this case asserted the unconverted input." }, { "id": "en-us-quotes-rock-n-roll-html-right-split", "rule": "quotes", "mode": "html", "in": "

rock 'n' roll

", - "out": "

rock 'n' roll

", - "note": "quotes.md §3.2, §6 row H2: mirror case on `right`. spec 0.5.0: symmetric case to the left-split row above — the general veto's right-context test reads the INLINE-SPACE immediately after the mark, inside the same span, and fires regardless of \"roll\" sitting in a following span." + "out": "

rock ’n’ roll

", + "note": "quotes.md §3.2, §6 row H2: the mirror of en-us-quotes-rock-n-roll-html-left-split, with `right`'s word inside the following span. modes.md §3.2's boundary marker is not INLINE-SPACE, so `right` is unreachable and the LISTED idiom does not match. The universal medial-n veto (spec 1.1.0) reads no context word at all — only the enclosed code point and the single space immediately outside each mark, both in the same prose span as the marks — so it fires and apostrophe converts both, converging with the unsplit en-us-quotes-rock-n-roll-html. Through spec 0.5.0 this case asserted the unconverted input." }, { "id": "en-us-quotes-rock-n-roll-markdown-left-split", @@ -1725,32 +1725,32 @@ "mode": "markdown", "dialect": "commonmark", "in": "*rock* 'n' roll\n", - "out": "*rock* 'n' roll\n", - "note": "quotes.md §3.2, §6 row H3: `left`'s word sits inside an emphasis span; the boundary marker between spans is not INLINE-SPACE, so the veto does not cross it. spec 0.5.0: same mechanism as the HTML left-split row — Markdown emphasis creates a span boundary before \"rock\", but the general veto's left-context test only needs the immediately-preceding INLINE-SPACE, which is in the same span as the mark." + "out": "*rock* ’n’ roll\n", + "note": "quotes.md §3.2, §6 row H3: `left`'s word sits inside an emphasis span, so the LISTED idiom's word-boundary test cannot reach it across the span marker (modes.md §3.2) and no idiom matches. The universal medial-n veto (spec 1.1.0) needs no context word — the mark's own immediately-preceding INLINE-SPACE is in the same span as the mark — so it fires and apostrophe converts both marks, matching text mode on the same characters split the same way. Through spec 0.5.0 this case asserted the unconverted input." }, { "id": "en-us-quotes-ambiguous-single-letter", "rule": "quotes", "mode": "text", "in": "She chose 'A' today", - "out": "She chose 'A' today", - "note": "spec 0.5.0, general ambiguous-medial-span veto (quotes.md 3.2): 1 LETTER enclosed, space-flanked on both sides, no matching elisionIdioms entry — preserved as literal U+0027 on both marks. A documented false negative: this reads as a plausible genuine quotation of the letter A, but the structural predicate cannot distinguish it from rock 'n' roll's shape without reasoning about meaning, which is out of scope (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1: false negatives are preferable to text damage)." + "out": "She chose “A” today", + "note": "spec 1.1.0, quotes.md §3.2: 'A' is a single quoted letter and pairs as an ordinary quotation. Under spec 0.5.0 the general ambiguous-medial-span veto preserved it as literal U+0027, because its shape test admitted any 1 to 3 LETTER code points and could not tell this from rock 'n' roll. This fixture flipped role in 1.1.0: it pinned that veto's reach, and now pins that the replacement veto does NOT reach a span whose enclosed code point is not n or N." }, { "id": "en-us-quotes-ambiguous-two-letter", "rule": "quotes", "mode": "text", "in": "They said 'no' yesterday", - "out": "They said 'no' yesterday", - "note": "spec 0.5.0, general ambiguous-medial-span veto: 2 LETTERs enclosed, same reasoning as en-us-quotes-ambiguous-single-letter." + "out": "They said “no” yesterday", + "note": "spec 1.1.0, quotes.md §3.2: 2 letters enclosed — not a medial n, so the universal veto does not fire and the span pairs as an ordinary quotation. Same reasoning and same role reversal as en-us-quotes-ambiguous-single-letter." }, { "id": "en-us-quotes-ambiguous-three-letter", "rule": "quotes", "mode": "text", "in": "say 'yes' now", - "out": "say 'yes' now", - "note": "spec 0.5.0, general ambiguous-medial-span veto: 3 LETTERs enclosed — the upper bound of the shape (quotes.md 3.2, MAX_ENCLOSED). Preserved." + "out": "say “yes” now", + "note": "spec 1.1.0, quotes.md §3.2: 3 letters enclosed — the upper bound of spec 0.5.0's withdrawn shape test, kept as a fixture precisely because it was that test's boundary case. The universal medial-n veto does not fire, and the span pairs as an ordinary quotation." }, { "id": "en-us-quotes-ambiguous-four-letter-not-caught", @@ -1765,8 +1765,8 @@ "rule": "quotes", "mode": "text", "in": "say '𐐀' now", - "out": "say '𐐀' now", - "note": "spec 0.5.0: the enclosed code point is U+10400 (DESERET CAPITAL LETTER LONG A, astral plane) — general category Lu, a member of LETTER. The veto's LETTER test (engine/unicode.js isLetter) operates on full code points, not UTF-16 units, so this is treated identically to an ASCII letter and preserved." + "out": "say “𐐀” now", + "note": "spec 1.1.0, quotes.md §3.2: a single astral-plane LETTER (U+10400, two UTF-16 units, one code point). It pairs as an ordinary quotation because it is not n or N — the veto compares code points, so an astral letter is neither specially admitted nor specially excluded. Retained from spec 0.5.0, where it pinned that the withdrawn shape test counted code points rather than UTF-16 units; the code-point discipline it tests (ARCHITECTURE.md §4.2) is unchanged." }, { "id": "en-us-quotes-ambiguous-digit-not-letter", @@ -1774,7 +1774,7 @@ "mode": "text", "in": "say '12' now", "out": "say “12” now", - "note": "spec 0.5.0: the enclosed code points are DIGIT, not LETTER, so the general ambiguous-medial-span veto does not fire — digits must not accidentally qualify as a LETTER sequence (quotes.md 3.2). Pairs as an ordinary quotation exactly as before 0.5.0." + "note": "spec 1.1.0, quotes.md §3.2: the enclosed code points are digits, not n or N, so the veto does not fire and the span pairs as an ordinary quotation. This output has been constant across 0.5.0 and 1.1.0 — under 0.5.0 because digits were not LETTER, now because they are not the one code point the veto matches." }, { "id": "en-us-quotes-ambiguous-punctuation-not-letter", @@ -1790,7 +1790,7 @@ "mode": "text", "in": "She chose ’A’ today", "out": "She chose “A” today", - "note": "spec 0.5.0: the general ambiguous-medial-span veto matches straight ASCII U+0027 pairs only (quotes.md 3.2) — an already-curly U+2019 pair is out of its scope by construction, so this falls through to ordinary NARROW-pair quotation exactly as it did before 0.5.0. Documents the chosen contract deliberately, so the ASCII-only scope is not silently broadened later." + "note": "spec 1.1.0, quotes.md §3.2: 'A' is not n or N, so the veto does not fire and the already-curly pair is re-typeset as an ordinary quotation. **The reason this output is unchanged is not the reason it was unchanged in 0.5.0.** 0.5.0's veto matched straight ASCII U+0027 only, so a curly pair was out of scope by construction; 1.1.0's matches the whole NARROW class — an idempotency obligation, since the veto now produces U+2019 — and declines this span on its enclosed code point instead. See en-us-quotes-rock-n-roll-already-curly for a curly pair the veto does match." }, { "id": "en-us-ranges-decimal-and-path-rejected", diff --git a/vendor/polytypo-spec/fixtures/fi.json b/vendor/polytypo-spec/fixtures/fi.json index c2e0899..9316eed 100644 --- a/vendor/polytypo-spec/fixtures/fi.json +++ b/vendor/polytypo-spec/fixtures/fi.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "fi", "cases": [ { @@ -752,8 +752,16 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "quotes.md §7.1, recorded as a known defect: the two elision marks pair at depth 1 and take the Finnish primary glyphs. spec 0.5.0: fi's own dictionary writes this loanword closed up (rock'n'roll, no spaces) — quotes.md §7 item 8 — so a citation for the spaced form would be evidenced-inert and none was added. The general ambiguous-medial-span veto now preserves the spaced ASCII input as-is rather than pairing it as an ordinary quotation, which is the pre-0.5.0 behaviour this fixture used to assert." + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs. fi's own dictionary writes this loanword closed up (rock'n'roll), so a citation for the spaced form would have been evidenced-inert and none was ever added — quotes.md §7 item 8. The universal veto covers the spaced form regardless, which is the point of moving the mechanism out of locale data. See fi-quotes-rock-n-roll-already-curly for the second-pass fixed point this output depends on." + }, + { + "id": "fi-quotes-rock-n-roll-already-curly", + "rule": "quotes", + "mode": "text", + "in": "rock ’n’ roll", + "out": "rock ’n’ roll", + "note": "quotes.md §3.2, the sharpest regression witness for spec 1.1.0's widening of the veto to the whole NARROW class: fi's SECONDARY pair is U+2019 on both sides, so the marks this rule's own output leaves behind are indistinguishable from fi's own prescribed nested-quotation glyphs. A port that matches U+0027 only does not recognise them, pairs them, and turns the output of fi-quotes-rock-n-roll into `rock ”n” roll` — fi's primary pair at depth 1. Companion to ru-quotes-rock-n-roll-already-curly, which fails the same way in a locale whose primary is WIDE; both are measured, not hypothesised." }, { "id": "fi-quotes-already-correct", diff --git a/vendor/polytypo-spec/fixtures/fr-CA.json b/vendor/polytypo-spec/fixtures/fr-CA.json index 02ccdff..b54b53a 100644 --- a/vendor/polytypo-spec/fixtures/fr-CA.json +++ b/vendor/polytypo-spec/fixtures/fr-CA.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "fr-CA", "cases": [ { @@ -80,8 +80,8 @@ "rule": "quotes", "mode": "text", "in": "\"Il a dit 'oui' hier.\"", - "out": "« Il a dit 'oui' hier. »", - "note": "spec 0.5.0: same as fr-quotes-nested — 'oui' is preserved by the general ambiguous-medial-span veto." + "out": "« Il a dit “oui” hier. »", + "note": "spec 1.1.0: same as fr-quotes-nested — the inner 'oui' pairs as a nested quotation again now that the veto matches only a medial n (quotes.md §3.2), where 0.5.0's shape test preserved every 1-to-3-letter span." }, { "id": "fr-ca-apostrophe-elision", @@ -250,8 +250,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "spec 0.5.0: fr-CA has no cited quotes.elisionIdioms entry for this idiom (quotes.md §7 item 8 — only en-US does, via Chicago Manual of Style Online and the American Heritage Dictionary). The general ambiguous-medial-span veto (quotes.md 3.2) preserves both marks as literal U+0027 rather than pairing them as an ordinary quotation, closing the false positive AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1 named for \"equivalent cases in several locales.\"" + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs." }, { "id": "fr-ca-ranges-none", diff --git a/vendor/polytypo-spec/fixtures/fr.json b/vendor/polytypo-spec/fixtures/fr.json index 0af61e2..e8ac883 100644 --- a/vendor/polytypo-spec/fixtures/fr.json +++ b/vendor/polytypo-spec/fixtures/fr.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "fr", "cases": [ { @@ -235,8 +235,8 @@ "rule": "quotes", "mode": "text", "in": "\"Il a dit 'oui' hier.\"", - "out": "« Il a dit 'oui' hier. »", - "note": "Depth 1 primary « », depth 2 secondary “ ” whose innerSpace is none. spec 0.5.0: the inner 'oui' (3 letters, space-flanked) is preserved by the general ambiguous-medial-span veto — fr has no elisionIdioms entry for this shape." + "out": "« Il a dit “oui” hier. »", + "note": "Depth 1 primary « », depth 2 secondary “ ” whose innerSpace is none. spec 1.1.0: the inner 'oui' pairs again — 0.5.0's general ambiguous-medial-span veto had preserved it as literal U+0027 for being 3 letters and space-flanked, and the universal medial-n veto that replaced it matches only a single n (quotes.md §3.2)." }, { "id": "fr-quotes-unbalanced", @@ -585,8 +585,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "spec 0.5.0: fr has no cited quotes.elisionIdioms entry for this idiom (quotes.md §7 item 8 — only en-US does, via Chicago Manual of Style Online and the American Heritage Dictionary). The general ambiguous-medial-span veto (quotes.md 3.2) preserves both marks as literal U+0027 rather than pairing them as an ordinary quotation, closing the false positive AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1 named for \"equivalent cases in several locales.\"" + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs." }, { "id": "fr-ranges-none", diff --git a/vendor/polytypo-spec/fixtures/locale-resolution.json b/vendor/polytypo-spec/fixtures/locale-resolution.json index a8d8333..e46ae2e 100644 --- a/vendor/polytypo-spec/fixtures/locale-resolution.json +++ b/vendor/polytypo-spec/fixtures/locale-resolution.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "cases": [ { "id": "exact-en-us", diff --git a/vendor/polytypo-spec/fixtures/ru.json b/vendor/polytypo-spec/fixtures/ru.json index 87ef17c..7c81154 100644 --- a/vendor/polytypo-spec/fixtures/ru.json +++ b/vendor/polytypo-spec/fixtures/ru.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "ru", "cases": [ { @@ -323,8 +323,8 @@ "rule": "quotes", "mode": "text", "in": "Он сказал: \"это 'моё' дело\".", - "out": "Он сказал: «это 'моё' дело».", - "note": "quotes.md §6 case 14: depth 1 takes the ёлочки « », depth 2 the лапки „ “ — Лопатин 2006. Note the secondary pair's closing glyph is U+201C, which is in OPENISH; the class says nothing about the role. spec 0.5.0: the inner 'моё' (3 Cyrillic letters, space-flanked) is preserved by the general ambiguous-medial-span veto, which reads Unicode LETTER generally, not only ASCII — ru has no elisionIdioms entry for this shape." + "out": "Он сказал: «это „моё“ дело».", + "note": "quotes.md §6 case 14: depth 1 takes the ёлочки « », depth 2 the лапки „ “ — Лопатин 2006. Note the secondary pair's closing glyph is U+201C, which is in OPENISH; the class says nothing about the role. spec 1.1.0: the inner 'моё' pairs as a nested quotation again. Under 0.5.0 the general ambiguous-medial-span veto preserved it as literal U+0027 for being 3 LETTER code points and space-flanked — a count that also depended on the input's normalization form, since LETTER includes Mn and the decomposed ё is two code points. The universal medial-n veto that replaced it compares one code point against a fixed pair (quotes.md §3.2) and has neither problem." }, { "id": "ru-quotes-roundtrip", @@ -681,8 +681,16 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "spec 0.5.0: ru has no cited quotes.elisionIdioms entry for this idiom (quotes.md §7 item 8 — only en-US does, via Chicago Manual of Style Online and the American Heritage Dictionary). The general ambiguous-medial-span veto (quotes.md 3.2) preserves both marks as literal U+0027 rather than pairing them as an ordinary quotation, closing the false positive AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 3.1 named for \"equivalent cases in several locales.\"" + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs. See ru-quotes-rock-n-roll-already-curly for the second-pass fixed point this output depends on." + }, + { + "id": "ru-quotes-rock-n-roll-already-curly", + "rule": "quotes", + "mode": "text", + "in": "rock ’n’ roll", + "out": "rock ’n’ roll", + "note": "quotes.md §3.2, the regression witness for spec 1.1.0's widening of the veto from straight ASCII to the whole NARROW class. This is the output of ru-quotes-rock-n-roll fed back in, so it is that case's idempotency obligation made explicit — and it is the case a naive implementation gets wrong. A port that matches U+0027 only (as spec 0.5.0's withdrawn predicate did, correctly for its own preserve-then-stop outcome) does not recognise the U+2019 marks it just produced: the pair falls through to ordinary NARROW quotation and this input becomes `rock «n» roll`, ru's primary pair at depth 1. Measured, not hypothesised. `apostrophe` emits U+2019 only in place of U+0027 (apostrophe.md §1), so once the veto matches, nothing edits these marks and the form is stable." } ] } diff --git a/vendor/polytypo-spec/fixtures/sv.json b/vendor/polytypo-spec/fixtures/sv.json index fa23875..dc4318d 100644 --- a/vendor/polytypo-spec/fixtures/sv.json +++ b/vendor/polytypo-spec/fixtures/sv.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "locale": "sv", "cases": [ { @@ -752,8 +752,8 @@ "rule": "quotes", "mode": "text", "in": "rock 'n' roll", - "out": "rock 'n' roll", - "note": "quotes.md §7.1, a known defect: the elision marks pair at depth 1 and take the Swedish primary glyphs. spec 0.5.0: same reasoning as fi-quotes-rock-n-roll — sv also writes the loanword closed up, no citation exists for the spaced form, and the general ambiguous-medial-span veto now preserves the ASCII input." + "out": "rock ’n’ roll", + "note": "spec 1.1.0, quotes.md §3.2's universal medial-n elision veto: by operator decision the idiom is international, so `quotes` declines the pairing in every locale rather than only where a cited quotes.elisionIdioms entry exists, and `apostrophe` (order 50) converts each mark by its own case ladder — leading elision (apostrophe.md §3.3 case 4), then trailing elision (case 3). Same output and same two case decisions as en-us-quotes-rock-n-roll, which reaches them through the cited idiom instead. History: spec 0.5.0's general ambiguous-medial-span veto preserved both marks here as literal U+0027; before 0.5.0 `quotes` paired them as an ordinary depth-1 quotation in this locale's primary glyphs. sv writes the loanword closed up in its own dictionaries, exactly as fi does, so no spaced-form citation exists here either — see fi-quotes-rock-n-roll." }, { "id": "sv-quotes-already-correct", diff --git a/vendor/polytypo-spec/locales/registry.json b/vendor/polytypo-spec/locales/registry.json index acf2e7f..9da2ded 100644 --- a/vendor/polytypo-spec/locales/registry.json +++ b/vendor/polytypo-spec/locales/registry.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "$comment": "Locale resolution input. Algorithm is specified in spec/rules/locale-resolution.md and is identical in every runtime — never delegate it to a platform locale-negotiation library. \"spec\" here must track spec/VERSION exactly — it is not itself the global version source; scripts/validate-spec.mjs enforces the match.", "locales": ["en-US", "en-GB", "de-DE", "de-CH", "fr", "fr-CA", "ru", "fi", "sv", "el"], "aliases": { diff --git a/vendor/polytypo-spec/rules/order.json b/vendor/polytypo-spec/rules/order.json index a59f968..73fb107 100644 --- a/vendor/polytypo-spec/rules/order.json +++ b/vendor/polytypo-spec/rules/order.json @@ -1,5 +1,5 @@ { - "spec": "1.0.0", + "spec": "1.1.0", "$comment": "Single source of truth for pipeline order. Rules run in ascending `order`. Disabling a rule removes it from the sequence and never reorders the rest. Rule ids are public API (see docs/ARCHITECTURE.md section 5). \"spec\" here must track spec/VERSION exactly — it is not itself the global version source; scripts/validate-spec.mjs enforces the match.", "rules": [ { @@ -48,15 +48,15 @@ "default": "on", "modes": ["text", "html", "markdown"], "localeData": ["quotes"], - "summary": "Straight quotes to locale primary/secondary pairs with nesting resolution. Runs before `apostrophe` so that a straight apostrophe is still available as quote evidence. Declines to pair an ambiguous medial short single-quoted span (spec 0.5.0) unless a cited `quotes.elisionIdioms` entry matches." + "summary": "Straight quotes to locale primary/secondary pairs with nesting resolution. Runs before `apostrophe` so that a straight apostrophe is still available as quote evidence. Declines to pair a medial single-quoted `n` (spec 1.1.0, every locale) or a span matching a cited `quotes.elisionIdioms` entry, so that `apostrophe` converts both marks instead." }, { "id": "apostrophe", "order": 50, "default": "on", "modes": ["text", "html", "markdown"], - "localeData": ["quotes"], - "summary": "Remaining straight apostrophes to U+2019 without corrupting contractions. As of spec 0.5.0, also reads `quotes.elisionIdioms` (indirectly, via the shared ambiguity predicate) to keep a straight-ASCII mark `quotes` deliberately preserved from being independently curled by this rule's own structural case ladder." + "localeData": [], + "summary": "Remaining straight apostrophes to U+2019 without corrupting contractions. Reads no locale data: spec 0.5.0's `quotes.elisionIdioms` lookup existed only for the preserve set withdrawn in spec 1.1.0, so every mark `quotes` declined to claim now reaches this rule's ordinary structural case ladder." }, { "id": "symbols",