jekyll-plugin-cloudinary 1.2 → 1.14.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b6f3aca92e577298f2a52f8720597a74985c28d4509580cf9bc98ab897d5d11
|
4
|
+
data.tar.gz: 0a797cce469179e29dda21a4e9c2e540b28a13568272f1be56317941396de3a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ed3ff84c6a4ef9015ae4b50f2a63833285f2ef7aba0d578347fb6985a5c146b7f2c692ef6d1f941fb5228391a62c9e7239f118399a3ac25c4ca3294eb84dc91
|
7
|
+
data.tar.gz: 58e726fae19e6be6803307c4ebb07aa39a0910f17161b1592ee6160e71ae2a0e0dbaf77f47f5d421651119148d3eb96cf1d55ae8b605403861f15a392c487257
|
File without changes
|
data/lib/jekyll/cloudinary.rb
CHANGED
@@ -50,7 +50,7 @@ module Jekyll
|
|
50
50
|
"delay" => false,
|
51
51
|
"color" => false,
|
52
52
|
"color_space" => false,
|
53
|
-
"dpr" =>
|
53
|
+
"dpr" => false,
|
54
54
|
"page" => false,
|
55
55
|
"density" => false,
|
56
56
|
"flags" => false,
|
@@ -127,16 +127,15 @@ module Jekyll
|
|
127
127
|
Jekyll.logger.abort_with("[Cloudinary]", "Can't read this tag: #{@markup}")
|
128
128
|
end
|
129
129
|
|
130
|
+
image_src = markup[:image_src]
|
131
|
+
|
130
132
|
# Dynamic image type
|
131
|
-
type = "
|
133
|
+
type = "fetch"
|
132
134
|
# TODO: URL2PNG requires signed URLs... need to investigate more
|
133
135
|
# if /^url2png\:/.match(image_src)
|
134
136
|
# type = "url2png"
|
135
137
|
# image_src.gsub! "url2png:", ""
|
136
138
|
# end
|
137
|
-
# More TODO: GK changed from fetch
|
138
|
-
|
139
|
-
image_src = markup[:image_src]
|
140
139
|
|
141
140
|
if markup[:preset]
|
142
141
|
if settings["presets"][markup[:preset]]
|
@@ -172,15 +171,6 @@ module Jekyll
|
|
172
171
|
end
|
173
172
|
html_attr = attributes.merge(html_attr)
|
174
173
|
|
175
|
-
# SPECIAL
|
176
|
-
|
177
|
-
# Deal with "special transformation"
|
178
|
-
if html_attr["transform"]
|
179
|
-
trnsfm = html_attr["transform"]
|
180
|
-
Jekyll.logger.warn("There is a transformatio @" + image_src + " ->" + trnsfm)
|
181
|
-
html_attr.delete("transform")
|
182
|
-
end
|
183
|
-
|
184
174
|
# Deal with the "caption" attribute as a true <figcaption>
|
185
175
|
if html_attr["caption"]
|
186
176
|
caption = markdown_converter.convert(html_attr["caption"])
|
@@ -217,41 +207,70 @@ module Jekyll
|
|
217
207
|
end
|
218
208
|
|
219
209
|
# Build source image URL
|
220
|
-
is_image_remote =
|
210
|
+
is_image_remote = %r!^https?!.match(image_src)
|
221
211
|
if is_image_remote
|
222
212
|
# It's remote
|
223
213
|
image_dest_path = image_src
|
224
|
-
|
225
|
-
|
226
|
-
image_dest_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/q_auto:best/#{image_src}"
|
227
|
-
else
|
228
|
-
image_dest_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{trnsfm}/#{image_src}"
|
229
|
-
end
|
230
|
-
|
231
|
-
|
232
|
-
if ENV["JEKYLL_ENV"] != "production"
|
233
|
-
natural_width, natural_height = nil
|
234
|
-
else
|
235
|
-
natural_width, natural_height = FastImage.size(image_dest_url)
|
236
|
-
end
|
214
|
+
image_dest_url = image_src
|
215
|
+
natural_width, natural_height = FastImage.size(image_dest_url)
|
237
216
|
if natural_width.nil?
|
238
|
-
|
239
|
-
|
240
|
-
end
|
241
|
-
return "<img src=\"#{image_dest_url}\" />"
|
217
|
+
Jekyll.logger.warn("remote url doesn't exists " + image_dest_url)
|
218
|
+
return "<img src=\"#{image_dest_url}\" />"
|
242
219
|
end
|
243
220
|
width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
|
244
|
-
|
245
|
-
|
221
|
+
fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{preset["fallback_max_width"]}/#{image_dest_url}"
|
222
|
+
else
|
223
|
+
# It's a local image
|
224
|
+
is_image_src_absolute = %r!^/.*$!.match(image_src)
|
225
|
+
if is_image_src_absolute
|
226
|
+
image_src_path = File.join(
|
227
|
+
site.config["source"],
|
228
|
+
image_src
|
229
|
+
)
|
230
|
+
image_dest_path = File.join(
|
231
|
+
site.config["destination"],
|
232
|
+
image_src
|
233
|
+
)
|
234
|
+
image_dest_url = File.join(
|
235
|
+
url,
|
236
|
+
image_src
|
237
|
+
)
|
238
|
+
else
|
239
|
+
image_src_path = File.join(
|
240
|
+
site.config["source"],
|
241
|
+
File.dirname(context["page"]["path"].chomp("/#excerpt")),
|
242
|
+
image_src
|
243
|
+
)
|
244
|
+
image_dest_path = File.join(
|
245
|
+
site.config["destination"],
|
246
|
+
File.dirname(context["page"]["url"]),
|
247
|
+
image_src
|
248
|
+
)
|
249
|
+
image_dest_url = File.join(
|
250
|
+
url,
|
251
|
+
File.dirname(context["page"]["url"]),
|
252
|
+
image_src
|
253
|
+
)
|
254
|
+
end
|
255
|
+
if File.exist?(image_src_path)
|
256
|
+
natural_width, natural_height = FastImage.size(image_src_path)
|
257
|
+
width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
|
258
|
+
fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{preset["fallback_max_width"]}/#{image_dest_url}"
|
246
259
|
else
|
247
|
-
|
260
|
+
natural_width = 100_000
|
261
|
+
width_height = ""
|
262
|
+
Jekyll.logger.warn(
|
263
|
+
"[Cloudinary]",
|
264
|
+
"Couldn't find this image to check its width: #{image_src_path}."
|
265
|
+
)
|
266
|
+
fallback_url = image_dest_url
|
248
267
|
end
|
249
268
|
end
|
250
269
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
270
|
+
# Don't generate responsive image HTML and Cloudinary URLs for local development
|
271
|
+
if settings["only_prod"] && ENV["JEKYLL_ENV"] != "production"
|
272
|
+
return "<img src=\"#{image_dest_url}\" #{attr_string} #{img_attr} #{width_height} crossorigin=\"anonymous\" />"
|
273
|
+
end
|
255
274
|
|
256
275
|
srcset = []
|
257
276
|
steps = preset["steps"].to_i
|
@@ -268,31 +287,19 @@ module Jekyll
|
|
268
287
|
in #{context["page"]["path"]} not enough for ANY srcset version"
|
269
288
|
)
|
270
289
|
end
|
271
|
-
|
272
|
-
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{natural_width}/#{image_src} #{natural_width}w"
|
273
|
-
else
|
274
|
-
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{trnsfm}/#{image_src} #{natural_width}w"
|
275
|
-
end
|
290
|
+
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{natural_width}/#{image_dest_url} #{natural_width}w"
|
276
291
|
else
|
277
292
|
missed_sizes = []
|
278
293
|
(1..steps).each do |factor|
|
279
294
|
width = min_width + (factor - 1) * step_width
|
280
295
|
if width <= natural_width
|
281
|
-
|
282
|
-
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{width}/#{image_src} #{width}w"
|
283
|
-
else
|
284
|
-
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{trnsfm}/#{image_src} #{width}w"
|
285
|
-
end
|
296
|
+
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{width}/#{image_dest_url} #{width}w"
|
286
297
|
else
|
287
298
|
missed_sizes.push(width)
|
288
299
|
end
|
289
300
|
end
|
290
301
|
unless missed_sizes.empty?
|
291
|
-
|
292
|
-
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{natural_width}/#{image_src} #{natural_width}w"
|
293
|
-
else
|
294
|
-
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{trnsfm}/#{image_src} #{natural_width}w"
|
295
|
-
end
|
302
|
+
srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{natural_width}/#{image_dest_url} #{natural_width}w"
|
296
303
|
if settings["verbose"]
|
297
304
|
Jekyll.logger.warn(
|
298
305
|
"[Cloudinary]",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-plugin-cloudinary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@glueckkanja"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|
@@ -28,22 +28,16 @@ dependencies:
|
|
28
28
|
name: jekyll
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.6'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '5'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- - "
|
38
|
+
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
40
|
version: '3.6'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '5'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: bundler
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,14 +72,14 @@ dependencies:
|
|
78
72
|
requirements:
|
79
73
|
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
75
|
+
version: 0.55.0
|
82
76
|
type: :development
|
83
77
|
prerelease: false
|
84
78
|
version_requirements: !ruby/object:Gem::Requirement
|
85
79
|
requirements:
|
86
80
|
- - "~>"
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
82
|
+
version: 0.55.0
|
89
83
|
description:
|
90
84
|
email:
|
91
85
|
- info@glueckkanja.com
|
@@ -98,7 +92,7 @@ files:
|
|
98
92
|
- README.md
|
99
93
|
- RELEASES.md
|
100
94
|
- Rakefile
|
101
|
-
- lib/jekyll-
|
95
|
+
- lib/jekyll-cloudinary.rb
|
102
96
|
- lib/jekyll/cloudinary.rb
|
103
97
|
- lib/jekyll/cloudinary/version.rb
|
104
98
|
homepage: https://glueckkanja.com
|
@@ -120,7 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
114
|
- !ruby/object:Gem::Version
|
121
115
|
version: '0'
|
122
116
|
requirements: []
|
123
|
-
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 2.7.8
|
124
119
|
signing_key:
|
125
120
|
specification_version: 4
|
126
121
|
summary: GK Jekyll Cloudinary Tag (derived from nhoizey)
|