Closed io-monad closed 8 years ago
confirm txt-to-ast' bug
https://tonicdev.com/56e0d00573f4dc1100edb498/56e0d00573f4dc1100edb499
Str
Node of Document
should have raw
value, but it is missing.
{
"type": "Document",
"range": [
0,
3
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
},
"children": [
{
"type": "Paragraph",
"raw": "str",
"range": [
0,
3
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
},
"children": [
{
"type": "Str",
"raw": "str",
"range": [
0,
3
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
}
}
]
}
]
}
@io-monad I'v fixed this issue on txt-to-ast 1.1.0. @ https://github.com/textlint/txt-to-ast/issues/1
Can you update txt-to-ast
and try again?
npm update
# or
npm i txt-to-ast
Great! I've just tested the fix and got correct output with txt-to-ast 1.1.0
$ echo '材料不足で代替素材で製品を作った。' > test.txt
$ textlint --rule no-doubled-joshi test.txt
/Users/io-monad/test.txt
1:10 error 一文に二回以上利用されている助詞 "で" がみつかりました。 no-doubled-joshi
✖ 1 problem (1 error, 0 warnings)
Thanks for the quick response. :grinning:
This rule doesn't work for plain text files.
It works for the same sentence in markdown files though.
It seems textlint core passes to
[Syntax.Paragraph]
handler of the rule with a node of{ type: "Paragraph", raw: "Blah Blah", range: ... }
andStringSource#toString()
of textlint-util-to-string returns an empty string for that node.I'm not pretty sure whether this is a problem of textline-util-to-string or this rule, or perhaps textlint core.
Thanks.
EDIT: Oh, forgot to write some versions.
Tested with textlint 5.7.0