Sha256: a9baef7cda40874c658049f86b68fe360bf974cd84f3a8d4ed66ff4a02016ac4
Contents?: true
Size: 1.13 KB
Versions: 7
Compression:
Stored size: 1.13 KB
Contents
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
7 entries across 7 versions & 1 rubygems