to_slug 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/to_slug.rb +4 -0
- data/lib/to_slug/version.rb +1 -1
- data/spec/to_slug_spec.rb +4 -1
- metadata +2 -2
data/lib/to_slug.rb
CHANGED
@@ -9,6 +9,7 @@ class String # This reopns the string class
|
|
9
9
|
|
10
10
|
# Define which accents map to which ascii characters
|
11
11
|
accents = {
|
12
|
+
# Uppercase
|
12
13
|
'A' => %w(À Á Â Ã Ā Ă Ȧ Ả Ä Å Ǎ Ȁ Ȃ Ą Ạ Ḁ Ầ Ấ Ẫ Ẩ Ằ Ắ Ẵ Ẳ Ǡ Ǟ Ǻ Ậ Ặ),
|
13
14
|
'AE' => %w(Æ Ǽ Ǣ),
|
14
15
|
'B' => %w(Ḃ Ɓ Ḅ Ḇ Ƃ Ƅ),
|
@@ -38,6 +39,7 @@ class String # This reopns the string class
|
|
38
39
|
'Y' => %w(Ỳ Ý Ŷ Ỹ Ȳ Ẏ Ÿ Ỷ Ƴ Ỵ),
|
39
40
|
'Z' => %w(Ź Ẑ Ż Ž Ȥ Ẓ Ẕ Ƶ),
|
40
41
|
|
42
|
+
# Lowercase
|
41
43
|
'a' => %w(à á â ã ā ă ȧ ä ả å ǎ ȁ ȃ ą ạ ḁ ẚ ầ ấ ẫ ẩ ằ ắ ẵ ẳ ǡ ǟ ǻ ậ ặ),
|
42
44
|
'ae' => %w(æ ǽ ǣ),
|
43
45
|
'b' => %w(ḃ ɓ ḅ ḇ ƀ ƃ ƅ),
|
@@ -66,6 +68,8 @@ class String # This reopns the string class
|
|
66
68
|
'x' => %w(ẋ ẍ),
|
67
69
|
'y' => %w(ỳ ý ŷ ỹ ȳ ẏ ÿ ỷ ẙ ƴ ỵ),
|
68
70
|
'z' => %w(ź ẑ ż ž ȥ ẓ ẕ ƶ),
|
71
|
+
|
72
|
+
# Not sure what to do with these
|
69
73
|
'' => %w(Ð Þ Ə Ɣ Ɩ Ƣ Ƨ Ʃ Ʊ Ʒ Ǯ Ƹ Ȝ ƿ Ȣ ð þ ə ɣ ɩ ƣ ƨ ʃ ƪ ʊ ʒ ǯ ƹ ƺ ȝ Ƿ ȣ DZ Dz dz DŽ Dž dž LJ Lj lj NJ Nj nj ĸ ƍ ƛ ƾ ƻ Ƽ ƽ)
|
70
74
|
}
|
71
75
|
|
data/lib/to_slug/version.rb
CHANGED
data/spec/to_slug_spec.rb
CHANGED
@@ -286,5 +286,8 @@ describe String, "to_slug" do
|
|
286
286
|
"ź ẑ ż ž ȥ ẓ ẕ ƶ".to_slug.should == "z-z-z-z-z-z-z-z"
|
287
287
|
end
|
288
288
|
|
289
|
-
|
289
|
+
it "removes unknown accents" do
|
290
|
+
"this Ð Þ Ə Ɣ Ɩ Ƣ Ƨ Ʃ Ʊ Ʒ Ǯ Ƹ Ȝ ƿ Ȣ ð þ ə ɣ ɩ ƣ ƨ ʃ is ƪ ʊ ʒ ǯ ƹ ƺ ȝ Ƿ ȣ DZ Dz dz a DŽ Dž dž LJ Lj lj NJ Nj nj ĸ ƍ ƛ ƾ ƻ Ƽ ƽ string".to_slug.should == "this-is-a-string"
|
291
|
+
end
|
292
|
+
|
290
293
|
end
|