Module: PictureTag::OutputFormats::Basics

Includes:
ObjectiveElements
Included in:
DirectUrl, Img, Picture
Defined in:
lib/jekyll-4-picture-tag/output_formats/basics.rb

Overview

Generic functions common to all output formats.

Instance Method Summary collapse

Instance Method Details

#build_base_imgObject

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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jekyll-4-picture-tag/output_formats/basics.rb', line 10

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.name)

  add_alt(img, attributes['alt'])

  img
end

#to_sObject



26
27
28
# File 'lib/jekyll-4-picture-tag/output_formats/basics.rb', line 26

def to_s
  wrap(base_markup).to_s
end