Skip to content

Commit

Permalink
fix(main): slug creation now handles foreign chars
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jul 21, 2015
1 parent 874a1af commit 87f3d80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -14,7 +14,7 @@ var kebabRegexp = /[^a-z0-9]+/g;

var semiKebabCase = function (name) {
// Convert camel case to spaces, then ensure everything is lower case and then finally – make kebab
return name.replace(camelRegexp, '$1 $2').trim().toLowerCase().replace(kebabRegexp, '-');
return _.deburr(name).replace(camelRegexp, '$1 $2').trim().toLowerCase().replace(kebabRegexp, '-');
};

var Formatter = function (relativeTo) {
Expand Down
5 changes: 5 additions & 0 deletions test/formatter.spec.js
Expand Up @@ -186,6 +186,11 @@ describe('Formatter', function () {
formatter._formatSlug(baseMicroformatData).should.equal('another-css-feature-is-the-foo-bar');
});

it('should properly handle swedish chars', function () {
baseMicroformatData.properties.name = ['ÖverÄnda på Slottet'];
formatter._formatSlug(baseMicroformatData).should.equal('over-anda-pa-slottet');
});

});

describe('formatFilename', function () {
Expand Down

0 comments on commit 87f3d80

Please sign in to comment.