Class: Jekyll::Academicons::Svg::AcademiconsItemGenerator

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/academicons/svg/academicons-item.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ AcademiconsItemGenerator



7
8
9
10
# File 'lib/jekyll/academicons/svg/academicons-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
# File 'lib/jekyll/academicons/svg/academicons-item.rb', line 12

def render(context)
  faIcon = context[@markup] ||= @tmp_markup
  @icon = AcademiconsIcon.new(faIcon.strip)
  unless context.environments.first['page']['academicons_svg'].is_a?([]::class)
    context.environments.first['page']['academicons_svg'] = []
  end
  context.environments.first['page']['academicons_svg'].push(@icon.value)
  "<svg class=\"academic-icon\"><use xlink:href='##{@icon.value}'></use></svg>"
end