Class: PictureTag::Picture

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

Overview

Title: Jekyll Picture Tag Authors: Rob Wierzbowski : @robwierzbowski

Justin Reese      : @justinxreese
Welch Canavan     : @xiwcx
Robert Buchberger : @celeritas_5k

Description: Easy responsive images for Jekyll.

Download: github.com/robwierzbowski/jekyll-4-picture-tag Documentation: github.com/robwierzbowski/jekyll-4-picture-tag/readme.md Issues: github.com/robwierzbowski/jekyll-4-picture-tag/issues

Syntax:

{% picture [preset] img.jpg [media_query: alt-img.jpg] [attr="value"] %}

Example:

{% picture poster.jpg --alt The strange case of responsive images %}
{% picture gallery poster.jpg source_small: poster_closeus.jpg
alt="The strange case of responsive images" class="gal-img" %}

See the documentation for full configuration and usage instructions.

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, raw_params, tokens) ⇒ Picture

Returns a new instance of Picture.



35
36
37
38
# File 'lib/jekyll-4-picture-tag.rb', line 35

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

Instance Method Details

#render(context) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/jekyll-4-picture-tag.rb', line 40

def render(context)
  # We can't initialize the tag until we have a context.
  PictureTag.init(@raw_params, context)

  # Return a string:
  build_markup.to_s
end