mediawiki-title
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -348,5 +348,5 @@ "use strict"; | ||
// Strip Unicode bidi override characters. | ||
.replace(/\xE2\x80[\x8E\x8F\xAA-\xAE]/g, '') | ||
.replace(/[\u200E\u200F\u202A-\u202E]/g, '') | ||
// Clean up whitespace | ||
.replace(/[ \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/g, '_') | ||
.replace(/[ _\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/g, '_') | ||
// Trim _ from beginning and end | ||
@@ -365,3 +365,3 @@ .replace(/(?:^_+)|(?:_+$)/g, ''); | ||
if (title !== '' && title[0] === ':') { | ||
title = title.substr(1).replace(/(?:^_+)|(?:_+$)/g, ''); | ||
title = title.substr(1).replace(/^_+/, ''); | ||
} | ||
@@ -382,6 +382,6 @@ | ||
var fragment = result.title.substr(fragmentIndex); | ||
result.fragment = fragment.substr(1).replace(/ /g, '_'); | ||
result.fragment = fragment.substr(1); | ||
result.title = result.title | ||
.substring(0, result.title.length - fragment.length) | ||
.replace('/_*$/', ''); | ||
.replace(/_+$/, ''); | ||
} | ||
@@ -388,0 +388,0 @@ |
{ | ||
"name": "mediawiki-title", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Title normalization library for mediawiki", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -160,2 +160,6 @@ 'use strict'; | ||
[ 'en.wikipedia.org', 'WP:eger', 'Wikipedia:Eger'], | ||
[ 'en.wikipedia.org', 'X-Men (film series) #Gambit', 'X-Men_(film_series)' ], | ||
[ 'en.wikipedia.org', 'Foo _ bar', 'Foo_bar' ], | ||
[ 'en.wikipedia.org', 'Foo \u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000 bar', 'Foo_bar' ], | ||
[ 'en.wikipedia.org', 'Foo\u200E\u200F\u202A\u202B\u202C\u202D\u202Ebar', 'Foobar' ], | ||
// Special handling for `i` first character | ||
@@ -276,3 +280,3 @@ [ 'tr.wikipedia.org', 'iTestTest', 'İTestTest'], | ||
}); | ||
}) | ||
}); | ||
}); | ||
@@ -279,0 +283,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50460
1018