Double arrow support `↔` (#20288)
This commit is contained in:
parent
afdb4a084a
commit
14a447175b
|
@ -1640,6 +1640,8 @@ var bar = 'bar';
|
||||||
assert.cookedOptions("a --> b", enabledTypographer, "<p>a \u2192 b</p>");
|
assert.cookedOptions("a --> b", enabledTypographer, "<p>a \u2192 b</p>");
|
||||||
assert.cookedOptions("-->", enabledTypographer, "<p> \u2192 </p>");
|
assert.cookedOptions("-->", enabledTypographer, "<p> \u2192 </p>");
|
||||||
assert.cookedOptions("<--", enabledTypographer, "<p> \u2190 </p>");
|
assert.cookedOptions("<--", enabledTypographer, "<p> \u2190 </p>");
|
||||||
|
assert.cookedOptions("<->", enabledTypographer, "<p> \u2194 </p>");
|
||||||
|
assert.cookedOptions("<-->", enabledTypographer, "<p> \u2194 </p>");
|
||||||
|
|
||||||
// Don't replace arrows
|
// Don't replace arrows
|
||||||
assert.cookedOptions("<!-- an html comment -->", enabledTypographer, "");
|
assert.cookedOptions("<!-- an html comment -->", enabledTypographer, "");
|
||||||
|
@ -1648,7 +1650,6 @@ var bar = 'bar';
|
||||||
enabledTypographer,
|
enabledTypographer,
|
||||||
"<p>(<–not an arrow)</p>"
|
"<p>(<–not an arrow)</p>"
|
||||||
);
|
);
|
||||||
assert.cookedOptions("<-->", enabledTypographer, "<p><–></p>");
|
|
||||||
assert.cookedOptions("asd-->", enabledTypographer, "<p>asd–></p>");
|
assert.cookedOptions("asd-->", enabledTypographer, "<p>asd–></p>");
|
||||||
assert.cookedOptions(" asd--> ", enabledTypographer, "<p>asd–></p>");
|
assert.cookedOptions(" asd--> ", enabledTypographer, "<p>asd–></p>");
|
||||||
assert.cookedOptions(" asd-->", enabledTypographer, "<p>asd–></p>");
|
assert.cookedOptions(" asd-->", enabledTypographer, "<p>asd–></p>");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// ... → … (also ?.... → ?.., !.... → !..)
|
// ... → … (also ?.... → ?.., !.... → !..)
|
||||||
// ???????? → ???, !!!!! → !!!, `,,` → `,`
|
// ???????? → ???, !!!!! → !!!, `,,` → `,`
|
||||||
// -- → –, --- → —
|
// -- → –, --- → —
|
||||||
// --> <-- -> <- to → ← → ←
|
// --> <-- -> <- <-> <--> to → ← → ← ↔ ↔
|
||||||
// (pa) (PA) → ¶
|
// (pa) (PA) → ¶
|
||||||
//
|
//
|
||||||
// Disabled replacements:
|
// Disabled replacements:
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// (r) (R) → ®
|
// (r) (R) → ®
|
||||||
// (p) (P) -> §
|
// (p) (P) -> §
|
||||||
|
|
||||||
let RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--|-->|<--|->|<-/;
|
let RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--|-->|<--|->|<-|<->|<-->/;
|
||||||
|
|
||||||
let SCOPED_ABBR_RE = /\((tm|pa)\)/gi;
|
let SCOPED_ABBR_RE = /\((tm|pa)\)/gi;
|
||||||
let SCOPED_ABBR = {
|
let SCOPED_ABBR = {
|
||||||
|
@ -52,6 +52,7 @@ function replaceRare(inlineTokens) {
|
||||||
// Custom arrows
|
// Custom arrows
|
||||||
.replace(/(^|\s)-{1,2}>(\s|$)/gm, "\u0020\u2192\u0020")
|
.replace(/(^|\s)-{1,2}>(\s|$)/gm, "\u0020\u2192\u0020")
|
||||||
.replace(/(^|\s)<-{1,2}(\s|$)/gm, "\u0020\u2190\u0020")
|
.replace(/(^|\s)<-{1,2}(\s|$)/gm, "\u0020\u2190\u0020")
|
||||||
|
.replace(/(^|\s)<-{1,2}>(\s|$)/gm, "\u0020\u2194\u0020")
|
||||||
// .., ..., ....... -> …
|
// .., ..., ....... -> …
|
||||||
// but ?..... & !..... -> ?.. & !..
|
// but ?..... & !..... -> ?.. & !..
|
||||||
.replace(/\.{2,}/g, "…")
|
.replace(/\.{2,}/g, "…")
|
||||||
|
|
Loading…
Reference in New Issue