Skip to content

Commit

Permalink
fix: set unicode flag for author name regex (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Jun 24, 2024
1 parent 74822d4 commit 564ae9b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
}
},
"jest.jestCommandLine": "yarn test",
Expand Down
27 changes: 27 additions & 0 deletions packages/plugin-iobroker/src/tools.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { cleanChangelogForNews } from "./tools";

describe("cleanChangelogForNews", () => {
it("removes author names with umlauts", () => {
const input = `
* (Jürgen) Line 1
* (Jérôme) Line 2
* (René) Line 3
* (Burić) Line 4
* (Çoban) Line 5
* (Jörg) Line 6
* (Keßler) Line 7
`.trim();

const expected = `
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
`.trim();

expect(cleanChangelogForNews(input)).toBe(expected);
});
});
2 changes: 1 addition & 1 deletion packages/plugin-iobroker/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function limitKeys<T>(obj: Record<string, T>, count: number): Record<stri
return ret;
}

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

Expand Down

1 comment on commit 564ae9b

@klein0r
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, next time I'll provide a test 😞

Please sign in to comment.