onebox 1.8.19 → 1.8.20

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: 38a4803aa8b41e5e08c6b2881049952f0c772e37
4
- data.tar.gz: 2f376044f6d308b5d806dc8056ada1c55f17b214
3
+ metadata.gz: d0d747ccf49e968f722763eca04698951e5c7e68
4
+ data.tar.gz: 35af72508f38423f9967f3eef0d1e91a13a5dbb7
5
5
  SHA512:
6
- metadata.gz: 31f66a6050c43f98620b41a179f32917126bfc266376a60be8b83282fb73a6c9d1a1fadc3131b755b901da4bc69b35f53f6d67b5b54ab324a833623f8bb131ab
7
- data.tar.gz: 6a033b6660c4a06ad1eaad84115fd1c8a386923e306e9678e7e5b26b0fe710157dd0fabe132f887fedba36e7f401fc4627bfe6d99ce6fd34d8bfef5dd3b0bc03
6
+ metadata.gz: 461d1871c66df3448f96e8a6283bea3be8476cae3352b25708913734dd3af2ecd93eee2f413b0459a3a25bb3ed7f984644fda7825cbef147a9b27f1bc4403629
7
+ data.tar.gz: 5751126eacb1be8122f6ff008fb981a6e38ec00fb4c02586a6662a28ad817d9e65d666fb3d279c51bb53f221f25717ff9bf3b1531a9110c43270c6d8c1baebba
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  onebox
2
- ----------
3
-
4
- - [![Gem Version](https://badge.fury.io/rb/onebox.png)](https://rubygems.org/gems/onebox)
5
- - [![Code Climate](https://codeclimate.com/github/dysania/onebox.png)](https://codeclimate.com/github/dysania/onebox)
6
- - [![Build Status](https://travis-ci.org/discourse/onebox.png)](https://travis-ci.org/discourse/onebox)
7
- - [![Dependency Status](https://gemnasium.com/discourse/onebox.png)](https://gemnasium.com/discourse/onebox)
2
+ ======
8
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/onebox.png)](https://rubygems.org/gems/onebox)
5
+ [![Code Climate](https://codeclimate.com/github/dysania/onebox.png)](https://codeclimate.com/github/dysania/onebox)
6
+ [![Build Status](https://travis-ci.org/discourse/onebox.png)](https://travis-ci.org/discourse/onebox)
7
+ [![Dependency Status](https://gemnasium.com/discourse/onebox.png)](https://gemnasium.com/discourse/onebox)
9
8
 
10
9
  Onebox is a library for turning media URLs into simple HTML previews of the resource.
11
10
 
@@ -19,7 +18,7 @@ It was originally created for [Discourse](http://discourse.org) but has since be
19
18
  extracted into this convenient gem for all to use!
20
19
 
21
20
  Usage
22
- =====
21
+ -----
23
22
 
24
23
  Using onebox is fairly simple!
25
24
  First, make sure the library is required:
@@ -73,7 +72,7 @@ preview = Onebox.preview(url)
73
72
  ```
74
73
 
75
74
  Development Preview Interface
76
- =============================
75
+ -----------------------------
77
76
 
78
77
  The onebox gem comes with a development server for previewing the results
79
78
  of your changes. You can run it by running `bundle exec rake server` after checking
@@ -84,7 +83,7 @@ make sure to hit CTRL-C and restart the server to try a code change out.
84
83
 
85
84
 
86
85
  Adding Support for a new URL
87
- ============================
86
+ ----------------------------
88
87
 
89
88
  1. Check if the site supports [oEmbed](http://oembed.com/) or [Open Graph](https://developers.facebook.com/docs/opengraph/).
90
89
  If it does, you can probably get away with just whitelisting the URL in `Onebox::Engine::WhitelistedGenericOnebox` (see: [Whitelisted Generic Onebox caveats](#user-content-whitelisted-generic-onebox-caveats)).
@@ -177,7 +176,7 @@ Adding Support for a new URL
177
176
 
178
177
 
179
178
  Whitelisted Generic Onebox caveats
180
- ==================================
179
+ ----------------------------------
181
180
 
182
181
  The Whitedlisted Generic Onebox has some caveats for it's use, beyond simply whitelisting the domain.
183
182
 
@@ -187,7 +186,7 @@ The Whitedlisted Generic Onebox has some caveats for it's use, beyond simply whi
187
186
 
188
187
 
189
188
  Installing
190
- ==========
189
+ ----------
191
190
 
192
191
  Add this line to your application's Gemfile:
193
192
 
@@ -203,13 +202,13 @@ Or install it yourself as:
203
202
 
204
203
 
205
204
  Issues / Discussion
206
- ===================
205
+ -------------------
207
206
 
208
207
  Discussion of the Onebox gem, its development and features should be done on
209
208
  [Discourse Meta](https://meta.discourse.org).
210
209
 
211
210
  Contributing
212
- ============
211
+ ------------
213
212
 
214
213
  1. Fork it
215
214
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -26,7 +26,7 @@ module Onebox
26
26
  og_data = get_og_data
27
27
  result = { link: link,
28
28
  title: og_data[:title] || "Google #{shorttype.to_s.capitalize}",
29
- description: og_data[:description] || "This #{shorttype.to_s.chop.capitalize} is private",
29
+ description: Sanitize.fragment(Onebox::Helpers.truncate(og_data[:description], 250)) || "This #{shorttype.to_s.chop.capitalize} is private",
30
30
  type: shorttype
31
31
  }
32
32
  result
@@ -216,6 +216,12 @@ module Onebox
216
216
  d[:image] = d[:image_secure_url] || d[:image_url] || d[:thumbnail_url] || d[:image]
217
217
  d[:video] = d[:video_secure_url] || d[:video_url] || d[:video]
218
218
 
219
+ # Twitter labels
220
+ d[:label1] = Sanitize.fragment(Onebox::Helpers.truncate(d[:label1].strip))
221
+ d[:data1] = Sanitize.fragment(Onebox::Helpers.truncate(d[:data1].strip))
222
+ d[:label2] = Sanitize.fragment(Onebox::Helpers.truncate(d[:label2].strip))
223
+ d[:data2] = Sanitize.fragment(Onebox::Helpers.truncate(d[:data2].strip))
224
+
219
225
  d
220
226
  end
221
227
  end
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.8.19"
2
+ VERSION = "1.8.20"
3
3
  end
@@ -3,3 +3,14 @@
3
3
  <h3><a href='{{link}}' target="_blank">{{title}}</a></h3>
4
4
 
5
5
  <p>{{description}}</p>
6
+
7
+ {{#data1}}
8
+ <p><span class="label1">{{label1}}: {{data1}}</span>
9
+ {{#data2}}
10
+ <span class="label2">{{label2}}: {{data2}}</span></p>
11
+ {{/data2}}
12
+ {{^data2}}
13
+ </p>
14
+ {{/data2}}
15
+ {{/data1}}
16
+
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.8.19
4
+ version: 1.8.20
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: 2017-09-18 00:00:00.000000000 Z
13
+ date: 2017-11-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json