onebox 1.9.12 → 1.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e381b3b95bbe074b93b77458ea5a8967f50e4b205415ff074a4a2557fc5cd2d
4
- data.tar.gz: 96378ba9c49f51c8c00bebad33f54a556aa1ce7bc266d47352e0dcb7445348b9
3
+ metadata.gz: 209e487fdbdcaee7a72c0c97a21df4dc5792d367e3b276d70621d6fcbb74e975
4
+ data.tar.gz: f53cda43c6b5fdcb90d42288ba87ceb3b5e0207f0dc94d60d31c3309b9401cfb
5
5
  SHA512:
6
- metadata.gz: f037aafcd3251a8e5e41520ac1072f6e4f6c6b2c458a2985e85100892c4c716a4153229db317f17844d7bc840f6f118d145559bcf28a791b272ffb05ea675629
7
- data.tar.gz: eaa848a692704ac0a64143677f153add4f6502a65fdee8c716680d9b3d09f1eda8118c2e1d0e56429f3c13f3d31c7c5e8c54293ff06cd8525d2176b3f9c1bfe0
6
+ metadata.gz: 497b004bb9077ae8e961321899af86bb7667d102f3c71ccfa39e2b337de63b2b23c0fb34b46c049353d4a72aef331dd2420a8cc96a6c8becf33842c63b3c3f80
7
+ data.tar.gz: 3896d227c14f6ab1d2381a75814514919182eefc2ec3a2bc359c11980890b929f9b38391d7d7b8675c4f8d06faeb03500b01cb78d73fb9dee4eec97f059fa3c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- onebox (1.9.12)
4
+ onebox (1.9.13)
5
5
  htmlentities (~> 4.3)
6
6
  moneta (~> 1.0)
7
7
  multi_json (~> 1.11)
@@ -7,10 +7,47 @@ module Onebox
7
7
  class FlickrOnebox
8
8
  include Engine
9
9
  include StandardEmbed
10
- include OpengraphImage
11
10
 
12
11
  matches_regexp(/^https?:\/\/www\.flickr\.com\/photos\//)
13
12
  always_https
13
+
14
+ def to_html
15
+ og = get_opengraph
16
+ return album_html(og) if og.url =~ /\/sets\//
17
+ return image_html(og) if !og.image.nil?
18
+ nil
19
+ end
20
+
21
+ private
22
+
23
+ def album_html(og)
24
+ escaped_url = ::Onebox::Helpers.normalize_url_for_output(url)
25
+ album_title = "[Album] #{og.title}"
26
+
27
+ <<-HTML
28
+ <div class='onebox flickr-album'>
29
+ <a href='#{escaped_url}' target='_blank'>
30
+ <span class='outer-box' style='max-width:#{og.image_width}px'>
31
+ <span class='inner-box'>
32
+ <span class='album-title'>#{album_title}</span>
33
+ </span>
34
+ </span>
35
+ <img src='#{og.get_secure_image}' #{og.title_attr} height='#{og.image_height}' width='#{og.image_width}'>
36
+ </a>
37
+ </div>
38
+ HTML
39
+ end
40
+
41
+ def image_html(og)
42
+ escaped_url = ::Onebox::Helpers.normalize_url_for_output(url)
43
+
44
+ <<-HTML
45
+ <a href='#{escaped_url}' target='_blank' class="onebox">
46
+ <img src='#{og.get_secure_image}' #{og.title_attr} alt='Imgur' height='#{og.image_height}' width='#{og.image_width}'>
47
+ </a>
48
+ HTML
49
+ end
50
+
14
51
  end
15
52
  end
16
53
  end
@@ -5,7 +5,7 @@ module Onebox
5
5
  class TypeformOnebox
6
6
  include Engine
7
7
 
8
- matches_regexp(/^https?:\/\/[a-z0-9]+\.typeform\.com\/to\/[a-zA-Z0-9]+/)
8
+ matches_regexp(/^https?:\/\/[a-z0-9\-_]+\.typeform\.com\/to\/[a-zA-Z0-9]+/)
9
9
  always_https
10
10
 
11
11
  def to_html
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "1.9.12"
4
+ VERSION = "1.9.13"
5
5
  end
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.9.12
4
+ version: 1.9.13
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: 2019-08-26 00:00:00.000000000 Z
13
+ date: 2019-09-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json