mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 03:25:31 -05:00
23 lines
492 B
Ruby
23 lines
492 B
Ruby
|
require_dependency 'oneboxer/oembed_onebox'
|
||
|
require_dependency 'freedom_patches/rails4'
|
||
|
|
||
|
module Oneboxer
|
||
|
class DiscourseRemoteOnebox < HandlebarsOnebox
|
||
|
|
||
|
matcher /^https?\:\/\/meta\.discourse\.org\/.*$/
|
||
|
favicon 'discourse.png'
|
||
|
|
||
|
def template
|
||
|
template_path('simple_onebox')
|
||
|
end
|
||
|
|
||
|
def parse(data)
|
||
|
doc = Nokogiri::HTML(data)
|
||
|
open_graph = Oneboxer.parse_open_graph(doc)
|
||
|
open_graph['text'] = open_graph['description']
|
||
|
open_graph
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|