Skip to content

Commit

Permalink
Fix normalizing multiple whitespace chars
Browse files Browse the repository at this point in the history
  • Loading branch information
arlolra committed Jun 21, 2017
1 parent 4705414 commit 7323ad0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Title.newFromText = function(title, siteInfo, defaultNs) {
throw new TypeError('Invalid type of siteInfo parameter. Must be a string');
}

title = title.replace(/ /g, '_')
title = title
// Strip Unicode bidi override characters.
.replace(/\xE2\x80[\x8E\x8F\xAA-\xAE]/g, '')
// Clean up whitespace
Expand Down
1 change: 1 addition & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function doTest(formatversion) {
[ 'en.wikipedia.org', ':Test', 'Test'],
[ 'en.wikipedia.org', ': Test', 'Test'],
[ 'en.wikipedia.org', ':_Test_', 'Test'],
[ 'en.wikipedia.org', 'Test 123 456 789', 'Test_123_456_789' ],
[ 'en.wikipedia.org', '💩', '💩'],
[ 'en.wikipedia.org', 'Foo:bar', 'Foo:bar'],
[ 'en.wikipedia.org', 'Talk: foo', 'Talk:Foo'],
Expand Down

0 comments on commit 7323ad0

Please sign in to comment.