Skip to content

Commit

Permalink
Lithuanian characters
Browse files Browse the repository at this point in the history
  • Loading branch information
dominykas committed May 28, 2014
1 parent 09292ea commit 3b5122a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions slug.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ slug.charmap = slug.defaults.charmap = {
'Ů':'U', 'Ž':'Z',
// polish
'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ś':'s', 'ź':'z',
'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ś':'S',
'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'E', 'Ł':'L', 'Ń':'N', 'Ś':'S',
'Ź':'Z', 'Ż':'Z',
// latvian
'ā':'a', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n',
'ū':'u', 'Ā':'A', 'Ē':'E', 'Ģ':'G', 'Ī':'i',
'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Ū':'u',
'ū':'u', 'Ā':'A', 'Ē':'E', 'Ģ':'G', 'Ī':'I',
'Ķ':'K', 'Ļ':'L', 'Ņ':'N', 'Ū':'U',
// lithuanian
'ė':'e', 'į':'i', 'ų':'u', 'Ė': 'E', 'Į': 'I', 'Ų':'U',
// currency
'€': 'euro', '₢': 'cruzeiro', '₣': 'french franc', '£': 'pound',
'₤': 'lira', '₥': 'mill', '₦': 'naira', '₧': 'peseta', '₨': 'rupee',
Expand Down
9 changes: 6 additions & 3 deletions test/slug.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe 'slug', ->
it 'should replace polish chars', ->
char_map = {
'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z',
'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ś':'S',
'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'E', 'Ł':'L', 'Ń':'N', 'Ś':'S',
'Ź':'Z', 'Ż':'Z'
}
for char, replacement of char_map
Expand All @@ -101,8 +101,8 @@ describe 'slug', ->
it 'should replace latvian chars', ->
char_map = {
'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n',
'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i',
'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z'
'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'I',
'Ķ':'K', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'U', 'Ž':'Z'
}
for char, replacement of char_map
[slug "foo #{char} bar baz"].should.eql ["foo-#{replacement}-bar-baz"]
Expand Down Expand Up @@ -164,3 +164,6 @@ describe 'slug', ->
'f': 'ph', 'o':'0', 'b':'8', 'a':'4', 'r':'2', 'z':'5'
}
[slug("foo bar baz", {charmap}).toUpperCase()].should.eql ['PH00-842-845']

it 'should replace lithuanian characters', ->
slug('ąčęėįšųūžĄČĘĖĮŠŲŪŽ').should.eql 'aceeisuuzACEEISUUZ'

0 comments on commit 3b5122a

Please sign in to comment.