Class: Jekyll::FontAwesome::Svg::FontAwesomeSvgItemGenerator
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::FontAwesome::Svg::FontAwesomeSvgItemGenerator
- Defined in:
- lib/jekyll/fontawesome/svg/fa-item.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ FontAwesomeSvgItemGenerator
constructor
A new instance of FontAwesomeSvgItemGenerator.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ FontAwesomeSvgItemGenerator
Returns a new instance of FontAwesomeSvgItemGenerator.
7 8 9 10 |
# File 'lib/jekyll/fontawesome/svg/fa-item.rb', line 7 def initialize(tag_name, markup, tokens) super @tmp_markup = markup end |
Instance Method Details
#render(context) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# 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 |