summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-04-27 11:02:27 +0100
committerSean McGivern <sean@gitlab.com>2017-04-27 11:02:27 +0100
commit2df748aa71d6c636c82ed2a0a8dde8ebf6bfc7f2 (patch)
treeaae6ce8fac0775b15b65ce26afb3f700de030948 /lib/banzai
parent4bdbcf594812d35bab3c2b597fc8087f840bbd4d (diff)
parent31c990cc41e2dc7576cf867a313862a07fd8c170 (diff)
downloadgitlab-ce-2df748aa71d6c636c82ed2a0a8dde8ebf6bfc7f2.tar.gz
Merge branch 'blackst0ne/gitlab-ce-fix_emoji_parser'
Diffstat (limited to 'lib/banzai')
-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.