Comparing version 0.4.0 to 0.5.0
17
mojik.js
/*! | ||
* Mojik v0.4.0 https://github.com/terkel/mojik | ||
* Mojik v0.5.0 https://github.com/terkel/mojik | ||
* @author Takeru Suzuki http://terkel.jp/ | ||
@@ -23,2 +23,3 @@ * @license MIT http://opensource.org/licenses/MIT | ||
doubleDash: false, | ||
spaceInsideWesternBrackets: false, | ||
supportOldAndroid: false | ||
@@ -108,6 +109,6 @@ }; | ||
// 欧文始め括弧 | ||
westernOpeningBrackets: "‘“\\(\\[\\{<«‹", | ||
westernOpeningBrackets: "\\(\\[\\{“", | ||
// 欧文終わり括弧 | ||
westernClosingBrackets: "’”)]}>»›" | ||
westernClosingBrackets: "\\)\\]\\}”" | ||
}; | ||
@@ -147,2 +148,4 @@ | ||
var reConsecutiveDashes = new RegExp("([" + Mojik.characters.dashes + "])\\1+", "g"); | ||
var reStartWithWesternClosingBracket = new RegExp("^[" + Mojik.characters.westernClosingBrackets + "]"); | ||
var reEndWithWesternOpeningBracket = new RegExp("[" + Mojik.characters.westernOpeningBrackets + "]$"); | ||
var puncPairs = [ | ||
@@ -318,3 +321,5 @@ [Mojik.characters.japaneseClosingBrackets, | ||
// ダッシュまたはリーダーで始まる | ||
if (reStartWithDashOrLeader.test(match)) { | ||
if (reStartWithDashOrLeader.test(match) || | ||
(!options.spaceInsideWesternBrackets && reStartWithWesternClosingBracket.test(match)) | ||
) { | ||
hasNoSpaceBefore = true; | ||
@@ -324,3 +329,5 @@ } | ||
// ダッシュまたはリーダーで終わる | ||
if (reEndWithDashOrLeader.test(match)) { | ||
if (reEndWithDashOrLeader.test(match) || | ||
(!options.spaceInsideWesternBrackets && reEndWithWesternOpeningBracket.test(match)) | ||
) { | ||
hasNoSpaceAfter = true; | ||
@@ -327,0 +334,0 @@ } |
{ | ||
"name": "mojik", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Take control of Japanese typesetting on the web", | ||
@@ -5,0 +5,0 @@ "main": "mojik.js", |
@@ -61,2 +61,3 @@ # Mojik | ||
- `doubleDash`: ダッシュ(U+2014 EM DASHまたはU+2015 HORIZONTAL BAR)が2つ以上連続したとき、それらがつながっているように見せる(実際には1つのダッシュをCSSで横方向に拡大している)。デフォルトは`false` | ||
- `spaceInsideWesternBrackets`: 欧文括弧類(`()`、`[]`、`{}`、`“”`)の内側と和文の間にアキを持たせる。デフォルトは`false` | ||
- `supportOldAndroid`: Noto Sans CJKの入っていない、バージョン5までのAndroidをサポートするかどうか。デフォルトは`false`(参考:[#25](https://github.com/terkel/mojik/issues/25)) | ||
@@ -63,0 +64,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35906
587
68