html-pipeline-flickr 0.1.0 → 0.1.1

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: d5734d258824cb3cd4af037ec1029f5bb7c37dc8
4
- data.tar.gz: 3b532577d2c426c1023ffbe75f2fa00049057736
3
+ metadata.gz: dd6ab85adf85ca0170f5537a26ce5e192538730b
4
+ data.tar.gz: 0c02869288fd089040bbd42b1068c5879da58add
5
5
  SHA512:
6
- metadata.gz: 1839901d6a252265de0ba94f9b5ef73632b0f247c746030bd7b1405af64ffe40a4cfc7dc4c1a4338af0aa993d19afb13a540b0bf7d2ba515b24c46b1336b3a5a
7
- data.tar.gz: 3e5496e2323314c2c9d4a7ca0309c00e78f0a0380d565bfe7acbd19a45282def118b6df94e65ba7dc3ac0fa5b1c4b16dec1b2461a59c42e4b239a90e2a56c721
6
+ metadata.gz: 4a03d2a6079e28a1306fb858f489704b425e238ec2b1c945cc924674a75b18c74dd32da7798e800e364b4906fb49113ddded32e1aff677a1644b0e41ffd47711
7
+ data.tar.gz: 54652b2a3f5e0ea1867598fdbd25c80b257afee874cf28b464c12c983830b923a25af075af350916dca59481e523339b80df31f4a6c4a65d638c852850091b1b
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ **.gem
@@ -13,24 +13,28 @@ module HTML
13
13
 
14
14
  class FlickrFilter < TextFilter
15
15
  def call
16
- regex = %r{https?://(www\.)?flickr\.com/photos/[^\s<]*}
16
+ regex = %r{(=")*(https?:\/\/(www\.)?flickr\.com\/photos\/[^\s<]*)}
17
17
  uri = URI("https://www.flickr.com/services/oembed")
18
18
 
19
19
  link_attr = context[:flickr_link_attr] || ""
20
20
 
21
21
  @text.gsub(regex) do |match|
22
- params = {
23
- url: match,
24
- format: :json,
25
- maxwidth: max_value(:width),
26
- maxheight: max_value(:height)
27
- }
28
-
29
- uri.query = URI.encode_www_form(params)
30
-
31
- response = JSON.parse(Net::HTTP.get(uri))
32
-
33
- %{<a href="#{match}" #{link_attr}><img src="#{response["url"]}" alt="#{response["title"]}" title="#{response["title"]}" /></a>}
22
+ if $1.nil?
23
+ params = {
24
+ url: match,
25
+ format: :json,
26
+ maxwidth: max_value(:width),
27
+ maxheight: max_value(:height)
28
+ }
29
+
30
+ uri.query = URI.encode_www_form(params)
31
+
32
+ response = JSON.parse(Net::HTTP.get(uri))
33
+
34
+ %{<a href="#{match}" #{link_attr}><img src="#{response["url"]}" alt="#{response["title"]}" title="#{response["title"]}" /></a>}
35
+ else
36
+ match
37
+ end
34
38
  end
35
39
  end
36
40
 
@@ -1,7 +1,7 @@
1
1
  module HTML
2
2
  class Pipeline
3
3
  module Flickr
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-flickr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Luo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2016-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.4.5
80
+ rubygems_version: 2.5.1
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Flickr filter for html-pipeline