From a255786ed760f6c0280d24c6b72cf53b51e47972 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Mon, 8 Sep 2014 00:08:25 +0200 Subject: [PATCH] Don't check twice if there is no emoji inside --- lib/html/pipeline/emoji_filter.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/html/pipeline/emoji_filter.rb b/lib/html/pipeline/emoji_filter.rb index 4fc551d5..ee522f42 100644 --- a/lib/html/pipeline/emoji_filter.rb +++ b/lib/html/pipeline/emoji_filter.rb @@ -17,7 +17,7 @@ class EmojiFilter < Filter def call doc.search('text()').each do |node| content = node.to_html - next if !content.include?(':') + next unless content.include?(':') next if has_ancestor?(node, %w(pre code)) html = emoji_image_filter(content) next if html == content @@ -38,8 +38,6 @@ def validate # # Returns a String with :emoji: replaced with images. def emoji_image_filter(text) - return text unless text.include?(':') - text.gsub(emoji_pattern) do |match| name = $1 ":#{name}:"