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

First jekyll initializes our class with a few arguments, of which we only care about the params (arguments passed to the liquid tag). Jekyll makes no attempt to parse them; they're given as a string.



55
56
57
58
# File 'lib/jekyll_picture_tag.rb', line 55

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

Instance Method Details

#render(context) ⇒ Object

Then jekyll calls the 'render' method and passes it a mostly undocumented context object, which appears to hold the entire site including its configuration and the parsed _data dir.



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/jekyll_picture_tag.rb', line 63

def render(context)
  setup(context)

  if PictureTag.disabled? || PictureTag.raw_params.empty?
    Utils.warning 'You have called JPT without any arguments.'

    ''
  else
    PictureTag.output_class.new.to_s
  end
end