Class: Jekyll::ResponsiveImage::Tag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-responsive-image/tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ Tag

Returns a new instance of Tag.



4
5
6
7
8
9
10
11
12
13
# File 'lib/jekyll-responsive-image/tag.rb', line 4

def initialize(tag_name, markup, tokens)
  super

  @attributes = {}

  markup.scan(::Liquid::TagAttributes) do |key, value|
    # Strip quotes from around attribute values
    @attributes[key] = value.gsub(/^['"]|['"]$/, '')
  end
end

Instance Method Details

#render(context) ⇒ Object



15
16
17
# File 'lib/jekyll-responsive-image/tag.rb', line 15

def render(context)
  Renderer.new(context.registers[:site], @attributes).render_responsive_image
end