Sha256: 58665562a6c91494acdef7ffdd3d97e3ffa029a810d192dc787b3fd6fc975318

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require 'jekyll/academicons/svg/academicons-icon'

module Jekyll
  module Academicons
    module Svg
      class AcademiconsItemGenerator < Liquid::Tag
        def initialize(tag_name, markup, tokens)
          super
          @tmp_markup = markup
        end

        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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-academicons-svg-0.1.2 lib/jekyll/academicons/svg/academicons-item.rb