Commit 3b5490ff7cd522c453ddd36376e80d4431d0ac71
Committed by
Antonio Terceiro
1 parent
78366cac
Exists in
master
and in
29 other branches
ActionItem853: fixed
Showing
2 changed files
with
5 additions
and
1 deletions
Show diff stats
lib/noosfero/core_ext/string.rb
@@ -37,7 +37,7 @@ class String | @@ -37,7 +37,7 @@ class String | ||
37 | end | 37 | end |
38 | 38 | ||
39 | def to_slug | 39 | def to_slug |
40 | - transliterate.downcase.gsub(/^\d+/,'').gsub( /[^a-z0-9~\s:;+=_.-]/, '').gsub(/[\s:;+=_-]+/, '-').gsub(/-$/, '').gsub(/^-/, '').to_s | 40 | + transliterate.downcase.gsub(/^\d+/,'').gsub( /[^a-z0-9~\s:;+=_."'`-]/, '').gsub(/[\s:;+=_"'`-]+/, '-').gsub(/-$/, '').gsub(/^-/, '').to_s |
41 | end | 41 | end |
42 | 42 | ||
43 | end | 43 | end |
test/unit/slug_test.rb
@@ -23,4 +23,8 @@ class SlugTest < Test::Unit::TestCase | @@ -23,4 +23,8 @@ class SlugTest < Test::Unit::TestCase | ||
23 | assert_equal 'a.b', 'a.b'.to_slug | 23 | assert_equal 'a.b', 'a.b'.to_slug |
24 | end | 24 | end |
25 | 25 | ||
26 | + should 'turn quote and apostrophe into dashes' do | ||
27 | + assert_equal 'a-b-c-d', 'a"b\'c`d'.to_slug | ||
28 | + end | ||
29 | + | ||
26 | end | 30 | end |