Skip to content

Commit 93a3b09

Browse files
committed
feat(3.3): 半角かっこも検知するように修正
1 parent 8ab9643 commit 93a3b09

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

src/3.3.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import { isUserWrittenNode } from "./util/node-util";
88
import { matchCaptureGroupAll } from "match-index";
99

10-
const brackets = ["\\[", "\\]", "(", ")", "[", "]", "「", "」", "『", "』"];
11-
10+
const brackets = ["\\(", "\\)", "\\[", "\\]", "(", ")", "[", "]", "「", "」", "『", "』"];
1211
const leftBrackets = brackets.map((bracket) => {
1312
return new RegExp("([  ])" + bracket, "g");
1413
});

test/3.3-test.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,38 @@ tester.run("3.3.かっこ類と隣接する文字の間のスペースの有無"
3131
}
3232
]
3333
},
34+
{
35+
text: "これは (ダメ) です",
36+
output: "これは(ダメ)です",
37+
errors: [
38+
{
39+
message: "かっこの外側、内側ともにスペースを入れません。",
40+
line: 1,
41+
column: 4
42+
},
43+
{
44+
message: "かっこの外側、内側ともにスペースを入れません。",
45+
line: 1,
46+
column: 9
47+
}
48+
]
49+
},
50+
{
51+
text: "これはダメ (test) です",
52+
output: "これはダメ(test)です",
53+
errors: [
54+
{
55+
message: "かっこの外側、内側ともにスペースを入れません。",
56+
line: 1,
57+
column: 6
58+
},
59+
{
60+
message: "かっこの外側、内側ともにスペースを入れません。",
61+
line: 1,
62+
column: 13
63+
}
64+
]
65+
},
3466
{
3567
text: `TEST
3668

test/fixtures/input.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ JTF 標準
7373

7474
これは 「ダメ」です
7575

76+
これは (ダメ) です
77+
78+
これはダメ (test) です
79+
7680
A氏は「5月に新製品を発売します。」と述べました。
7781

7882
従業員は約30,000人です(関連企業を含みます。)

test/fixtures/output.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ JTF標準
7373

7474
これは「ダメ」です
7575

76+
これは(ダメ)です
77+
78+
これはダメ(test)です
79+
7680
A氏は「5月に新製品を発売します」と述べました。
7781

7882
従業員は約30,000人です(関連企業を含みます)

0 commit comments

Comments
 (0)