support cyrilic in slug
This commit is contained in:
parent
63c17313fb
commit
ad9bd5f5f3
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
String.prototype.slugify = function(sep) {
|
String.prototype.slugify = function(sep) {
|
||||||
if (typeof sep == 'undefined') sep = '_';
|
if (typeof sep == 'undefined') sep = '_';
|
||||||
var alphaNumRegexp = new RegExp('[^a-zA-Z0-9\\' + sep + ']', 'g');
|
var alphaNumRegexp = new RegExp('[^a-zA-Z0-9а-яА-Я\\' + sep + ']', 'g');
|
||||||
var avoidDuplicateRegexp = new RegExp('[\\' + sep + ']{2,}', 'g');
|
var avoidDuplicateRegexp = new RegExp('[\\' + sep + ']{2,}', 'g');
|
||||||
return this.replace(/\s/g, sep).replace(alphaNumRegexp, '').replace(avoidDuplicateRegexp, sep).toLowerCase()
|
return this.replace(/\s/g, sep).replace(alphaNumRegexp, '').replace(avoidDuplicateRegexp, sep).toLowerCase()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user