Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match with alternate title suffix ", adaptTo() XXXX" as well #75

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/utils/metadata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const titleSuffixPattern = /^(.+)\s-\s+adaptTo\(\)\s+\d+\s*$/;
// match e.g. with " - adaptTo() 2023"
// but also with ", adaptTo() 2023" which seems to be generated sometimes due to a bug
const titleSuffixPattern = /^(.+)(\s-|,)\s+adaptTo\(\)\s+\d+\s*$/;

/**
* Splits a comma-separated value to array (trimming the values).
Expand Down
1 change: 1 addition & 0 deletions test/scripts/utils/metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('utils/metadata', () => {

it('removeTitleSuffix', () => {
expect(removeTitleSuffix('My Title - adaptTo() 2021')).to.eq('My Title');
expect(removeTitleSuffix('My Title, adaptTo() 2021')).to.eq('My Title');
expect(removeTitleSuffix('My Title - Second One - adaptTo() 2020 ')).to.eq('My Title - Second One');
expect(removeTitleSuffix('adaptTo() 2021')).to.eq('adaptTo() 2021');
expect(removeTitleSuffix('')).to.eq('');
Expand Down