Sha256: 033c64f83ef4b5742f30c474415c3b641f8adb4744cc21963a8cdda0b3f1fa28
Contents?: true
Size: 951 Bytes
Versions: 1
Compression:
Stored size: 951 Bytes
Contents
require 'redcarpet' module Redcarpet module Render module HTMLLazyImg VERSION = "0.1.0" class Base < ::Redcarpet::Render::HTML def image(*) raise NotImplementedError end private def image_tag_with_loading_attr(loading:, link:, alt_text:) "<img loading=\"#{loading}\" src=\"#{link}\" alt=\"#{alt_text}\" />" end end class Lazy < Base def image(link, _title, alt_text) image_tag_with_loading_attr(loading: 'lazy', link: link, alt_text: alt_text) end end class Auto < Base def image(link, _title, alt_text) image_tag_with_loading_attr(loading: 'auto', link: link, alt_text: alt_text) end end class Eager < Base def image(link, _title, alt_text) image_tag_with_loading_attr(loading: 'eager', link: link, alt_text: alt_text) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redcarpet-render-html_lazy_img-0.1.0 | lib/redcarpet/render/html_lazy_img.rb |