Sha256: 67cb507ca9c4d6f53cda22f0a2f40e421392b64b5616e414f2ae6b611182958c
Contents?: true
Size: 1.16 KB
Versions: 28
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true module Onebox module Engine class RedditImageOnebox include Engine include StandardEmbed matches_regexp(/^https?:\/\/(www\.)?reddit\.com/) def to_html if raw[:type] == "image" <<-HTML <aside class="onebox reddit"> <header class="source"> <img src="#{raw[:favicon]}" class="site-icon" width="16" height="16"> <a href="#{raw[:url]}" target="_blank" rel="nofollow noopener">#{raw[:site_name]}</a> </header> <article class="onebox-body"> <h3><a href="#{raw[:url]}" target="_blank" rel="nofollow noopener">#{raw[:title]}</a></h3> <div class="scale-images"> <img src="#{raw[:image]}" class="scale-image"/> </div> <div class="description"><p>#{raw[:description]}</p></div> </article> </aside> HTML else html = Onebox::Engine::WhitelistedGenericOnebox.new(@url, @cache, @timeout).to_html return if Onebox::Helpers.blank?(html) html end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems