diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-04-25 21:06:24 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-04-25 21:06:24 +1100 |
commit | 31c990cc41e2dc7576cf867a313862a07fd8c170 (patch) | |
tree | 57e14d914aee3a81b11ad29f05395ec9d2fed2ba /lib | |
parent | a62ae94d9c5940e87679b1ce8a0aee8b82b4d59e (diff) | |
download | gitlab-ce-31c990cc41e2dc7576cf867a313862a07fd8c170.tar.gz |
Fix rendering emoji inside a string
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/emoji_filter.rb | 5 |
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. |