Class: PictureTag::OutputFormats::Basic

Inherits:
Object
  • Object
show all
Includes:
ObjectiveElements
Defined in:
lib/jekyll_picture_tag/output_formats/basic.rb

Overview

Generic functions common to all output formats.

Direct Known Subclasses

DirectUrl, Img, NakedSrcset, Picture

Instance Method Summary collapse

Instance Method Details

#build_base_imgObject

Used for both the fallback image, and for the complete markup.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jekyll_picture_tag/output_formats/basic.rb', line 14

def build_base_img
  img = SingleTag.new 'img'
  attributes = PictureTag.html_attributes

  img.attributes << attributes['img']
  img.attributes << attributes['implicit']

  fallback = build_fallback_image

  add_src(img, fallback.uri)

  add_alt(img, attributes['alt'])

  img
end

#to_sObject



9
10
11
# File 'lib/jekyll_picture_tag/output_formats/basic.rb', line 9

def to_s
  wrap(base_markup).to_s
end