Sha256: e2b417586b22f8ac7482465e8455ec1dd84adefb728ffac974d6ea24fde8284f

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

module Jekyll
  module Favicon
    # New `favicon` tag for favicon include on templates
    class Tag < Liquid::Tag
      def initialize(tag_name, text, tokens)
        super
        @text = text
      end

      def render(context)
        site = context.registers[:site]
        templates_dir = Favicon.templates
        head = "<!-- Begin Jekyll Favicon tag v#{Favicon::VERSION} -->"
        body = %w[classic safari chrome ie].collect do |template|
          template_path = File.join templates_dir, "#{template}.html.erb"
          ERB.new(File.read(template_path), nil, '-').result(binding).strip
        end
        foot = '<!-- End Jekyll Favicon tag -->'
        [head, body.join("\n"), foot].join("\n")
      end
    end
  end
end

Liquid::Template.register_tag('favicon', Jekyll::Favicon::Tag)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-favicon-0.2.2 lib/jekyll/favicon/tag.rb
jekyll-favicon-0.2.1 lib/jekyll/favicon/tag.rb
jekyll-favicon-0.2.0 lib/jekyll/favicon/tag.rb