Skip to content

Commit

Permalink
[emoji-filter] Override emoji_image_tag
Browse files Browse the repository at this point in the history
This is nicer because I want to use everything that EmojiFilter
does *except* the image tag generation.

The prior implementation had to get involved with finding emojis and
gsubbing them out.

This possible now because of @kbrock's change over here:

gjtorikian/html-pipeline#195
  • Loading branch information
jedcn committed Sep 28, 2015
1 parent d6e0716 commit 912c1ba
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/html/pipeline/reveal_ck_emoji_filter.rb
Expand Up @@ -4,13 +4,8 @@ class Pipeline
# width/height/align attributes so that reveal-ck supplied CSS
# takes effect.
class RevealCKEmojiFilter < EmojiFilter
def emoji_image_filter(text)
return text unless text.include?(':')

text.gsub(emoji_pattern) do
name = Regexp.last_match[1]
"<img class='emoji' alt=':#{name}:' src='#{emoji_url(name)}' />"
end
def emoji_image_tag(name)
"<img class='emoji' alt=':#{name}:' src='#{emoji_url(name)}' />"
end
end
end
Expand Down

1 comment on commit 912c1ba

@kbrock
Copy link
Contributor

@kbrock kbrock commented on 912c1ba Sep 28, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!

Please sign in to comment.