jekyll-plugin-cloudinary 1.14.4 → 1.14.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll/cloudinary.rb +36 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5152243b460bfb13890cf66737ec1704050f4b3fc0c7868e2344d6b4778cc904
4
- data.tar.gz: f0cf14009788f1b27edef724687063d5f33346d4707c13186faab0d06f6a5f5f
3
+ metadata.gz: dad2e3fe3032f923de3d1d131bf94b00f2406a33c0c51d01221e001342342b02
4
+ data.tar.gz: e52be1381a74db4cd1ff99ff5bb208a95397bfc6db00db3245f7d8c9db33ef69
5
5
  SHA512:
6
- metadata.gz: ed624e392464332a228027f318f1c8f5a4e1c5a58f6f8ceb73ca6c9cc4956189af2b50c750b6a26679290721b25437013d0a67b0e5e490ed06aedf973d783de8
7
- data.tar.gz: cf6287a77c0e8a02c7a8eaf99f566c028493d8125dbc5644f61215b335be3e1bac2255f861c3e51115bbaa0d8882a9881e1c2c307779aec7c23a12dd383b8d22
6
+ metadata.gz: 3ae562d772c6a74704cda1e809bbaee9f37673f3dfe880bd8ee84a41924d41f292203298ab386c4994eac5c5c904808e5044dc8195d7ad51a0f32a8427161156
7
+ data.tar.gz: b11b7653519042810289396a9e8e3b81c2d61b0b9c2b632efbfe740c8eb16f811da898d00ab6a02c2f094eabbe43a2895498ce0d677c15523953e238633cd0a9
@@ -50,7 +50,7 @@ module Jekyll
50
50
  "delay" => false,
51
51
  "color" => false,
52
52
  "color_space" => false,
53
- "dpr" => false,
53
+ "dpr" => "auto",
54
54
  "page" => false,
55
55
  "density" => false,
56
56
  "flags" => false,
@@ -172,6 +172,15 @@ module Jekyll
172
172
  end
173
173
  html_attr = attributes.merge(html_attr)
174
174
 
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
+
175
184
  # Deal with the "caption" attribute as a true <figcaption>
176
185
  if html_attr["caption"]
177
186
  caption = markdown_converter.convert(html_attr["caption"])
@@ -213,7 +222,12 @@ module Jekyll
213
222
  # It's remote
214
223
  image_dest_path = image_src
215
224
  #image_dest_url = image_src
216
- image_dest_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/q_auto:best/#{image_src}"
225
+ if trnsfm.nil?
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
+
217
231
 
218
232
  if ENV["JEKYLL_ENV"] != "production"
219
233
  natural_width, natural_height = nil
@@ -227,7 +241,11 @@ module Jekyll
227
241
  return "<img src=\"#{image_dest_url}\" />"
228
242
  end
229
243
  width_height = "width=\"#{natural_width}\" height=\"#{natural_height}\""
230
- fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{preset["fallback_max_width"]}/#{image_src}"
244
+ if trnsfm.nil?
245
+ fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{preset["fallback_max_width"]}/#{image_src}"
246
+ else
247
+ fallback_url = "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{trnsfm}/#{image_src}"
248
+ end
231
249
  end
232
250
 
233
251
  ## Don't generate responsive image HTML and Cloudinary URLs for local development
@@ -250,19 +268,31 @@ module Jekyll
250
268
  in #{context["page"]["path"]} not enough for ANY srcset version"
251
269
  )
252
270
  end
253
- srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{natural_width}/#{image_src} #{natural_width}w"
271
+ if trnsfm.nil?
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
254
276
  else
255
277
  missed_sizes = []
256
278
  (1..steps).each do |factor|
257
279
  width = min_width + (factor - 1) * step_width
258
280
  if width <= natural_width
259
- srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{width}/#{image_src} #{width}w"
281
+ if trnsfm.nil?
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
260
286
  else
261
287
  missed_sizes.push(width)
262
288
  end
263
289
  end
264
290
  unless missed_sizes.empty?
265
- srcset << "https://res.cloudinary.com/#{settings["cloud_name"]}/image/#{type}/#{transformations_string}w_#{natural_width}/#{image_src} #{natural_width}w"
291
+ if trnsfm.nil?
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
266
296
  if settings["verbose"]
267
297
  Jekyll.logger.warn(
268
298
  "[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: 1.14.4
4
+ version: 1.14.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@glueckkanja"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-22 00:00:00.000000000 Z
11
+ date: 2019-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastimage