Skip to content

Commit

Permalink
Fixes left single quote identification (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
surfinzap committed Nov 2, 2019
1 parent 70ed3b4 commit f0aa78e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* mm x mm → mm⎵×⎵mm (abbreviations)
* Marciano x Clay → Marciano⎵×⎵Clay (words)

### Fixes
* Fixes left single quote identification ([Issue #22](https://github.com/surfinzap/typopo/issues/22))

## 2.3.1 // 2019-10-25
### Fixes
Expand Down
5 changes: 4 additions & 1 deletion src/lib/punctuation/single-quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export function fixSingleQuotesPrimesAndApostrophes(string, locale) {
string = string.replace(re, function($0, $1, $2, $3){

// identify {{typopo__left-single-quote--adept}}
let pattern = "([" + locale.spaces + "])(" + locale.singleQuoteAdepts + "|,)(["+ locale.allChars +"])";
let pattern =
"([" + locale.spaces + locale.emDash + locale.enDash + "])"
+ "(" + locale.singleQuoteAdepts + "|,)"
+ "(["+ locale.allChars +"])";
let re = new RegExp(pattern, "g");
$2 = $2.replace(re, "$1{{typopo__left-single-quote--adept}}$3");

Expand Down
2 changes: 2 additions & 0 deletions src/test/punctuation/single-quotes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ describe('Single quotes in default language (en-us)\n', () => {
"He said: “What about ‘name’ and ‘other name’?”",
"He said: “What about 'Localhost 3000', is that good?”":
"He said: “What about ‘Localhost 3000’, is that good?”",
"And I ask you: “What’s the idea behind this—how do you call it—'one size fits all' approach?”":
"And I ask you: “What’s the idea behind this—how do you call it—‘one size fits all’ approach?”",

/* Mixing quotes and primes, left for single quotes */
"12' 45″": "12′ 45″",
Expand Down

0 comments on commit f0aa78e

Please sign in to comment.