Class: Jekyll::ImageTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::ImageTag
- Defined in:
- lib/jekyll/image_optimizer.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ ImageTag
constructor
A new instance of ImageTag.
- #layout(context) ⇒ Object
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ ImageTag
Returns a new instance of ImageTag.
85 86 87 88 |
# File 'lib/jekyll/image_optimizer.rb', line 85 def initialize(tag_name, markup, tokens) super @index = markup.to_i end |
Instance Method Details
#layout(context) ⇒ Object
98 99 100 |
# File 'lib/jekyll/image_optimizer.rb', line 98 def layout(context) '_layouts/' + (context['image']['layout'] || context['site']['image_layout'] || 'image.html') end |
#render(context) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/jekyll/image_optimizer.rb', line 90 def render(context) context.stack do context['image']=context['page']['image'][@index] context['image']['index']=@index Liquid::Template.parse(File.read(layout(context))).render(context) end end |