Class: Nexmo::Markdown::IconFilter

Inherits:
Banzai::Filter
  • Object
show all
Defined in:
lib/nexmo_markdown_renderer/filters/icon_filter.rb

Instance Method Summary collapse

Instance Method Details

#call(input) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/nexmo_markdown_renderer/filters/icon_filter.rb', line 4

def call(input)
  input.gsub!('✅', '<svg class="Vlt-green Vlt-icon Vlt-icon--small"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-check" /></svg>')
  input.gsub!('❌', '<svg class="Vlt-red Vlt-icon Vlt-icon--small"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-cross" /></svg>')
    
  input.gsub!(/\[icon="(.+?)"\]/) do
    "      <svg class=\"Vlt-green Vlt-icon Vlt-icon--small\"><use xlink:href=\"/symbol/volta-icons.svg#Vlt-icon-\#{$1}\" /></svg>\n    HEREDOC\n  end\n    \n  input\nend\n"