Class: PictureTag::Picture

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll_picture_tag.rb

Overview

This is the actual liquid tag, which provides the interface with Jekyll.

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, raw_params, tokens) ⇒ Picture

Returns a new instance of Picture.



47
48
49
50
# File 'lib/jekyll_picture_tag.rb', line 47

def initialize(tag_name, raw_params, tokens)
  @raw_params = raw_params
  super
end

Instance Method Details

#render(context) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/jekyll_picture_tag.rb', line 52

def render(context)
  # Jekyll passes in a mostly undocumented context object, which appears to
  # hold the entire site, including configuration and the _data dir.
  PictureTag.context = context

  # The instruction set depends on both the context and the tag parameters:
  PictureTag.instructions = Instructions::Set.new(@raw_params)

  # We need to explicitly prevent jekyll from overwriting our generated
  # files:
  Utils.keep_files

  # Return a string:
  PictureTag.output_class.new.to_s
end