Skip to content

Commit

Permalink
Fix word detection at end of line
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Nov 5, 2023
1 parent ca36a64 commit b2c4378
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,3 @@ This software has been developed with lots of coffee, buy me one more cup to kee
[Artem Sapegin](https://sapegin.me) and [contributors](https://github.com/sapegin/textlint-rule-terminology/graphs/contributors).

MIT License, see the included [License.md](License.md) file. Also see the [project status](https://github.com/sapegin/textlint-rule-terminology/discussions/65).

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function getExactMatchRegExp(pattern) {
// 2. Exact match of the pattern
// 3. Space, punctuation + space, punctuation + punctuation, or punctuation at the end of the string, end of the string
`(?<=^|[^-\\w])\\b${pattern}\\b(?= |${punctuation} |${punctuation}${punctuation}|${punctuation}$|$)`,
'ig'
'igm'
);
}

Expand Down
11 changes: 11 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@ tester.run('textlint-rule-terminology', rule, {
},
],
invalid: [
{
// https://github.com/sapegin/textlint-rule-terminology/discussions/71
text: `A Github\n`,
output: `A GitHub\n`,
errors: [
{
message:
'Incorrect usage of the term: “Github”, use “GitHub” instead',
},
],
},
{
// One word
text: 'My Javascript is good too',
Expand Down

0 comments on commit b2c4378

Please sign in to comment.