Skip to content

Commit 232aecd

Browse files
committed
fix: support hyphen word like Long-Term Support
1 parent 588a6dd commit 232aecd

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Write parentheses within parentheses.
77
> Ths Object Management Group(OMG) maintains specifications for the Unified Modeling Language(UML).
88
99
## Examples
10-
1110
**OK**:
1211

1312
```
@@ -19,6 +18,7 @@ JavaScript(JS)
1918
**NG**:
2019

2120
```
21+
LTS(Long-Term Support)
2222
JS(JavaScript)
2323
This rule is OSS(Open Source Software)
2424
これはOSS(Open Source Software)なルールです

Diff for: src/textlint-rule-abbr-within-parentheses.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const reporter = function(context) {
2323
return;
2424
}
2525
const [abbr, startPair, word, endPair] = captureGroups;
26-
const actualAbbr = expandWordsToAcronym(word.text.split(/\s/));
26+
const actualAbbr = expandWordsToAcronym(word.text.split(/\s-/));
2727
if (abbr.text === actualAbbr) {
2828
const fixed = fixer.replaceTextRange([
2929
abbr.index,

Diff for: test/textlint-rule-abbr-within-parentheses-test.js

+11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ tester.run("textlint-rule-abbr-within-parentheses", rule, {
1212
"JavaScript(JS)"
1313
],
1414
invalid: [
15+
{
16+
text: "LTS(Long-Term Support)",
17+
output: "Long-Term Support(LTS)",
18+
errors: [
19+
{
20+
message: "Abbreviation should be within parentheses.",
21+
index: 9
22+
}
23+
]
24+
25+
},
1526
{
1627
text: "JS(JavaScript)",
1728
output: "JavaScript(JS)",

0 commit comments

Comments
 (0)