Sha256: 6842dbcf62f0b7fc65f32e5643b6f23bcf7d981f35b4835b962ede049506a7d0

Contents?: true

Size: 650 Bytes

Versions: 7

Compression:

Stored size: 650 Bytes

Contents

require 'jekyll/fontawesome/svg/fa-icon'

module Jekyll
  module FontAwesome
    module Svg
      class FontAwesomeSvgItemGenerator < Liquid::Tag
        def initialize(tag_name, faIcon, tokens)
          super
          @icon = FontAwesomeIcon.new(faIcon.strip)
        end

        def render(context)
          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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jekyll-fontawesome-svg-0.3.3 lib/jekyll/fontawesome/svg/fa-item.rb
jekyll-fontawesome-svg-0.3.2 lib/jekyll/fontawesome/svg/fa-item.rb
jekyll-fontawesome-svg-0.3.1 lib/jekyll/fontawesome/svg/fa-item.rb
jekyll-fontawesome-svg-0.3.0 lib/jekyll/fontawesome/svg/fa-item.rb
jekyll-fontawesome-svg-0.2.0 lib/jekyll/fontawesome/svg/fa-item.rb
jekyll-fontawesome-svg-0.1.1 lib/jekyll/fontawesome/svg/fa-item.rb
jekyll-fontawesome-svg-0.1.0 lib/jekyll/fontawesome/svg/fa-item.rb