Class: Jekyll::FontAwesome::Svg::FontAwesomeSvgGenerator

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/fontawesome/svg/fa-generator.rb

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jekyll/fontawesome/svg/fa-generator.rb', line 8

def render(context)
  output = nil
  unless context.environments.first['page']['fa_svg'].nil?
    output = '<svg display="none" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
          <defs>
          <!--
          Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com
          License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
          -->
      '

    context.environments.first['page']['fa_svg'].uniq.each do |icon|
      fa_icon = FontAwesomeIcon.new(icon)
      output += fa_icon.to_svg_html
    end

    output += '</defs>
      </svg>'
  end

  unless output.nil?
    output
  end
end