@@ -147,28 +147,29 @@ export default function (context) {
147147
148148 // ignorePatternにマッチしたらmatchFnを呼ばないようにする(エラーを無視する)
149149 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+ }
155156 }
156- }
157- }
157+ } ;
158158
159- // 数えられる数字は算用数字を使う
159+ // * 数えられる数字は算用数字を使う
160160 // 数十万、数百億にマッチしないように"数"という文字から始まるものは除外
161+ // https://github.com/azu/textlint-plugin-JTF-style/pull/23
161162 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) [ 兆 億 万 ] / g,
162- ignoreWhenMatched ( / 数 ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) [ 兆 億 万 ] / g , toNumber )
163+ ignoreWhenMatched ( / 数 ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) [ 兆 億 万 ] / g, toNumber )
163164 ) ;
164165 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) つ / g, toNumber ) ;
165166 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 回 / g, toNumber ) ;
166167 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) か 月 / g, toNumber ) ;
167168 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 番 目 / g, toNumber ) ;
168169 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 進 法 / g, toNumber ) ;
169170 matchToReplace ( text , / ( [ 一 二 三 四 五 六 七 八 九 十 壱 弐 参 拾 百 〇 ] + ) 次 元 / g, toNumber ) ;
170- // 漢数字を使う
171- // 慣用的表現、熟語、概数、固有名詞、副詞など、漢数字を使用することが一般的な語句では漢数字を使いま す 。
171+ // * 漢数字を使う
172+ // 慣用的表現、熟語、概数、固有名詞、副詞など、漢数字を使用することが一般的な語句では漢数字を使います 。
172173 matchToReplace ( text , / 世 界 ( 1 ) / g, toKanNumber ) ;
173174 matchToReplace ( text , / ( 1 ) 時 的 / g, toKanNumber ) ;
174175 matchToReplace ( text , / ( 1 ) 部 分 / g, toKanNumber ) ;
@@ -178,6 +179,7 @@ export default function (context) {
178179 matchToReplace ( text , / ( 1 ) 番 に / g, toKanNumber ) ;
179180 matchToReplace ( text , / 数 ( [ 0 - 9 ] + ) 倍 / g, toKanNumber ) ;
180181 matchToReplace ( text , / 数 ( [ 0 - 9 ] + ) [ 兆 億 万 ] / g, toKanNumber ) ;
182+ matchToReplace ( text , / 数 ( [ 0 - 9 ] + ) 年 / g, toKanNumber ) ;
181183 matchToReplace ( text , / ( [ 0 - 9 ] + ) 次 関 数 / g, toKanNumber ) ;
182184 matchToReplace ( text , / ( 5 ) 大 陸 / g, toKanNumber ) ;
183185 }
0 commit comments