summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2017-04-25 21:06:24 +1100
committerblackst0ne <blackst0ne.ru@gmail.com>2017-04-25 21:06:24 +1100
commit31c990cc41e2dc7576cf867a313862a07fd8c170 (patch)
tree57e14d914aee3a81b11ad29f05395ec9d2fed2ba /lib
parenta62ae94d9c5940e87679b1ce8a0aee8b82b4d59e (diff)
downloadgitlab-ce-31c990cc41e2dc7576cf867a313862a07fd8c170.tar.gz
Fix rendering emoji inside a string
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/emoji_filter.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/banzai/filter/emoji_filter.rb b/lib/banzai/filter/emoji_filter.rb
index d6138816e70..6255a611dbe 100644
--- a/lib/banzai/filter/emoji_filter.rb
+++ b/lib/banzai/filter/emoji_filter.rb
@@ -53,7 +53,10 @@ module Banzai
# Build a regexp that matches all valid :emoji: names.
def self.emoji_pattern
- @emoji_pattern ||= /:(#{Gitlab::Emoji.emojis_names.map { |name| Regexp.escape(name) }.join('|')}):/
+ @emoji_pattern ||=
+ /(?<=[^[:alnum:]:]|\n|^)
+ :(#{Gitlab::Emoji.emojis_names.map { |name| Regexp.escape(name) }.join('|')}):
+ (?=[^[:alnum:]:]|$)/x
end
# Build a regexp that matches all valid unicode emojis names.