class Jekyll::FontAwesome::Svg::FontAwesomeSvgItemGenerator

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/jekyll/fontawesome/svg/fa-item.rb, line 7
def initialize(tag_name, markup, tokens)
  super
  @tmp_markup = markup
end

Public Instance Methods

render(context) click to toggle source
# File lib/jekyll/fontawesome/svg/fa-item.rb, line 12
def render(context)
  faIcon = context[@markup] ||= @tmp_markup
  @icon = FontAwesomeIcon.new(faIcon.strip)
  
  unless context.environments.first['page']['fa_svg'].is_a?([]::class)
    context.environments.first['page']['fa_svg'] = []
  end
  context.environments.first['page']['fa_svg'].push(@icon.value)
  "<svg class=\"icon\"><use xlink:href='##{@icon.value}'></use></svg>"
end