jekyll-cloudinary 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -8
- data/lib/jekyll/cloudinary.rb +3 -3
- data/lib/jekyll/cloudinary/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b88743b6d8e43e1f63731ebf9facd6015946abd
|
4
|
+
data.tar.gz: ab101f22610ea9b6574e7cdb8a034100877f249f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eecfa7db628f70cf336dbe25b2a222e8048648c58bc2bc505143154a93856e8e202680f8d9313eb70ad6d31755b2e617099945e3b265bd3e27c2bdaaae56195f
|
7
|
+
data.tar.gz: 775812bfd5b70a0cf8849634fe380f2900b929efaf3bca925e034038697c95aac24a5beebd16619b1caf02fb15abcbb384db9298fce024d42dc670d807828fe3
|
data/README.md
CHANGED
@@ -89,7 +89,19 @@ With this preset, you only have to write this in your Markdown post:
|
|
89
89
|
|
90
90
|
To get this HTML:
|
91
91
|
|
92
|
-
|
92
|
+
```html
|
93
|
+
<img
|
94
|
+
src="https://nicolas-hoizey.com/assets/img.jpg"
|
95
|
+
srcset="
|
96
|
+
http://res.cloudinary.com/<cloud_name>/image/fetch/c_scale,w_320,q_auto,f_auto/https://example.com/assets/img.jpg 320w,
|
97
|
+
http://res.cloudinary.com/<cloud_name>/image/fetch/c_scale,w_576,q_auto,f_auto/https://example.com/assets/img.jpg 576w,
|
98
|
+
http://res.cloudinary.com/<cloud_name>/image/fetch/c_scale,w_832,q_auto,f_auto/https://example.com/assets/img.jpg 832w,
|
99
|
+
http://res.cloudinary.com//image/fetch/c_scale,w_1088,q_auto,f_auto/https://example.com/assets/img.jpg 1088w,
|
100
|
+
http://res.cloudinary.com/<cloud_name>/image/fetch/c_scale,w_1344,q_auto,f_auto/https://example.com/assets/img.jpg 1344w,
|
101
|
+
http://res.cloudinary.com/<cloud_name>/image/fetch/c_scale,w_1600,q_auto,f_auto/https://example.com/assets/img.jpg 1600w"
|
102
|
+
sizes="(min-width: 50rem) 50rem, 90vw"
|
103
|
+
/>
|
104
|
+
```
|
93
105
|
|
94
106
|
There is a true default default preset, but you're strongly encouraged to define your own default preset.
|
95
107
|
|
@@ -159,10 +171,3 @@ You can obviously define the `alt` attribute, mandatory for accessibility, but y
|
|
159
171
|
|
160
172
|
The `caption` attribute is the only one that can act differently, depending on the `figure` setting.
|
161
173
|
|
162
|
-
## Examples
|
163
|
-
|
164
|
-
```liquid
|
165
|
-
{% cloudinary image1.jpg alt="alternate" %}
|
166
|
-
{% cloudinary onethird image2.jpg alt="other" title="yet another one" %}
|
167
|
-
```
|
168
|
-
|
data/lib/jekyll/cloudinary.rb
CHANGED
@@ -123,7 +123,7 @@ module Jekyll
|
|
123
123
|
steps = preset['steps'].to_i
|
124
124
|
min_width = preset['min_width'].to_i
|
125
125
|
max_width = preset['max_width'].to_i
|
126
|
-
step_width = (max_width - min_width) / steps
|
126
|
+
step_width = (max_width - min_width) / (steps - 1)
|
127
127
|
sizes = preset['sizes']
|
128
128
|
|
129
129
|
if natural_width < min_width
|
@@ -132,8 +132,8 @@ module Jekyll
|
|
132
132
|
end
|
133
133
|
srcset << "http://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/q_auto,f_auto/#{image_url} #{natural_width}w"
|
134
134
|
else
|
135
|
-
(
|
136
|
-
width = min_width + factor * step_width
|
135
|
+
(1..steps).each do |factor|
|
136
|
+
width = min_width + (factor - 1) * step_width
|
137
137
|
if width <= natural_width
|
138
138
|
srcset << "http://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{width},q_auto,f_auto/#{image_url} #{width}w"
|
139
139
|
else
|