Class: Gollum::Filter::Emoji
- Inherits:
-
Gollum::Filter
- Object
- Gollum::Filter
- Gollum::Filter::Emoji
- Defined in:
- lib/gollum-lib/filter/emoji.rb
Overview
Emoji
Render emoji such as :smile:
Constant Summary collapse
- EXTRACT_PATTERN =
%r{ (?<!\[{2}) :(?<name>[\w-]+): (?!\]{^2}) }ix
- PROCESS_PATTERN =
%r{ =EEMMOOJJII= (?<name>[\w-]+) =IIJJOOMMEE= }ix
Instance Method Summary collapse
Methods inherited from Gollum::Filter
Methods included from Helpers
Constructor Details
This class inherits a constructor from Gollum::Filter
Instance Method Details
#extract(data) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/gollum-lib/filter/emoji.rb', line 20 def extract(data) data.gsub! EXTRACT_PATTERN do emoji_exists?($~[:name]) ? "=EEMMOOJJII=#{$~[:name]}=IIJJOOMMEE=" : $& end data end |
#process(data) ⇒ Object
27 28 29 30 |
# File 'lib/gollum-lib/filter/emoji.rb', line 27 def process(data) data.gsub! PROCESS_PATTERN, %q(<img src="/emoji/\k<name>" alt="\k<name>" class="emoji">) data end |