Class: Flue::EmojiFilter
- Inherits:
-
Object
- Object
- Flue::EmojiFilter
- Defined in:
- lib/flue/content_filter.rb
Instance Method Summary collapse
Instance Method Details
#call(input, options = {}) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/flue/content_filter.rb', line 51 def call(input, ={}) input.gsub(/:([a-z0-9\+\-_]+):/) do |match| if Emoji.names.include?($1) FileUtils.mkdir_p "_site/images/emoji" FileUtils.cp "#{Emoji.images_path}/emoji/#{$1}.png", "_site/images/emoji/#{$1}.png" '<img alt="' + $1 + '" height="20" src="images/' + "emoji/#{$1}.png" + '" style="vertical-align:middle" width="20" />' else match end end end |