From d4257f4a68c2c5603711ce440c4e2099343d90f7 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer <markus@unterwaditzer.net> Date: Sun, 17 Jul 2011 10:45:06 +0200 Subject: [PATCH] Removed unicode smileys, #1589 --- app/helpers/markdownify_helper.rb | 12 ++++-------- spec/helpers/markdownify_helper_spec.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/helpers/markdownify_helper.rb b/app/helpers/markdownify_helper.rb index ab8ff40f09..21aa70a731 100644 --- a/app/helpers/markdownify_helper.rb +++ b/app/helpers/markdownify_helper.rb @@ -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 \ No newline at end of file diff --git a/spec/helpers/markdownify_helper_spec.rb b/spec/helpers/markdownify_helper_spec.rb index b9feb7fd0d..1e036aa8d5 100644 --- a/spec/helpers/markdownify_helper_spec.rb +++ b/spec/helpers/markdownify_helper_spec.rb @@ -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 ♥ you" end it "replaces various things with (their) HTML entities" do - message = ":) :-) :( :-( ... <-> -> <- (tm) (r) (c)" - markdownify(message).should == "☺ ☺ ☹ ☹ … ↔ → ← ™ ® ©" + message = "... <-> -> <- (tm) (r) (c)" + markdownify(message).should == "… ↔ → ← ™ ® ©" end it "skips doing it if you say so" do - message = ":) :-) :( :-( ... -> <-" - markdownify(message, :emoticons => false).should == ":) :-) :( :-( ... -> <-" + message = "... -> <-" + markdownify(message, :specialchars => false).should == "... -> <-" end end @@ -263,4 +263,4 @@ describe MarkdownifyHelper do end end end -end +end \ No newline at end of file -- GitLab