jekyll_picture_tag 2.0.4 → 2.1.0

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: 53c3ec9a79c58aae1d5dbead4e7d3071a4a28c69589f98ff93e87d0fc6aa64f3
4
- data.tar.gz: 8ebe081b0754f009df43de9beb4917dd911ef223393bcea29d029f8a1b546e09
3
+ metadata.gz: 112ac65fbe4fb0b25934864d20de4e840259aa7bac0b43c8d6724d3d0c1ded7d
4
+ data.tar.gz: 8d6d101b1849762e3e955c80b301049a3cab5d7bea6f9ad8469521fb8e7fe60c
5
5
  SHA512:
6
- metadata.gz: 3ad2303c3383cbb9e63bcf4e07560a717f4bbf317f714e005a7feabe72eb53a17981f6e1874c974686d1dd0a83ca90ad851b62890b33f8748051dbb8412dd267
7
- data.tar.gz: b2beab9bd484db516d7d70bf4a2aec8bdf7b0192acfa92dd6c98afe283988831a2064ecb5c85462d0f54104b8ca9fd914a66ab5ff94067c9ba98ab385fd869a3
6
+ metadata.gz: 86c1e2e9f9e8f62fbbc1ae69975ac490f40358649725b6308c9b964ce29571bbdaef22c6f3a0036e8c3d6352bd799d3b05db080914b143283ba97d61282632d6
7
+ data.tar.gz: 17cf9d9e1d397651148191fd2c3d9cde68f2af59c17edabb18b9fb27ebba9ea534a42936f601bb999944d2ff884e09788e6301494896a2ceeae0c2d1b9c23aae
data/.rubocop.yml CHANGED
@@ -24,7 +24,7 @@ AllCops:
24
24
  - '**/vendor/**/*'
25
25
 
26
26
  Layout/LineLength:
27
- Max: 80
27
+ Max: 120
28
28
 
29
29
  # Disabled Cops
30
30
  Style/FrozenStringLiteralComment:
@@ -32,3 +32,6 @@ Style/FrozenStringLiteralComment:
32
32
 
33
33
  Style/StringConcatenation:
34
34
  Enabled: false
35
+
36
+ Metrics/MethodLength:
37
+ Enabled: false
@@ -2,6 +2,12 @@
2
2
  ---
3
3
  # Release History
4
4
 
5
+ * 2.1.0 29 January, 2024
6
+ * Check whether the vips CLI is installed before trying to use it. Thanks to @philrb for
7
+ [#299](https://github.com/rbuchberger/jekyll_picture_tag/pull/299)
8
+ * Update minimum required mocha version to maintain compatibility with minitest
9
+ * 2.0.4 August 16, 2022
10
+ * Fix backend format support detection for new versions of libvips & imagemagick
5
11
  * 2.0.3 April 1, 2021
6
12
  * Improve backend format support detection
7
13
  * 2.0.2 March 31, 2021
@@ -1,5 +1,5 @@
1
1
  # HTML attributes
2
2
 
3
3
  Jekyll Picture Tag has comprehensive attribute support for all generated HTML. You can add
4
- attributes both through the [liquid tag]({{ site.baseurl }}/usage), and the [preset]({{
5
- site.baseurl }}/presets) (scroll down a bit).
4
+ attributes both through the [liquid tag]({{ site.baseurl }}{% link /users/liquid_tag/index.md %}),
5
+ and the [preset]({{ site.baseurl }}{% link /usage/users/presets/html_attributes.md %}) (scroll down a bit).
@@ -13,7 +13,7 @@ to make things outside the scope of JPT.
13
13
  ```yml
14
14
  # _data/picture.yml
15
15
 
16
- markup_presets:
16
+ presets:
17
17
  direct:
18
18
  markup: direct_url
19
19
  fallback_width: 800
@@ -31,7 +31,7 @@ to make things outside the scope of JPT.
31
31
  ```yml
32
32
  # _data/picture.yml
33
33
 
34
- markup_presets:
34
+ presets:
35
35
  only_srcset:
36
36
  markup: naked_srcset
37
37
  widths: [800, 1200, 1600]
@@ -17,7 +17,7 @@ Example:
17
17
  ```yml
18
18
  # /_data/picture.yml
19
19
 
20
- markup_presets:
20
+ presets:
21
21
  my_preset:
22
22
  markup: data_auto
23
23
  ```
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
48
48
  spec.add_development_dependency 'bundler', '~> 2.0'
49
49
  spec.add_development_dependency 'minitest', '~> 5.14'
50
50
  spec.add_development_dependency 'minitest-rg'
51
- spec.add_development_dependency 'mocha', '~> 1.9'
51
+ spec.add_development_dependency 'mocha', '~> 2.1'
52
52
  spec.add_development_dependency 'nokogiri', '~> 1.1'
53
53
  spec.add_development_dependency 'pry'
54
54
  spec.add_development_dependency 'rake', '~> 12.3'
@@ -14,21 +14,29 @@ module PictureTag
14
14
 
15
15
  # Returns array of formats that vips can save to
16
16
  def vips_formats
17
- @vips_formats ||= `vips -l`
18
- .split('/n')
19
- .select { |line| line.include? 'ForeignSave' }
20
- .flat_map { |line| line.scan(/\.[a-z]{1,5}/) }
21
- .map { |format| format.strip.delete_prefix('.') }
22
- .uniq
17
+ if command?('vips')
18
+ @vips_formats ||= `vips -l`
19
+ .split('/n')
20
+ .select { |line| line.include? 'ForeignSave' }
21
+ .flat_map { |line| line.scan(/\.[a-z]{1,5}/) }
22
+ .map { |format| format.strip.delete_prefix('.') }
23
+ .uniq
24
+ else
25
+ @vips_formats = []
26
+ end
23
27
  end
24
28
 
25
29
  # Returns an array of formats that imagemagick can handle.
26
30
  def magick_formats
27
- @magick_formats ||= `convert -version`
28
- .scan(/Delegates.*/)
29
- .first
30
- .delete_prefix('Delegates (built-in):')
31
- .split
31
+ if command?('convert')
32
+ @magick_formats ||= `convert -version`
33
+ .scan(/Delegates.*/)
34
+ .first
35
+ .delete_prefix('Delegates (built-in):')
36
+ .split
37
+ else
38
+ @magick_formats = []
39
+ end
32
40
  end
33
41
 
34
42
  # Returns an array of all known names of a format, for the purposes of
@@ -41,16 +49,28 @@ module PictureTag
41
49
  private
42
50
 
43
51
  def error_string(format)
44
- <<~HEREDOC
45
- No support for generating #{format} files in this environment!
46
- Libvips known savers: #{vips_formats.join(', ')}
47
- Imagemagick known savers: #{magick_formats.join(', ')}
48
- HEREDOC
52
+ str = []
53
+ str << "No support for generating \"#{format}\" files in this environment!"
54
+ str << if command?('vips')
55
+ "Libvips (installed) supports: \"#{vips_formats.join(', ')}\"."
56
+ else
57
+ 'Libvips is not installed.'
58
+ end
59
+ str << if command?('convert')
60
+ "Imagemagick (installed) supports: \"#{magick_formats.join(', ')}\"."
61
+ else
62
+ 'Imagemagick is not installed.'
63
+ end
64
+ str.join(' ')
49
65
  end
50
66
 
51
67
  def alternates
52
68
  [%w[jpg jpeg], %w[avif heic heif]]
53
69
  end
70
+
71
+ def command?(command)
72
+ system("which #{command} > /dev/null 2>&1")
73
+ end
54
74
  end
55
75
  end
56
76
  end
@@ -1,3 +1,3 @@
1
1
  module PictureTag
2
- VERSION = '2.0.4'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
data/readme.md CHANGED
@@ -18,10 +18,9 @@ If you're interested, contact me: robert@buchberger.cc
18
18
  **Responsive Images done correctly.**
19
19
 
20
20
  It's simple to throw a photo on a page and call it a day, but doing justice to users on all
21
- different browsers and devices is tedious and tricky. Tedious, tricky things should be automated.
21
+ different browsers and devices is tedious and tricky. Tedious, tricky things should be automated.
22
22
  [This blog post further elaborates on that theme.](https://robert-buchberger.com/blog/2021/responsive_images.html)
23
23
 
24
-
25
24
  Jekyll Picture Tag automatically builds cropped, resized, and reformatted images, builds several
26
25
  kinds of markup, offers extensive configuration while requiring none, and solves both the art
27
26
  direction and resolution switching problems with a little YAML configuration and a simple template
@@ -50,16 +49,22 @@ Tag is your responsive images minion - give it simple instructions and it'll han
50
49
  * Configure it easily, or not at all.
51
50
  * Make Lighthouse happy.
52
51
 
53
- ## Documentation:
52
+ ## Documentation
54
53
 
55
- https://rbuchberger.github.io/jekyll_picture_tag/
54
+ <https://rbuchberger.github.io/jekyll_picture_tag/>
56
55
 
57
- ## Changelog:
56
+ ## Changelog
58
57
 
59
- https://rbuchberger.github.io/jekyll_picture_tag/devs/releases
58
+ <https://rbuchberger.github.io/jekyll_picture_tag/devs/releases>
60
59
 
61
60
  Recent releases:
62
61
 
62
+ * 2.1.0 29 January, 2024
63
+ * Check whether the vips CLI is installed before trying to use it. Thanks to @philrb for
64
+ [#299](https://github.com/rbuchberger/jekyll_picture_tag/pull/299)
65
+ * Update minimum required mocha version to maintain compatibility with minitest
66
+ * 2.0.4 August 16, 2022
67
+ * Fix backend format support detection for new versions of libvips & imagemagick
63
68
  * 2.0.3 April 1, 2021
64
69
  * Improve backend format support detection
65
70
  * 2.0.2 March 31, 2021
@@ -80,11 +85,11 @@ Recent releases:
80
85
  * Require Ruby >= 2.6, support Ruby 3.0
81
86
  * Require Jekyll >= 4.0
82
87
  * Cropping is changing.
83
- * We now use the libvips
88
+ * We now use the libvips
84
89
  [smartcrop function](https://www.rubydoc.info/gems/ruby-vips/Vips/Image#smartcrop-instance_method),
85
90
  which does some magic to keep the most useful part of the image.
86
- * Geometry is renamed to 'crop', and reduced to simple aspect ratios only. (`width:height`)
87
- * Gravity is gone, replaced by 'keep' which is translated to a libvips
91
+ * Geometry is renamed to 'crop', and reduced to simple aspect ratios only. (`width:height`)
92
+ * Gravity is gone, replaced by 'keep' which is translated to a libvips
88
93
  [interestingness](https://www.rubydoc.info/gems/ruby-vips/Vips/Interesting) setting.
89
94
  * Add stock presets and media queries, under the `jpt-` prefix.
90
95
  * Add `format_quality` default settings for webp, avif, and jp2.
@@ -96,14 +101,6 @@ Recent releases:
96
101
  officially and only `presets` and `media_queries`.
97
102
  * Improve docs with an introductory tutorial and 'how-to' flow.
98
103
 
99
- * 1.14.0 January 10, 2021
100
- * Gracefully handle empty tag arguments.
101
- * Re-add metadata stripping. I removed it inadvertently when refactoring; now
102
- there's a test and a setting to turn it off.
103
- * Respect Jekyll's `--disable-disk-cache` argument.
104
- * Add baseurl configuration, allowing increased plugin support (such as I18n via `jekyll-multiple-languages-plugin`)
105
- * Tooling & test suite maintenance and improvements.
106
-
107
104
  ## Help Wanted
108
105
 
109
106
  Writing code is only part of the job; often the harder part is knowing what needs to be changed. Any
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_picture_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wierzbowski
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-08-16 00:00:00.000000000 Z
13
+ date: 2024-01-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -144,14 +144,14 @@ dependencies:
144
144
  requirements:
145
145
  - - "~>"
146
146
  - !ruby/object:Gem::Version
147
- version: '1.9'
147
+ version: '2.1'
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: '1.9'
154
+ version: '2.1'
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: nokogiri
157
157
  requirement: !ruby/object:Gem::Requirement