Sha256: 146e4461fe6c55ff7c1a7d4494afea274c2fa32a2f0242ec961b0903f6384ea2
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 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 ugc noopener">#{raw[:site_name]}</a> </header> <article class="onebox-body"> <h3><a href="#{raw[:url]}" target="_blank" rel="nofollow ugc 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
onebox-1.9.20 | lib/onebox/engine/reddit_image_onebox.rb |
onebox-1.9.19 | lib/onebox/engine/reddit_image_onebox.rb |
onebox-1.9.18 | lib/onebox/engine/reddit_image_onebox.rb |