jekyll-cloudinary 1.2.9 → 1.2.10

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
  SHA1:
3
- metadata.gz: f95c301d8482d4ca7cdc8b2009e5f55608e0650b
4
- data.tar.gz: 56e0239a2192f6278f0eca2780bb93ed07ff8844
3
+ metadata.gz: e0f762bca7a7b7537f04638ac87150e6679949b2
4
+ data.tar.gz: 91fd8392d91e2a4589441246504a93861fcbb5e3
5
5
  SHA512:
6
- metadata.gz: 25338e2042f4750a18f48d22dea9ef497f8073a705f8d4950048d87d9eee4b60bca82013e54e7f00c650849795a5c94e759b585e91fda0bd3790425c3b7a58c6
7
- data.tar.gz: a833a2fcb7c52364bb377ba8d9edc043499e3ea446d3175efe4e15f944e7197863f27352b4dbd82cb6ea30a2f4ccf943221c42d647cfb578b50fc2ccf7d66134
6
+ metadata.gz: fe162d1021d9912623f1e8823d3afb413386ddb317b84e26837dbf7ed0dc1b44b04155d855b1b159485d5e25cfdf8b17391dc8e8c2605cec4c5a469af14c9e4b
7
+ data.tar.gz: f602ce4c5c671269e60e0e03b19b7bd02b6b3c660b71075df95a901de0adda0630f4bd3ba3009d142110efbae9f92351d817ecfb058bb9fd251aca8a3b9c9670
data/README.md CHANGED
@@ -15,6 +15,31 @@ Here is the general syntax of this Liquid tag:
15
15
  {% cloudinary [preset] path/to/img.jpg [attr="value"] %}
16
16
  ```
17
17
 
18
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
20
+ ## Table of contents
21
+
22
+ - [Installation](#installation)
23
+ - [Configuration](#configuration)
24
+ - [Mandatory settings](#mandatory-settings)
25
+ - [Optional global settings](#optional-global-settings)
26
+ - [`verbose` (default: `false`)](#verbose-default-false)
27
+ - [Optional (but highly recommended) presets](#optional-but-highly-recommended-presets)
28
+ - [Default preset](#default-preset)
29
+ - [Additional presets](#additional-presets)
30
+ - [Detailed preset settings](#detailed-preset-settings)
31
+ - [`figure` (default: `auto`)](#figure-default-auto)
32
+ - [`min_size` (default: `320`)](#min_size-default-320)
33
+ - [`max_size` (default: `1200`)](#max_size-default-1200)
34
+ - [`steps` (default: `5`)](#steps-default-5)
35
+ - [`sizes` (default: `"100vw"`)](#sizes-default-100vw)
36
+ - [`attributes` (default: none)](#attributes-default-none)
37
+ - [Live example](#live-example)
38
+ - [To do](#to-do)
39
+ - [Do you use the plugin on a live site?](#do-you-use-the-plugin-on-a-live-site)
40
+
41
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
42
+
18
43
  ## Installation
19
44
 
20
45
  [Sign up for free on Cloudinary](http://cloudinary.com/invites/lpov9zyyucivvxsnalc5/sgyyc0j14k6p0sbt51nw). The free account should be enough for most blogs.
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Cloudinary
3
- VERSION = "1.2.9"
3
+ VERSION = "1.2.10"
4
4
  end
5
5
  end
@@ -43,7 +43,7 @@ module Jekyll
43
43
  # Extract tag segments
44
44
  markup = /^(?:(?<preset>[^\s.:\/]+)\s+)?(?<image_src>[^\s]+\.[a-zA-Z0-9]{3,4})\s*(?<html_attr>[\s\S]+)?$/.match(rendered_markup)
45
45
  if !markup
46
- Jekyll.logger.abort_with('Cloudinary', "Can't read this tag: #{@markup}")
46
+ Jekyll.logger.abort_with('[Cloudinary]', "Can't read this tag: #{@markup}")
47
47
  end
48
48
 
49
49
  image_src = markup[:image_src]
@@ -64,7 +64,7 @@ module Jekyll
64
64
  natural_width = image.columns
65
65
  else
66
66
  natural_width = 1000000
67
- Jekyll.logger.warn('Cloudinary', "Couldn't find this image to check its width: #{image_path}")
67
+ Jekyll.logger.warn('[Cloudinary]', "Couldn't find this image to check its width: #{image_path}")
68
68
  end
69
69
 
70
70
  if markup[:preset]
@@ -72,7 +72,7 @@ module Jekyll
72
72
  preset = preset.merge(settings['presets'][markup[:preset]])
73
73
  else
74
74
  if settings['verbose']
75
- Jekyll.logger.warn('Cloudinary', "'#{markup[:preset]}' preset for the Cloudinary plugin doesn't exist, using the default one")
75
+ Jekyll.logger.warn('[Cloudinary]', "'#{markup[:preset]}' preset for the Cloudinary plugin doesn't exist, using the default one")
76
76
  end
77
77
  end
78
78
  end
@@ -127,20 +127,26 @@ module Jekyll
127
127
 
128
128
  if natural_width < min_width
129
129
  if settings['verbose']
130
- Jekyll.logger.warn('Cloudinary', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for ANY srcset version")
130
+ Jekyll.logger.warn('[Cloudinary]', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for ANY srcset version")
131
131
  end
132
- srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/q_auto,f_auto/#{image_url} #{natural_width}w"
132
+ srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{natural_width},q_auto,f_auto/#{image_url} #{natural_width}w"
133
133
  else
134
+ missed_sizes = []
134
135
  (1..steps).each do |factor|
135
136
  width = min_width + (factor - 1) * step_width
136
137
  if width <= natural_width
137
138
  srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{width},q_auto,f_auto/#{image_url} #{width}w"
138
139
  else
140
+ missed_sizes.push(width)
141
+ end
142
+ end
143
+ if missed_sizes.length > 0
144
+ srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{natural_width},q_auto,f_auto/#{image_url} #{natural_width}w"
139
145
  if settings['verbose']
140
- Jekyll.logger.warn('Cloudinary', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for #{width}px version")
146
+ Jekyll.logger.warn('[Cloudinary]', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for #{missed_sizes.join('px, ')}px version#{missed_sizes.length > 1 ? 's' : ''}")
141
147
  end
142
148
  end
143
- end
149
+
144
150
  end
145
151
  srcset_string = srcset.join(",\n")
146
152
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Hoizey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll