jekyll-favicon 1.0.0.pre.2 → 1.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: 19375fbd665cb27681d89f590ee75312136a775d623beec4303e42e974f60636
4
- data.tar.gz: d72579b9e971436a3774bdcbf6d20bb1457f50f4e6e682648c85d6434efb3326
3
+ metadata.gz: 5fefe82f2a327fcfc67e7f5fbee4fbdd14d95f00f4f03da72716c5c92fdd8102
4
+ data.tar.gz: e147f09714c3d78304c9138a3ef15c0720c1bdbf5d1073f3367a72d7ee4bc24d
5
5
  SHA512:
6
- metadata.gz: efaf8c6a2e8e2a09ef3e52c7e3f128c5fa6cb3326dcc7a439b6aab4514e6e88d5581f218112e69dbe124a0d0434f49e12d9c92d25f892e4760193cbf5a77e30d
7
- data.tar.gz: c21ad3577929122b8b83bd9befc63ed9abe58a6c48c949d6203acbe656fecb3303c15502982146bcb341d5a4bad4d14fc673ac1603d0ed723aaa21c792ccd77c
6
+ metadata.gz: 922f114d55014a2d0bd30973822a43c736d011d641bcdcb3c153e54c350526ea7ac0268a89d608e422d7ce7eeb324442da6b8adb7af82344a32ff58892520b7f
7
+ data.tar.gz: adb2ccbdf4659c83916e7bb2d00b308b8b700dd9f5cab297491c6d3d88842a6f721c854ba5d648bf83fb6a45265bcd6a1c19f8e42e28cb5b8eadce7243fc8970
@@ -11,7 +11,9 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/l
11
11
 
12
12
  # [Optional] Uncomment this section to install additional OS packages.
13
13
  RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
14
- && apt-get -y install --no-install-recommends imagemagick librsvg2-bin
14
+ && apt-get -y install librsvg2-bin
15
+ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
16
+ && apt-get -y install imagemagick
15
17
 
16
18
  # [Optional] Uncomment this line to install additional gems.
17
19
  RUN gem install reek standard webrick
@@ -32,7 +32,11 @@ jobs:
32
32
  gemfile: jekyll36
33
33
  - ruby-version: '3.0'
34
34
  gemfile: jekyll37
35
+ - ruby-version: '3.1'
36
+ gemfile: jekyll36
37
+ - ruby-version: '3.1'
38
+ gemfile: jekyll37
35
39
 
36
40
  gemfile: [ jekyll36, jekyll37, jekyll38, jekyll39, jekyll40, jekyll41, jekyll42 ]
37
41
  os: [ ubuntu-latest ]
38
- ruby-version: [ 2.6, 2.7, '3.0' ]
42
+ ruby-version: [ 2.6, 2.7, '3.0', '3.1' ]
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  *.gem
12
12
  Gemfile.lock
13
13
  *.gemfile.lock
14
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -4,13 +4,27 @@ All notable changes to Jekyll-Favicon will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [Unreleased]
7
+ ## [1.1.0] - 2022-07-31
8
+ ### Added
9
+ - Enable aliases when loading YAML
10
+ ### Fixed
11
+ - Ruby 3.x kwargs compatibility
8
12
 
9
- ## [1.0.0.pre.2] - 2021-06-11
13
+ ## [1.0.0] - 2021-08-13
14
+ ### Added
15
+ - gitignore Gemfile.lock
16
+ - gitignore .jekyll-cache
17
+ - Add Test github action workflow
18
+ - Regenration
19
+ ### Changed
20
+ - Move supported ruby versions to 2.5
21
+ - Update nokogiri, minitest, and minitest-hooks gemspec's development dependencies
22
+ - Update mini_magick gemspec's runtime dependencies
23
+ - Update travis rvm versions
24
+ - Rename Gem Push github action workflow
10
25
  ### Fixed
11
26
  - mime time error when starting new project
12
-
13
- ## [1.0.0.pre.1] - 2021-05-26
27
+ - fix SVG to PNG quality
14
28
  ### Removed
15
29
  - Delete Gemfile.lock
16
30
  - Delete .ruby-version
@@ -19,17 +33,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
19
33
  - Remove graphicmagick from travis config
20
34
  - Remove travis-ci config
21
35
  - Remove nokogiri gemspec development dependency
22
- ### Changed
23
- - Move supported ruby versions to 2.5
24
- - Update nokogiri, minitest, and minitest-hooks gemspec's development dependencies
25
- - Update mini_magick gemspec's runtime dependencies
26
- - Update travis rvm versions
27
- - Rename Gem Push github action workflow
28
- ### Added
29
- - gitignore Gemfile.lock
30
- - gitignore .jekyll-cache
31
- - Add Test github action workflow
32
- - Regenration
33
36
 
34
37
  ## [0.2.9] - 2021-02-10
35
38
  ### Added
data/README.md CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  This [Jekyll](https://jekyllrb.com) plugin adds:
4
4
 
5
- - a generator for
6
- - an ICO favicon
7
- - PNG favicons
8
- - SVG favicons
9
- - a [webmanifest](https://developer.mozilla.org/en-US/docs/Web/Manifest)
10
- - a [browser configuration schema](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn320426%28v=vs.85%29)
11
- - a tag to generate all the corresponding links and metadata needed in the head tag
5
+ - a generator for favicons (ICO, PNG, SVG), [webmanifests]((https://developer.mozilla.org/en-US/docs/Web/Manifest)), and [browserconfig]((https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn320426%28v=vs.85%29)) files
6
+ - a tag for the rendinering of all the corresponding links and metadata needed
7
+
8
+ Tested with:
9
+
10
+ - Jekyll 3.6 to 3.7, ruby 2.6 to 2.7
11
+ - Jekyll 3.8 to 4.2, ruby 2.6 to 3.1
12
12
 
13
13
  ## Prerequisites
14
14
 
15
- This plugin assumes you have [ImageMagick](http://www.imagemagick.org) installed.
15
+ ### [ImageMagick](http://www.imagemagick.org)
16
16
 
17
17
  Check if it is already installed by running:
18
18
 
@@ -21,12 +21,16 @@ $ convert --version | grep Version
21
21
  Version: ImageMagick 7.0.8-46 Q16 x86_64 2019-05-19 https://imagemagick.org
22
22
  ```
23
23
 
24
- If you have a [problem converting SVG files](https://github.com/afaundez/jekyll-favicon/issues/9#issuecomment-473862194), you may need to install the package `librsvg2-bin`. For example, in Ubuntu/Debian systems:
24
+ ### [librsvg](https://gitlab.gnome.org/GNOME/librsvg) (optional)
25
+
26
+ If you are having pixeled icons or if you have a [problem converting SVG files](https://github.com/afaundez/jekyll-favicon/issues/9#issuecomment-473862194), you may need to install the package `librsvg2-bin`. For example, in Ubuntu/Debian systems:
25
27
 
26
28
  ```sh
27
29
  sudo apt install librsvg2-bin
28
30
  ```
29
31
 
32
+ You may need to install `librsvg` before installing the RSVG renderer.
33
+
30
34
  Check the devcontainer's [Dockerfile](.devcontainer/Dockerfile) for more practical details.
31
35
 
32
36
  ## Installation
@@ -34,19 +38,15 @@ Check the devcontainer's [Dockerfile](.devcontainer/Dockerfile) for more practic
34
38
  Add this line to your application's Gemfile:
35
39
 
36
40
  ```ruby
37
- gem 'jekyll-favicon', '~> 1.0.0.pre.2', group: :jekyll_plugins
41
+ gem 'jekyll-favicon', '~> 1.1.0', group: :jekyll_plugins
38
42
  ```
39
43
 
40
44
  ## Usage
41
45
 
42
- If you are going to use this plugin in a hosted build/service, be sure that they include your plugins as part of the process. You can check [this running example](https://afaundez.gitlab.io/jekyll-favicon-example/) hosted by [GitLab](https://about.gitlab.com/features/pages/).
43
-
44
- As [Github Pages](https://pages.github.com) build doesn't load custom plugins, this plugin won't work. As an alternative, you can build your site and push all files (for example, build to `docs`, version it and push it, although this works only for project pages).
46
+ If you are going to use this plugin in a hosted build/service, be sure that they include your plugins as part of the process. You can check [gh-pages](/afaundez/jekyll-favicon/tree/gh-pages) branch for a working example.
45
47
 
46
- Tested with:
48
+ As [Github Pages](https://pages.github.com) doesn't load custom plugins, this plugin won't be included on the build process. As a workaround, you can build your site and push all files (for example, build to `docs`, version it and push it, although this works only for project pages).
47
49
 
48
- - Jekyll 3.6 to 3.7, ruby 2.6 to 2.7
49
- - Jekyll 3.8 to 4.2, ruby 2.6 to 3.0
50
50
 
51
51
  ### Generator
52
52
 
@@ -116,12 +116,11 @@ The convert configuration is specific for each type of convertion: SVG to ICO/PN
116
116
  |----------------|---------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
117
117
  | alpha | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick alpha docs](https://imagemagick.org/script/command-line-options.php#alpha) |
118
118
  | background | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick background docs](https://imagemagick.org/script/command-line-options.php#background) |
119
- | define | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick define docs](https://imagemagick.org/script/command-line-options.php#define) |
120
- | density | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick density docs](https://imagemagick.org/script/command-line-options.php#density) |
119
+ | define | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick define docs](https://imagemagick.org/script/command-line-options.php#define) | |
121
120
  | extent | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick extent docs](https://imagemagick.org/script/command-line-options.php#extent) |
122
121
  | gravity | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick gravity docs](https://imagemagick.org/script/command-line-options.php#gravity) |
123
122
  | resize | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick resize docs](https://imagemagick.org/script/command-line-options.php#resize) |
124
- | scale | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick scale docs](https://imagemagick.org/script/command-line-options.php#scale) |
123
+ | size | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick size docs](https://imagemagick.org/script/command-line-options.php#size) |
125
124
 
126
125
  Symbol values:
127
126
 
@@ -140,10 +139,8 @@ The refer configuration is a list of hashes with only one key, `webmanifest` or
140
139
 
141
140
  If you want to add something, just make a PR. There is a lot to do:
142
141
 
143
- - Define and check SVG/PNG attributes before execute
144
- - Review SVG to PNG conversion, it working as it is, but some parameters are hardcoded and may only work with the samples
145
- - Encapsulate image conversion
146
- - Tests everywhere
142
+ - Tests more cases
143
+ - Keep updated the favicons and files needed with modern browsers
147
144
 
148
145
  ## Contributing
149
146
 
@@ -3,27 +3,26 @@ defaults: &defaults
3
3
  alpha: null
4
4
  background: null
5
5
  define: null
6
- density: null
7
6
  extent: null
8
7
  gravity: null
9
8
  resize: null
10
- scale: null
9
+ size: null
11
10
  .svg:
12
11
  .png:
13
12
  <<: *defaults
14
13
  background: :background
15
- density: :max
16
14
  extent: :auto
17
15
  gravity: center
18
- scale:
16
+ resize:
17
+ size: :auto
19
18
  .ico:
20
19
  <<: *defaults
21
20
  background: :background
22
21
  define:
23
- density: :max
24
22
  extent: :auto
25
23
  gravity: center
26
- scale:
24
+ resize:
25
+ size: :auto
27
26
  .svg:
28
27
  <<: *defaults
29
28
  .png:
@@ -8,7 +8,7 @@ assets:
8
8
  - name: favicon.ico
9
9
  convert:
10
10
  define: 'icon:auto-resize=36,24,16'
11
- scale: 36x36
11
+ resize: 36x36
12
12
  tag:
13
13
  - link:
14
14
  href: :href
@@ -17,7 +17,7 @@ assets:
17
17
  sizes: :sizes
18
18
  - name: favicon.png
19
19
  convert:
20
- scale: 196x196
20
+ resize: 196x196
21
21
  tag:
22
22
  - link:
23
23
  href: :href
@@ -26,7 +26,7 @@ assets:
26
26
  sizes: :sizes
27
27
  - name: apple-touch-icon.png
28
28
  convert:
29
- scale: 180x180
29
+ resize: 180x180
30
30
  - name: safari-pinned-tab.svg
31
31
  tag:
32
32
  - link:
@@ -35,21 +35,21 @@ assets:
35
35
  rel: mask-icon
36
36
  - name: android-chrome-192x192.png
37
37
  convert:
38
- scale: 192x192
38
+ resize: 192x192
39
39
  refer:
40
40
  - webmanifest:
41
41
  icons:
42
42
  - src: :href
43
43
  - name: android-chrome-512x512.png
44
44
  convert:
45
- scale: 512x512
45
+ resize: 512x512
46
46
  refer:
47
47
  - webmanifest:
48
48
  icons:
49
49
  - src: :href
50
50
  - name: mstile-icon-128x128.png
51
51
  convert:
52
- scale: 128x128
52
+ resize: 128x128
53
53
  refer:
54
54
  - browserconfig:
55
55
  msapplication:
@@ -68,7 +68,7 @@ assets:
68
68
 
69
69
  - name: mstile-icon-270x270.png
70
70
  convert:
71
- scale: 270x270
71
+ resize: 270x270
72
72
  refer:
73
73
  - browserconfig:
74
74
  msapplication:
@@ -79,7 +79,7 @@ assets:
79
79
  _src: :href
80
80
  - name: mstile-icon-558x270.png
81
81
  convert:
82
- scale: 558x270
82
+ resize: 558x270
83
83
  refer:
84
84
  - browserconfig:
85
85
  msapplication:
@@ -90,7 +90,7 @@ assets:
90
90
  _src: :href
91
91
  - name: mstile-icon-558x558.png
92
92
  convert:
93
- scale: 558x558
93
+ resize: 558x558
94
94
  refer:
95
95
  - browserconfig:
96
96
  msapplication:
@@ -24,11 +24,16 @@ module Jekyll
24
24
  def self.load_file(*parts)
25
25
  path = Favicon::ROOT.join(*parts).to_s
26
26
  path = "#{path}.yml"
27
- YAML.load_file path
27
+ # Handle Psych 3 and 4
28
+ begin
29
+ YAML.load_file path, aliases: true
30
+ rescue ArgumentError
31
+ YAML.load_file path
32
+ end
28
33
  end
29
34
 
30
35
  def self.define_defaults(base, method_name, &block)
31
- base.define_singleton_method("defaults", &block)
36
+ base.define_singleton_method(:defaults, &block)
32
37
  define_method(method_name, &block)
33
38
  end
34
39
 
@@ -30,11 +30,22 @@ module Jekyll
30
30
  end
31
31
  end
32
32
 
33
+ def convert_odd_source?
34
+ img = MiniMagick::Image.open path
35
+ Utils.odd? img.dimensions
36
+ end
37
+
38
+ def convert_size(size, separator = "x")
39
+ return size unless convert_odd_source? || Utils.odd?(size)
40
+ min_dimension = size.split(separator).min
41
+ [min_dimension, min_dimension].join(separator)
42
+ end
43
+
33
44
  def sizes
34
45
  if (match = Utils.name_to_size(name)) then [match[1]]
35
46
  elsif (define = Utils.define_to_size(convert_spec["define"])) then define
36
47
  elsif (resize = convert_spec["resize"]) then [resize]
37
- elsif (scale = convert_spec["scale"]) then [scale]
48
+ elsif (size = convert_spec["size"]) then [size]
38
49
  end
39
50
  end
40
51
 
@@ -88,20 +99,17 @@ module Jekyll
88
99
  end
89
100
 
90
101
  def convert_patch_options(options)
91
- %w[density extent].each_with_object(options) do |name, memo|
102
+ %w[size extent].each_with_object(options) do |name, memo|
92
103
  method = "convert_patch_option_#{name}".to_sym
93
104
  memo[name] = send(method, options[name])
94
105
  end
95
106
  end
96
107
 
97
- def convert_patch_option_density(density)
98
- case density
99
- when :max
100
- length = sizes.collect { |size| size.split("x").collect(&:to_i) }
101
- .flatten
102
- .max
103
- length * 3
104
- else density
108
+ def convert_patch_option_size(size)
109
+ case size
110
+ when :auto
111
+ convert_size size if (size = sizes.first)
112
+ else size
105
113
  end
106
114
  end
107
115
 
@@ -15,11 +15,11 @@ module Jekyll
15
15
 
16
16
  def mutation
17
17
  refers = case @extname
18
- when ".xml"
19
- mutation_refers.select { |refer| refer.key? "browserconfig" }
20
- else
21
- mutation_refers.collect { |refer| refer["webmanifest"] }
22
- .compact
18
+ when ".xml"
19
+ mutation_refers.select { |refer| refer.key? "browserconfig" }
20
+ else
21
+ mutation_refers.collect { |refer| refer["webmanifest"] }
22
+ .compact
23
23
  end
24
24
  patch(Utils.merge(*refers) || {})
25
25
  end
@@ -10,7 +10,7 @@ module Jekyll
10
10
  include StaticFile::Convertible
11
11
 
12
12
  def generable?
13
- convertible? && super
13
+ super && convertible?
14
14
  end
15
15
 
16
16
  def patch(configuration)
@@ -12,10 +12,10 @@ module Jekyll
12
12
 
13
13
  def self.patch_unknown(value_or_values, &block)
14
14
  patch_method = case value_or_values
15
- when Array then :patch_array
16
- when Hash then :patch_hash
17
- when Symbol, String then :patch_value
18
- else return value_or_values
15
+ when Array then :patch_array
16
+ when Hash then :patch_hash
17
+ when Symbol, String then :patch_value
18
+ else return value_or_values
19
19
  end
20
20
  send patch_method, value_or_values, &block
21
21
  end
@@ -18,7 +18,7 @@ module Jekyll
18
18
  end
19
19
 
20
20
  def self.convert_options(convert, options = {})
21
- priorities = %w[resize scale]
21
+ priorities = %w[resize size]
22
22
  convert_apply convert, options.slice(*priorities)
23
23
  common_options = options.reject { |key| priorities.include? key }
24
24
  convert_apply convert, common_options
@@ -24,7 +24,8 @@ module Jekyll
24
24
  def self.mutate_iterator(key, value, memo)
25
25
  if key.start_with? "__" then memo.text = value
26
26
  elsif key.start_with? "_" then memo.add_attribute key[1..], value
27
- else Tag.mutate_xml Tag.mutate_find_or_create_element(memo, key), value
27
+ else
28
+ Tag.mutate_xml Tag.mutate_find_or_create_element(memo, key), value
28
29
  end
29
30
  end
30
31
 
@@ -45,7 +46,8 @@ module Jekyll
45
46
  if key.start_with? "__" then memo.text = value
46
47
  elsif (child_key = key.match(/^_(.*)$/))
47
48
  memo.add_attribute child_key[1], value
48
- else build_xml key, memo, value
49
+ else
50
+ build_xml key, memo, value
49
51
  end
50
52
  end
51
53
 
@@ -38,6 +38,11 @@ module Jekyll
38
38
  compactable = hash.slice(*keys)
39
39
  Utils.compact compactable
40
40
  end
41
+
42
+ def self.odd?(size, separator = "x")
43
+ size = size.split(separator) if size.is_a? String
44
+ size.uniq.size == 1
45
+ end
41
46
  end
42
47
  end
43
48
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Favicon
5
- VERSION = "1.0.0-2"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
@@ -20,8 +20,8 @@ module Jekyll
20
20
 
21
21
  def self.build_asset(site, attributes)
22
22
  asset_class = case File.extname attributes["name"]
23
- when ".ico", ".png", ".svg" then StaticGraphicFile
24
- when ".webmanifest", ".json", ".xml" then StaticDataFile
23
+ when ".ico", ".png", ".svg" then StaticGraphicFile
24
+ when ".webmanifest", ".json", ".xml" then StaticDataFile
25
25
  end
26
26
  asset_class&.new site, attributes
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-favicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alvaro Faundez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2022-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -195,9 +195,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
195
  version: 2.5.0
196
196
  required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  requirements:
198
- - - ">"
198
+ - - ">="
199
199
  - !ruby/object:Gem::Version
200
- version: 1.3.1
200
+ version: '0'
201
201
  requirements: []
202
202
  rubyforge_project:
203
203
  rubygems_version: 2.7.6.3