Removed unicode smileys, #1589

This commit is contained in:
Markus Unterwaditzer 2011-07-17 10:45:06 +02:00
parent 22fdf7f895
commit d4257f4a68
2 changed files with 10 additions and 14 deletions

View file

@ -7,14 +7,14 @@ module MarkdownifyHelper
message = h(message).html_safe
options[:newlines] = true if !options.has_key?(:newlines)
options[:emoticons] = true if !options.has_key?(:emoticons)
options[:specialchars] = true if !options.has_key?(:specialchars)
message = process_links(message)
message = process_autolinks(message)
message = process_emphasis(message)
message = process_youtube(message, options[:youtube_maps])
message = process_vimeo(message, options[:vimeo_maps])
message = process_emoticons(message) if options[:emoticons]
message = process_specialchars(message) if options[:specialchars]
message = process_newlines(message) if options[:newlines]
message
@ -115,13 +115,9 @@ module MarkdownifyHelper
processed_message
end
def process_emoticons(message)
def process_specialchars(message)
map = [
["<3", "♥"],
[":(", "☹"],
[":-(", "☹"],
[":)", "☺"],
[":-)", "☺"],
["<->", "↔"],
["->", "→"],
["<-", "←"],
@ -136,4 +132,4 @@ module MarkdownifyHelper
end
message
end
end
end

View file

@ -150,20 +150,20 @@ describe MarkdownifyHelper do
end
end
describe "emoticons" do
describe "specialchars" do
it "replaces <3 with ♥" do
message = "i <3 you"
markdownify(message).should == "i &hearts; you"
end
it "replaces various things with (their) HTML entities" do
message = ":) :-) :( :-( ... <-> -> <- (tm) (r) (c)"
markdownify(message).should == "&#9786; &#9786; &#9785; &#9785; &hellip; &#8596; &rarr; &larr; &trade; &reg; &copy;"
message = "... <-> -> <- (tm) (r) (c)"
markdownify(message).should == "&hellip; &#8596; &rarr; &larr; &trade; &reg; &copy;"
end
it "skips doing it if you say so" do
message = ":) :-) :( :-( ... -> <-"
markdownify(message, :emoticons => false).should == ":) :-) :( :-( ... -&gt; &lt;-"
message = "... -> <-"
markdownify(message, :specialchars => false).should == "... -&gt; &lt;-"
end
end
@ -263,4 +263,4 @@ describe MarkdownifyHelper do
end
end
end
end
end