onebox 1.5.30 → 1.5.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onebox/engine/standard_embed.rb +9 -0
- data/lib/onebox/engine/whitelisted_generic_onebox.rb +11 -0
- data/lib/onebox/layout.rb +20 -0
- data/lib/onebox/version.rb +1 -1
- data/templates/_layout.mustache +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 168c41ce81094aaa302822d95c75191890a96dc2
|
4
|
+
data.tar.gz: 3e6fcf7bc9cbc8a7f9c0f7fe7a024d563f1f758a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b17a619d440e150fea9f956480f2ae4c415ae56443368776f8406c423c84511833376aefc934dbfc33e85f703dff0ca3128899c7a2b5023ca4574eb5a10e55
|
7
|
+
data.tar.gz: a564013c615125738cc41e750c5493f81f57da1dd2dd85639fbcad784d8de0a3c09211dfcd0a092fa8141aca6c151dc39f07903e5e92823f7a601dc31bd495d8
|
@@ -85,6 +85,7 @@ module Onebox
|
|
85
85
|
attrs_list = %w(title url type description)
|
86
86
|
html.css('meta').each do |m|
|
87
87
|
if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i)
|
88
|
+
# og properties
|
88
89
|
m_content = m.attribute('content').to_s.strip
|
89
90
|
m_name = m.attribute('property').to_s.gsub('og:', '')
|
90
91
|
og.metadata[m_name.to_sym] ||= []
|
@@ -101,6 +102,14 @@ module Onebox
|
|
101
102
|
og.send("#{m_name}=", m_content) unless m_content.empty?
|
102
103
|
end
|
103
104
|
end
|
105
|
+
if m.attribute('name') && m.attribute('name').to_s.match(/^twitter:/i)
|
106
|
+
# twitter properties
|
107
|
+
m_content = m.attribute('content').to_s.strip if m.attribute('content')
|
108
|
+
m_content = m.attribute('value').to_s.strip if m.attribute('value')
|
109
|
+
m_name = m.attribute('name').to_s
|
110
|
+
og.metadata[m_name.to_sym] ||= []
|
111
|
+
og.metadata[m_name.to_sym].push m_content
|
112
|
+
end
|
104
113
|
end
|
105
114
|
|
106
115
|
og
|
@@ -77,6 +77,7 @@ module Onebox
|
|
77
77
|
livestream.com
|
78
78
|
lessonplanet.com
|
79
79
|
mashable.com
|
80
|
+
medium.com
|
80
81
|
meetup.com
|
81
82
|
mixcloud.com
|
82
83
|
mlb.com
|
@@ -245,6 +246,16 @@ module Onebox
|
|
245
246
|
data_hash[:video] = raw.metadata[:video].first
|
246
247
|
end
|
247
248
|
|
249
|
+
if raw.metadata && raw.metadata[:"twitter:label1"] && raw.metadata[:"twitter:data1"]
|
250
|
+
data_hash[:twitter_label1] = raw.metadata[:"twitter:label1"].first
|
251
|
+
data_hash[:twitter_data1] = raw.metadata[:"twitter:data1"].first
|
252
|
+
end
|
253
|
+
|
254
|
+
if raw.metadata && raw.metadata[:"twitter:label2"] && raw.metadata[:"twitter:data2"]
|
255
|
+
data_hash[:twitter_label2] = raw.metadata[:"twitter:label2"].first
|
256
|
+
data_hash[:twitter_data2] = raw.metadata[:"twitter:data2"].first
|
257
|
+
end
|
258
|
+
|
248
259
|
data_hash
|
249
260
|
end
|
250
261
|
|
data/lib/onebox/layout.rb
CHANGED
@@ -55,12 +55,32 @@ module Onebox
|
|
55
55
|
record[:repository_path]
|
56
56
|
end
|
57
57
|
|
58
|
+
def twitter_label1
|
59
|
+
record[:twitter_label1]
|
60
|
+
end
|
61
|
+
|
62
|
+
def twitter_data1
|
63
|
+
record[:twitter_data1]
|
64
|
+
end
|
65
|
+
|
66
|
+
def twitter_label2
|
67
|
+
record[:twitter_label2]
|
68
|
+
end
|
69
|
+
|
70
|
+
def twitter_data2
|
71
|
+
record[:twitter_data2]
|
72
|
+
end
|
73
|
+
|
58
74
|
def details
|
59
75
|
{
|
60
76
|
link: record[:link],
|
61
77
|
title: record[:title],
|
62
78
|
domain: domain,
|
63
79
|
repository_path: repository_path,
|
80
|
+
twitter_label1: record[:twitter_label1],
|
81
|
+
twitter_data1: record[:twitter_data1],
|
82
|
+
twitter_label2: record[:twitter_label2],
|
83
|
+
twitter_data2: record[:twitter_data2],
|
64
84
|
subname: view.template_name,
|
65
85
|
view: view.to_html
|
66
86
|
}
|
data/lib/onebox/version.rb
CHANGED
data/templates/_layout.mustache
CHANGED
@@ -8,5 +8,9 @@
|
|
8
8
|
<article class="onebox-body">
|
9
9
|
{{{view}}}
|
10
10
|
</article>
|
11
|
+
<div style='clear: both'>
|
12
|
+
{{#twitter_label1}}<span style="float: left;">{{twitter_label1}}: {{twitter_data1}}</span>{{/twitter_label1}}
|
13
|
+
{{#twitter_label2}}<span style="float: right;">{{twitter_label2}}: {{twitter_data2}}</span>{{/twitter_label2}}
|
14
|
+
</div>
|
11
15
|
<div style='clear: both'></div>
|
12
16
|
</aside>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joanna Zeta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-01-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -431,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
431
431
|
version: '0'
|
432
432
|
requirements: []
|
433
433
|
rubyforge_project:
|
434
|
-
rubygems_version: 2.
|
434
|
+
rubygems_version: 2.5.1
|
435
435
|
signing_key:
|
436
436
|
specification_version: 4
|
437
437
|
summary: A gem for turning URLs into previews.
|