@@ -147,28 +147,29 @@ export default function (context) {
147
147
148
148
// ignorePatternにマッチしたらmatchFnを呼ばないようにする(エラーを無視する)
149
149
let ignoreWhenMatched = ( ignorePattern , matchFn ) => {
150
- return ( text , pattern , match ) => {
151
- if ( ignorePattern . test ( text ) ) {
152
- return null ;
153
- } else {
154
- return matchFn ( text , pattern , match ) ;
150
+ return ( text , pattern , match ) => {
151
+ if ( ignorePattern . test ( text ) ) {
152
+ return null ;
153
+ } else {
154
+ return matchFn ( text , pattern , match ) ;
155
+ }
155
156
}
156
- }
157
- }
157
+ } ;
158
158
159
- // 数えられる数字は算用数字を使う
159
+ // * 数えられる数字は算用数字を使う
160
160
// 数十万、数百億にマッチしないように"数"という文字から始まるものは除外
161
+ // https://github.com/azu/textlint-plugin-JTF-style/pull/23
161
162
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) [ 兆 億 万 ] / g,
162
- ignoreWhenMatched ( / 数 ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) [ 兆 億 万 ] / g , toNumber )
163
+ ignoreWhenMatched ( / 数 ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) [ 兆 億 万 ] / g, toNumber )
163
164
) ;
164
165
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) つ / g, toNumber ) ;
165
166
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 回 / g, toNumber ) ;
166
167
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) か 月 / g, toNumber ) ;
167
168
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 番 目 / g, toNumber ) ;
168
169
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 進 法 / g, toNumber ) ;
169
170
matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 次 元 / g, toNumber ) ;
170
- // 漢数字を使う
171
- // 慣用的表現、熟語、概数、固有名詞、副詞など、漢数字を使用することが一般的な語句では漢数字を使いま す 。
171
+ // * 漢数字を使う
172
+ // 慣用的表現、熟語、概数、固有名詞、副詞など、漢数字を使用することが一般的な語句では漢数字を使います 。
172
173
matchToReplace ( text , / 世 界 ( 1 ) / g, toKanNumber ) ;
173
174
matchToReplace ( text , / ( 1 ) 時 的 / g, toKanNumber ) ;
174
175
matchToReplace ( text , / ( 1 ) 部 分 / g, toKanNumber ) ;
@@ -178,6 +179,7 @@ export default function (context) {
178
179
matchToReplace ( text , / ( 1 ) 番 に / g, toKanNumber ) ;
179
180
matchToReplace ( text , / 数 ( [ 0 - 9 ] + ) 倍 / g, toKanNumber ) ;
180
181
matchToReplace ( text , / 数 ( [ 0 - 9 ] + ) [ 兆 億 万 ] / g, toKanNumber ) ;
182
+ matchToReplace ( text , / 数 ( [ 0 - 9 ] + ) 年 / g, toKanNumber ) ;
181
183
matchToReplace ( text , / ( [ 0 - 9 ] + ) 次 関 数 / g, toKanNumber ) ;
182
184
matchToReplace ( text , / ( 5 ) 大 陸 / g, toKanNumber ) ;
183
185
}
0 commit comments