onebox 1.5.26 → 1.5.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05649c644732f05cdc3b32e9441b18aecded53af
4
- data.tar.gz: 4220d436537207993f525ec875306d3ac834948c
3
+ metadata.gz: 58182bba2fd139c8beccf6360c69b9d77da12145
4
+ data.tar.gz: 4a5eaeb8eccb8847fe7d91f4fa708802f3d9067d
5
5
  SHA512:
6
- metadata.gz: 822c076371814b31ace66052448400057075db839fd899d61725cbdf5a51edf64334adfbf0c3aed9fb48c808a5a92a1d105e6684f80bcc5fe09d57860829b70e
7
- data.tar.gz: 38ba0dc0b9b22b2d9bff772d03102f00bafc18146e6db552dbe585c665def6786f234d6467a2b593cf1474182ad0665fb3f96d66333862a6c2bf672a154ed1b8
6
+ metadata.gz: 5442a57cd27a042fbc57d187c2918dcf0e688cd9bd3bbafa4511d31fbf026d789cab4b834be43b653f058a79b82fb1d4abc4702d76f824075142d2a6dcd9f20c
7
+ data.tar.gz: b139cba62ebb754cc7d508811f36800dd27ac5a6426a97f25a166031b56020ad503b2160245b54411f90e87a358981799594dfa28e1b9c4391f1cbf9614a97a3
@@ -3,7 +3,7 @@ module Onebox
3
3
  class GoogleCalendarOnebox
4
4
  include Engine
5
5
 
6
- matches_regexp /^(https?:)?\/\/(www\.google\.[\w.]{2,}|goo\.gl)\/calendar\/.+$/
6
+ matches_regexp /^(https?:)?\/\/((www|calendar)\.google\.[\w.]{2,}|goo\.gl)\/calendar\/.+$/
7
7
  always_https
8
8
 
9
9
  def to_html
@@ -11,7 +11,7 @@ module Onebox
11
11
  imgur_data = get_imgur_data
12
12
  return "<video width='#{imgur_data[:"player:width"]}' height='#{imgur_data[:"player:height"]}' controls autoplay loop><source src='#{imgur_data[:"player:stream"]}' type='video/mp4'><source src='#{imgur_data[:"player:stream"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"player:stream"]
13
13
  return "<a href='#{url}' target='_blank'><img src='#{imgur_data[:image]}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'></a>" if imgur_data[:image]
14
- return "<div><a href='#{url}' target='_blank'><img src='#{imgur_data[:"image0:src"]}' alt='Imgur'></a><div style='position: absolute;top: 0;z-index: 935;width: 100%;height: 30px;overflow: hidden;font-size: 12px;color: #fff;background-color: rgba(0, 0, 0, 0.8);'><div style='padding-left: 10px;padding-right: 10px;overflow: hidden;text-overflow: ellipsis;word-wrap: normal;white-space: nowrap;'><a style='width: 100%;font-size: 13px;line-height: 30px;color: #ccc;text-decoration: none;' target='_blank' href='#{url}'>[Album] #{imgur_data[:title]}</a></div></div></div>" if imgur_data[:"image0:src"]
14
+ return "<div class='onebox imgur-album'><a href='#{url}' target='_blank'><span class='outer-box'><span class='inner-box'><span class='album-title'>[Album] #{imgur_data[:title]}</span></span></span><img src='#{imgur_data[:"image0:src"]}' alt='Imgur'></a></div>" if imgur_data[:"image0:src"]
15
15
  return nil
16
16
  end
17
17
 
@@ -1,3 +1,5 @@
1
+ require 'htmlentities'
2
+
1
3
  module Onebox
2
4
  module Engine
3
5
  class WhitelistedGenericOnebox
@@ -34,6 +36,7 @@ module Onebox
34
36
  cnn.com
35
37
  collegehumor.com
36
38
  coursera.org
39
+ codepen.io
37
40
  cracked.com
38
41
  dailymail.co.uk
39
42
  dailymotion.com
@@ -228,10 +231,11 @@ module Onebox
228
231
  def data
229
232
  if raw.is_a?(Hash)
230
233
  raw[:link] ||= link
234
+ raw[:title] = HTMLEntities.new.decode(raw[:title])
231
235
  return raw
232
236
  end
233
237
 
234
- data_hash = { link: link, title: raw.title, description: raw.description }
238
+ data_hash = { link: link, title: HTMLEntities.new.decode(raw.title), description: raw.description }
235
239
  data_hash[:image] = raw.images.first if raw.images && raw.images.first
236
240
  data_hash[:type] = raw.type if raw.type
237
241
 
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.5.26"
2
+ VERSION = "1.5.27"
3
3
  end
data/onebox.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency 'mustache'
23
23
  spec.add_runtime_dependency 'nokogiri', '~> 1.6.6'
24
24
  spec.add_runtime_dependency 'moneta', '~> 0.8'
25
+ spec.add_runtime_dependency 'htmlentities', '~> 4.3.4'
25
26
 
26
27
  spec.add_development_dependency 'bundler', '~> 1.7'
27
28
  spec.add_development_dependency 'rake', '~> 10.4'
@@ -1,4 +1,4 @@
1
- <img src="{{image}}" class="thumbnail"/>
1
+ {{#image}}<img src="{{image}}" class="thumbnail"/>{{/image}}
2
2
 
3
3
  <h3><a href='{{{link}}}'>{{title}}</a></h3>
4
4
 
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.26
4
+ version: 1.5.27
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: 2015-09-21 00:00:00.000000000 Z
13
+ date: 2015-11-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -68,6 +68,20 @@ dependencies:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0.8'
71
+ - !ruby/object:Gem::Dependency
72
+ name: htmlentities
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: 4.3.4
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: 4.3.4
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: bundler
73
87
  requirement: !ruby/object:Gem::Requirement