Class: PictureTag::OutputFormats::Img

Inherits:
Object
  • Object
show all
Includes:
Basics
Defined in:
lib/jekyll-4-picture-tag/output_formats/img.rb

Overview

Represents a bare <img> tag with a srcset attribute. Used when <picture> is unnecessary.

Direct Known Subclasses

DataImg

Instance Method Summary collapse

Methods included from Basics

#build_base_img, #to_s

Instance Method Details

#base_markupObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/jekyll-4-picture-tag/output_formats/img.rb', line 12

def base_markup
  img = build_base_img

  add_srcset(img, srcset)
  add_sizes(img, srcset)

  img.attributes << PictureTag.html_attributes['parent']

  img
end

#srcsetObject



8
9
10
# File 'lib/jekyll-4-picture-tag/output_formats/img.rb', line 8

def srcset
  build_srcset(nil, PictureTag.preset['formats'].first)
end