Skip to content

Commit

Permalink
added pipe as special character we want to remove [for most cases thi…
Browse files Browse the repository at this point in the history
…s would fit]
  • Loading branch information
rsl committed Nov 26, 2012
1 parent e2fdbc1 commit 4fdc79d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/stringex/string_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def convert_misc_characters(options = {})
replaced = " #{replaced} " unless replaced =~ /\\1/
dummy.gsub!(found, replaced)
end
dummy = dummy.gsub(/(^|[[:alpha:]])'([[:alpha:]]|$)/, '\1\2').gsub(/[\.,:;()\[\]\/\?!\^'ʼ"_]/, " ").strip
dummy = dummy.gsub(/(^|[[:alpha:]])'([[:alpha:]]|$)/, '\1\2').gsub(/[\.,:;()\[\]\/\?!\^'ʼ"_\|]/, " ").strip
end

# Replace runs of whitespace in string. Defaults to a single space but any replacement
Expand Down
6 changes: 5 additions & 1 deletion test/string_extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ def test_to_url
"slash",
"私はガラスを食べられます。それは私を傷つけません。" =>
"si-hagarasuwoshi-beraremasu-sorehasi-woshang-tukemasen",
"カッページ・テラスに日系カフェ&バー、店内にDJブースも - シンガポール経済新聞" =>
"katupeziterasuniri-xi-kahue-and-ba-dian-nei-nidjbusumo-singaporujing-ji-xin-wen",
"ǝ is a magical string" =>
"at-is-a-magical-string"
"at-is-a-magical-string",
"either | or" =>
"either-or"
}.each do |html, plain|
assert_equal plain, html.to_url
end
Expand Down

0 comments on commit 4fdc79d

Please sign in to comment.