Files
discourse/lib/onebox/engine/giphy_onebox.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
527 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Onebox
module Engine
class GiphyOnebox
include Engine
include StandardEmbed
matches_regexp(/^https?:\/\/(giphy\.com\/gifs|gph\.is)\//)
always_https
def to_html
oembed = get_oembed
<<-HTML
<a href="#{oembed.url}" target="_blank" rel="noopener" class="onebox">
<img src="#{oembed.url}" width="#{oembed.width}" height="#{oembed.height}" #{oembed.title_attr}>
</a>
HTML
end
end
end
end