Fixed slugify function

This commit is contained in:
benweet 2013-10-03 02:02:18 +01:00
parent 7085c8b13a
commit c17d35015b

View File

@ -2,9 +2,10 @@ define([
"jquery", "jquery",
"underscore", "underscore",
"crel", "crel",
"xregexp",
"FileSaver", "FileSaver",
"stacktrace", "stacktrace",
], function($, _, crel) { ], function($, _, crel, XRegExp) {
var utils = {}; var utils = {};
@ -149,7 +150,7 @@ define([
// Slug function // Slug function
utils.slugify = function(text) { utils.slugify = function(text) {
return text.toLowerCase().replace(/\s/g, '-') // Replace spaces with - return text.toLowerCase().replace(/\s/g, '-') // Replace spaces with -
.replace(/![\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]/g, '') // Remove .replace(XRegExp('[^\\p{L}]', 'g'), '') // Remove
// all // all
// non-word // non-word
// chars // chars