@@ -39,12 +39,14 @@ const defaultOptions = {
39
39
min_interval : 1 ,
40
40
strict : false
41
41
} ;
42
+
43
+
42
44
export default function ( context , options = { } ) {
43
45
const helper = new RuleHelper ( context ) ;
44
46
// 最低間隔値
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 ;
48
50
return {
49
51
[ Syntax . Paragraph ] ( node ) {
50
52
if ( helper . isChildNode ( node , [ Syntax . Link , Syntax . Image , Syntax . BlockQuote , Syntax . Emphasis ] ) ) {
@@ -89,21 +91,18 @@ export default function (context, options = {}) {
89
91
// if difference
90
92
let differenceIndex = otherPosition - startPosition ;
91
93
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 ) ;
97
94
let originalPosition = source . originalPositionFor ( {
98
95
line : sentence . loc . start . line ,
99
96
column : sentence . loc . start . column + ( current . word_position - 1 )
100
97
} ) ;
101
- report ( node , new RuleError ( `一文に二回以上利用されている助詞 "${ key } " がみつかりました。` , {
98
+ // padding position
99
+ var padding = {
102
100
line : originalPosition . line - 1 ,
103
101
// matchLastToken.word_position start with 1
104
102
// this is padding column start with 0 (== -1)
105
103
column : originalPosition . column
106
- } ) ) ;
104
+ } ;
105
+ report ( node , new RuleError ( `一文に二回以上利用されている助詞 "${ key } " がみつかりました。` , padding ) ) ;
107
106
}
108
107
return current ;
109
108
} ) ;
0 commit comments