@@ -39,12 +39,14 @@ const defaultOptions = {
3939 min_interval : 1 ,
4040 strict : false
4141} ;
42+
43+
4244export default function ( context , options = { } ) {
4345 const helper = new RuleHelper ( context ) ;
4446 // 最低間隔値
45- let minInterval = options . min_interval || defaultOptions . min_interval ;
46- let isStrict = options . strict || defaultOptions . strict ;
47- let { Syntax, report, getSource, RuleError} = context ;
47+ const minInterval = options . min_interval || defaultOptions . min_interval ;
48+ const isStrict = options . strict || defaultOptions . strict ;
49+ const { Syntax, report, getSource, RuleError} = context ;
4850 return {
4951 [ Syntax . Paragraph ] ( node ) {
5052 if ( helper . isChildNode ( node , [ Syntax . Link , Syntax . Image , Syntax . BlockQuote , Syntax . Emphasis ] ) ) {
@@ -89,21 +91,18 @@ export default function (context, options = {}) {
8991 // if difference
9092 let differenceIndex = otherPosition - startPosition ;
9193 if ( differenceIndex <= minInterval ) {
92- console . log ( node ) ;
93- console . log ( text ) ;
94- console . log ( sentences ) ;
95- console . log ( sentence . loc ) ;
96- console . log ( current . word_position ) ;
9794 let originalPosition = source . originalPositionFor ( {
9895 line : sentence . loc . start . line ,
9996 column : sentence . loc . start . column + ( current . word_position - 1 )
10097 } ) ;
101- report ( node , new RuleError ( `一文に二回以上利用されている助詞 "${ key } " がみつかりました。` , {
98+ // padding position
99+ var padding = {
102100 line : originalPosition . line - 1 ,
103101 // matchLastToken.word_position start with 1
104102 // this is padding column start with 0 (== -1)
105103 column : originalPosition . column
106- } ) ) ;
104+ } ;
105+ report ( node , new RuleError ( `一文に二回以上利用されている助詞 "${ key } " がみつかりました。` , padding ) ) ;
107106 }
108107 return current ;
109108 } ) ;
0 commit comments