Skip to content

Commit 564ae9b

Browse files
authored
fix: set unicode flag for author name regex (#170)
1 parent 74822d4 commit 564ae9b

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"editor.defaultFormatter": "esbenp.prettier-vscode",
55
"[typescript]": {
66
"editor.codeActionsOnSave": {
7-
"source.organizeImports": true
7+
"source.organizeImports": "explicit"
88
}
99
},
1010
"jest.jestCommandLine": "yarn test",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { cleanChangelogForNews } from "./tools";
2+
3+
describe("cleanChangelogForNews", () => {
4+
it("removes author names with umlauts", () => {
5+
const input = `
6+
* (Jürgen) Line 1
7+
* (Jérôme) Line 2
8+
* (René) Line 3
9+
* (Burić) Line 4
10+
* (Çoban) Line 5
11+
* (Jörg) Line 6
12+
* (Keßler) Line 7
13+
`.trim();
14+
15+
const expected = `
16+
Line 1
17+
Line 2
18+
Line 3
19+
Line 4
20+
Line 5
21+
Line 6
22+
Line 7
23+
`.trim();
24+
25+
expect(cleanChangelogForNews(input)).toBe(expected);
26+
});
27+
});

packages/plugin-iobroker/src/tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function limitKeys<T>(obj: Record<string, T>, count: number): Record<stri
1414
return ret;
1515
}
1616

17-
const changelogAuthorRegex = /^[ \t]*[\*\-][ \t]*\([\p{L}\p{M}0-9@\-_,;&\+\/ ]+\)[ \t]*/gim;
17+
const changelogAuthorRegex = /^[ \t]*[\*\-][ \t]*\([\p{L}\p{M}0-9@\-_,;&\+\/ ]+\)[ \t]*/gimu;
1818
const changelogBulletPointTestRegex = /^[ \t]*[\*\-][ \t]*/;
1919
const changelogBulletPointReplaceRegex = new RegExp(changelogBulletPointTestRegex, "mg");
2020

0 commit comments

Comments
 (0)