@@ -51,8 +51,8 function generateProjectIdentifier(identifier, maxlength) { | |||||
51 | for(var i=0; i<diacriticsMap.length; i++) { |
|
51 | for(var i=0; i<diacriticsMap.length; i++) { | |
52 | identifier = identifier.replace(diacriticsMap[i].letters, diacriticsMap[i].base); |
|
52 | identifier = identifier.replace(diacriticsMap[i].letters, diacriticsMap[i].base); | |
53 | } |
|
53 | } | |
54 | identifier = identifier.replace(/[^a-z0-9]+/gi, '-'); // remaining non-alphanumeric => hyphen |
|
54 | identifier = identifier.replace(/[^a-z0-9_]+/gi, '-'); // remaining non-alphanumeric => hyphen | |
55 | identifier = identifier.replace(/^[-\d]*|-*$/g, ''); // remove hyphens and numbers at beginning and hyphens at end |
|
55 | identifier = identifier.replace(/^[-_\d]*|[-_]*$/g, ''); // remove hyphens/underscores and numbers at beginning and hyphens/underscores at end | |
56 | identifier = identifier.toLowerCase(); // to lower |
|
56 | identifier = identifier.toLowerCase(); // to lower | |
57 | identifier = identifier.substr(0, maxlength); // max characters |
|
57 | identifier = identifier.substr(0, maxlength); // max characters | |
58 | return identifier; |
|
58 | return identifier; |
General Comments 0
You need to be logged in to leave comments.
Login now