jekyll_picture_tag 1.13.0 → 1.14.0

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
  SHA256:
3
- metadata.gz: 46fd8634e4d9eff8493b340560d84e8a398eb77db81a511529f0b670f111de7c
4
- data.tar.gz: 103f00baec1839e018094b5c3d3522ecff13849e3bda46353ddde9e70e2040fb
3
+ metadata.gz: 33725ceaf2682e1c8396ecf949d606efa6f4e3dcc7097802bdc9524ef492cff2
4
+ data.tar.gz: 837d3c4e04e0b859953024e99aff1a685c7cd4a85fe36b012a1ef5f025e11257
5
5
  SHA512:
6
- metadata.gz: 14afd21d6a1cd36bac48b20e79047e1df845b458e763d0eb590125fa45dd2eef431cc27836f22073878d807dc5118787f40fe8b2ffc15579bd6edf4c70f0411b
7
- data.tar.gz: bd9131318cd312b340ff337db88127c9b8b14f78c2bfc64ec04dd6f9d27db87a08d36a59bf5aa550f51ede5c2a6b9cdda8554c60f2cecc64db5e914a1f28a84f
6
+ metadata.gz: 2de1f6a51c96750a389c8f5885dcfa80e5cb5cd9a50570e8e9a4e81ad2a987766165499bc6825eec5f10c9817994e230c5289ae6a570dedd8b5e874ee9f91595
7
+ data.tar.gz: 17cc0a355f08dc1bb6418148264feeb47010faf29ad3597f789443c504d8574fa069a77e83c3968569f3b5ab7217905bc4bf19322f6f5c25acde3f549db76a81
data/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ # if you run bundle install --binstubs, you won't have to use bundle exec all the time.
2
+ export PATH=$(git rev-parse --show-toplevel)/bin:$PATH
@@ -0,0 +1,43 @@
1
+ name: 'Tests & Formatting'
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+ schedule:
9
+ # Run weekly; github deletes caches that haven't been used in a week.
10
+ - cron: '0 0 * * 0'
11
+
12
+ jobs:
13
+ checks:
14
+ runs-on: ubuntu-latest
15
+ env:
16
+ imagemagick_version: 7.0.10-46
17
+
18
+ steps:
19
+
20
+ - name: Install system dependencies
21
+ run: sudo apt install build-essential libxml2-dev libjpeg-dev libwebp-dev libpng-dev libopenjp2-7-dev
22
+
23
+ - name: Checkout repo
24
+ uses: actions/checkout@v2
25
+
26
+ - uses: actions/cache@v2
27
+ with:
28
+ path: imagemagick
29
+ key: imagick1-${{ env.imagemagick_version }}
30
+
31
+ - name: Install imagemagick
32
+ run: bash install_imagemagick.sh
33
+
34
+ # Version taken from .ruby-version file.
35
+ # Also runs bundle install.
36
+ - name: Install Ruby
37
+ uses: ruby/setup-ruby@v1
38
+ with:
39
+ bundler-cache: true
40
+
41
+ - run: bundle exec rake test
42
+
43
+ - run: bundle exec rubocop
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /docs/.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
4
5
  /_yardoc/
@@ -13,3 +14,5 @@ jekyll-picture-tag.iml
13
14
  /docs/_site/
14
15
  /docs/.jekyll-cache/
15
16
  /docs/.sass-cache/
17
+ /bin/
18
+ /docs/bin/
@@ -1,81 +1,32 @@
1
- # Disabled
1
+ # Exclude unimportant files
2
+ require:
3
+ - rubocop-minitest
4
+ - rubocop-rake
5
+
6
+ AllCops:
7
+ NewCops: enable
8
+ Include:
9
+ - 'lib/**/*.rb'
10
+ - 'test/**/*.rb'
11
+ - 'Gemfile'
12
+ - 'Rakefile'
13
+ - '*.gemspec'
14
+
15
+ Exclude:
16
+ - '**/.bundle/*'
17
+ - '**/.git/*'
18
+ - '**/.github/*'
19
+ - '**/bin/**/*'
20
+ - '**/coverage/**/*'
21
+ - '**/docs/**/*'
22
+ - '**/imagemagick/*'
23
+ - '**/pkg/**/*'
24
+ - '**/vendor/**/*'
25
+
26
+
27
+ # Disabled Cops
2
28
  Style/FrozenStringLiteralComment:
3
29
  Enabled: false
4
30
 
5
31
  Style/StringConcatenation:
6
32
  Enabled: false
7
-
8
- # New cops, enabled. We aren't using the 'NewCops' setting because then rubocop
9
- # updates can break our CI.
10
- Layout/EmptyLinesAroundAttributeAccessor:
11
- Enabled: true
12
- Layout/SpaceAroundMethodCallOperator:
13
- Enabled: true
14
- Lint/BinaryOperatorWithIdenticalOperands:
15
- Enabled: true
16
- Lint/DeprecatedOpenSSLConstant:
17
- Enabled: true
18
- Lint/DuplicateElsifCondition:
19
- Enabled: true
20
- Lint/DuplicateRescueException:
21
- Enabled: true
22
- Lint/EmptyConditionalBody:
23
- Enabled: true
24
- Lint/FloatComparison:
25
- Enabled: true
26
- Lint/MissingSuper:
27
- Enabled: true
28
- Lint/MixedRegexpCaptureTypes:
29
- Enabled: true
30
- Lint/OutOfRangeRegexpRef:
31
- Enabled: true
32
- Lint/RaiseException:
33
- Enabled: true
34
- Lint/SelfAssignment:
35
- Enabled: true
36
- Lint/StructNewOverride:
37
- Enabled: true
38
- Lint/TopLevelReturnWithArgument:
39
- Enabled: true
40
- Lint/UnreachableLoop:
41
- Enabled: true
42
- Style/AccessorGrouping:
43
- Enabled: true
44
- Style/ArrayCoercion:
45
- Enabled: true
46
- Style/BisectedAttrAccessor:
47
- Enabled: true
48
- Style/CaseLikeIf:
49
- Enabled: true
50
- Style/ExplicitBlockArgument:
51
- Enabled: true
52
- Style/ExponentialNotation:
53
- Enabled: true
54
- Style/GlobalStdStream:
55
- Enabled: true
56
- Style/HashAsLastArrayItem:
57
- Enabled: true
58
- Style/HashEachMethods:
59
- Enabled: true
60
- Style/HashLikeCase:
61
- Enabled: true
62
- Style/HashTransformKeys:
63
- Enabled: true
64
- Style/HashTransformValues:
65
- Enabled: true
66
- Style/OptionalBooleanParameter:
67
- Enabled: true
68
- Style/RedundantAssignment:
69
- Enabled: true
70
- Style/RedundantFetchBlock:
71
- Enabled: true
72
- Style/RedundantFileExtensionInRequire:
73
- Enabled: true
74
- Style/RedundantRegexpCharacterClass:
75
- Enabled: true
76
- Style/RedundantRegexpEscape:
77
- Enabled: true
78
- Style/SingleArgumentDig:
79
- Enabled: true
80
- Style/SlicingWithRange:
81
- Enabled: true
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.5.8
@@ -0,0 +1,2 @@
1
+ # if you run bundle install --binstubs, you won't have to use bundle exec all the time.
2
+ export PATH=$(git rev-parse --show-toplevel)/docs/bin:$PATH
@@ -2,7 +2,9 @@
2
2
  sort: 4
3
3
  ---
4
4
 
5
- # Code Guidelines
5
+ # Code
6
+
7
+ ## Guidelines
6
8
 
7
9
  * Generally, go for straightforward and readable rather than terse and clever. I'm not actually a
8
10
  very good programmer; I need simple code that's easy to understand.
@@ -38,7 +40,7 @@ criteria:
38
40
 
39
41
  * No rubocop warnings
40
42
 
41
- ### Thanks!
43
+ ## Thanks!
42
44
 
43
45
  As I said, don't let any of the rules & guidelines scare you away. They're the rules for merging
44
46
  into master, not submitting a pull request. I'm thrilled to receive any help at all.
@@ -4,10 +4,28 @@ sort: 2
4
4
 
5
5
  # Docs
6
6
 
7
- They run on github pages, which is based on jekyll. You can preview as you edit:
7
+ The docs are a mini-project in the docs folder. They don't have a dedicated git repository, but they
8
+ do have their own Gemfile. They run on Github Pages, which is based on Jekyll.
8
9
 
9
- 0. Follow the [setup instructions](setup)
10
- 1. `$ cd docs`
11
- 2. `$ bundle install`
12
- 3. `$ bundle exec jekyll serve`
13
- 4. In a web browser, navigate to `localhost:4000/jekyll_picture_tag/`
10
+ The format is simple; markdown files with a few lines of metadata at the top, organized into
11
+ subdirectories. We're using the [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/).
12
+
13
+ You can preview as you edit; first the setup:
14
+
15
+ ``` sh
16
+ $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git # if you haven't already
17
+ $ cd jekyll_picture_tag/docs
18
+ $ direnv allow # (optional)
19
+ $ bundle install --binstubs # --binstubs is optional.
20
+ ```
21
+
22
+ If you use direnv or add `docs/bin` to your `PATH` another way, the `--binstubs` flag allows you to
23
+ skip `bundle exec`.
24
+
25
+ To preview:
26
+
27
+ ``` sh
28
+ $ jekyll serve --livereload # (prefix with `bundle exec` if necessary)
29
+ ```
30
+
31
+ * In a web browser, navigate to `localhost:4000/jekyll_picture_tag/`
@@ -4,10 +4,30 @@ sort: 1
4
4
 
5
5
  ## Setup
6
6
 
7
- It's pretty standard:
7
+ I use [asdf](https://github.com/asdf-vm/asdf) and [direnv](https://direnv.net/) (via
8
+ [asdf-direnv](https://github.com/asdf-community/asdf-direnv)). They add convenience, but they aren't
9
+ required by any means.
8
10
 
11
+ ### With asdf & direnv:
12
+
13
+ ```sh
14
+ $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git
15
+ $ cd jekyll_picture_tag
16
+ $ direnv allow
17
+ $ asdf install
18
+ $ bundle install --binstubs
9
19
  ```
20
+
21
+ ### Without asdf & direnv
22
+
23
+ ```sh
10
24
  $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git
11
25
  $ cd jekyll_picture_tag
26
+ # Install the correct version of ruby, with the bundler gem.
12
27
  $ bundle install
13
28
  ```
29
+
30
+ * The currently targeted ruby version can be found in the `.ruby-version` file in the project root;
31
+ ensure your version manager of choice knows about it.
32
+ * If you add the project's `bin/` folder to your path, and run `bundle install --binstubs`, you won't
33
+ have to use `bundle exec` for `rake` commands and such.
@@ -2,38 +2,31 @@
2
2
  sort: 3
3
3
  ---
4
4
 
5
- ## How to run the tests
6
-
7
- You probably only need to use docker if it's inconvenient to install ImageMagick 7.
8
-
9
- ### Bare Metal
10
-
11
- ```note
12
- Depending on your environment, you may need to prefix all rake commands with
13
- `bundle exec`.
14
- ```
15
-
16
- `rake test` runs the test suite (both unit tests and integration tests). Ignore the mini_magick
17
- `method redefined` warnings (unless you know how to fix them?)
18
-
19
- `rake unit` runs just the unit tests, while `rake integration` runs the integration tests. The unit
20
- test coverage isn't stellar, but both unit and integration tests together hit 100%.
21
-
22
- Speaking of coverage, simplecov is set up -- you'll get a measurement of coverage in the test output
23
- and a nice report in the `coverage` directory. I'd like to move to mutation based coverage testing,
24
- but that's a project for another day.
25
-
26
- The tests do output a few images to the `/tmp/` directory, which I'm pretty sure means it won't work
27
- on Windows. This is fixable if there is a need, so if that gets in your way just ask.
28
-
29
- `rake rubocop` checks code formatting, `rake rubocop:auto_correct` will try to fix any rubocop
30
- issues, if possible.
31
-
32
- `rake` will run all tests and rubocop.
5
+ # Tests
6
+
7
+ The primary way to run these checks is `rake`:
8
+
9
+ | rake command | function |
10
+ |-----------------------------|---------------------------------|
11
+ | `rake unit` | Unit tests only |
12
+ | `rake integration` | Integration tests only |
13
+ | `rake test` | Both unit and integration tests |
14
+ | `rake rubocop` | Check code formatting |
15
+ | `rake rubocop:auto_correct` | Fix rubocop issues, if possible |
16
+ | `rake` | Run all checks |
17
+
18
+ * Ignore the mini_magick `method redefined` warnings (unless you know how to fix them?)
19
+ * Depending on your environment, you may need to prefix all rake commands with `bundle exec`
20
+ * Simplecov is set up -- you'll get a measurement of coverage in the test output and a nice report
21
+ in the `coverage` directory.
22
+ * The tests use the `/tmp/` directory directly, which I'm pretty sure means it won't work on
23
+ Windows. This is fixable, so if that gets in your way just ask.
33
24
 
34
25
  ### Docker
35
26
 
36
- The following commands will build and run the tests inside a docker image.
27
+ The tests use some features of ImageMagick 7 which are not supported by version 6. If it's
28
+ inconvenient to install version 7, the following commands will build and run the tests in a docker
29
+ container:
37
30
 
38
31
  ```bash
39
32
  $ docker build . -t jpt
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  ---
3
3
  # Release History
4
+ * 1.14.0 January 10, 2021
5
+ * Gracefully handle empty tag arguments.
6
+ * Re-add metadata stripping. I removed it inadvertently when refactoring; now
7
+ there's a test and a setting to turn it off.
8
+ * Respect Jekyll's `--disable-disk-cache` argument.
9
+ * Add baseurl configuration, allowing increased plugin support (such as I18n via `jekyll-multiple-languages-plugin`)
10
+ * Tooling & test suite maintenance and improvements.
4
11
  * 1.13.0 November 23, 2020
5
12
  * Add image quality interpolation; allows for variable image quality based on image size.
6
13
  * Bugfix: Perform format, resize, and quality changes simultaneously rather than individually.
@@ -49,12 +56,12 @@
49
56
  * link_source will now target the base source image, rather than finding the
50
57
  biggest one.
51
58
  * Remove fastimage dependency, add addressable dependency.
52
- * Moderately significant refactoring and code cleanup
59
+ * Moderately significant refactoring and code cleanup
53
60
  * Decent set of tests added
54
61
  * 1.6.0 Jul 2, 2019:
55
62
  * Missing Preset warning respects `data_dir` setting
56
63
  * Add `continue_on_missing` option
57
- * 1.5.0 Jun 26, 2019:
64
+ * 1.5.0 Jun 26, 2019:
58
65
  * better `{::nomarkdown}` necessity detection
59
66
  * allow user to override `{::nomarkdown}` autodetection
60
67
  * 1.4.0 Jun 26, 2019:
@@ -77,7 +84,7 @@
77
84
  * auto-orient images before stripping metadata
78
85
  * 1.0.2 Jan 18, 2019: Fix ruby version specification
79
86
  * 1.0.1 Jan 13, 2019: Added ruby version checking
80
- * **1.0.0** Nov 27, 2018: Rewrite from the ground up. See the
87
+ * **1.0.0** Nov 27, 2018: Rewrite from the ground up. See the
81
88
  * [migration guide]({{ site.baseurl }}/users/notes/migration).
82
89
  * 0.2.2 Aug 2, 2013: Bugfixes
83
90
  * 0.2.1 Jul 17, 2013: Refactor again, add Liquid parsing.
@@ -1,5 +1,5 @@
1
1
  ---
2
- sort: 7
2
+ sort: 5
3
3
  ---
4
4
 
5
5
  # Disable Jekyll Picture Tag
@@ -1,5 +1,5 @@
1
1
  ---
2
- sort: 3
2
+ sort: 4
3
3
  ---
4
4
 
5
5
  # Ignore Missing Source Images
@@ -1,5 +1,5 @@
1
1
  ---
2
- sort: 8
2
+ sort: 6
3
3
  ---
4
4
 
5
5
  # Kramdown Fix
@@ -1,5 +1,5 @@
1
1
  ---
2
- sort: 2
2
+ sort: 3
3
3
  ---
4
4
 
5
5
  # Suppress Warnings
@@ -0,0 +1,69 @@
1
+ ---
2
+ sort: 2
3
+ ---
4
+
5
+ # URLs
6
+
7
+ ## Relative or Absolute
8
+
9
+ *Format:* `relative_url: (true|false)`
10
+
11
+ *Example:* `relative_url: false`
12
+
13
+ *Default*: `true`
14
+
15
+ Whether to use relative (`/generated/test(...).jpg`) or absolute
16
+ (`https://example.com/generated/test(...).jpg`) urls in your src and srcset attributes.
17
+
18
+ ## Baseurl Key
19
+
20
+ *Format:* `baseurl_key: (string)`
21
+
22
+ *Example:* `baseurl_key: baseurl_root`
23
+
24
+ *Default*: `baseurl`
25
+
26
+ Some plugins, such as
27
+ [jekyll-multiple-languages-plugin](https://github.com/kurtsson/jekyll-multiple-languages-plugin),
28
+ work by modifying the standard `baseurl` setting, which can break JPT's images. It offers a new
29
+ setting, `baseurl_root`, which serves as the original `baseurl` setting without a language prefix.
30
+ Using `baseurl_key`, you can direct JPT to use that setting instead.
31
+
32
+ ## Ignore Baseurl
33
+
34
+ *Format:* `ignore_baseurl: (true|false)`
35
+
36
+ *Example:* `ignore_baseurl: true`
37
+
38
+ *Default*: `false`
39
+
40
+ Depending on your other plugins and configuration, it may be useful for JPT to ignore the baseurl
41
+ setting entirely.
42
+
43
+ ## CDN URL
44
+
45
+ Use for images that are hosted at a different domain or subdomain than the Jekyll site root.
46
+ Overrides `relative_url`.
47
+
48
+ *Format:* `cdn_url: (url)`
49
+
50
+ *Example:* `cdn_url: https://cdn.example.com`
51
+
52
+ *Default*: none
53
+
54
+ ## CDN Environments
55
+
56
+ It's likely that if you're using a CDN, you may not want to use it in your local development
57
+ environment. This allows you to build a site with local images while in development, and still push
58
+ to a CDN when you build for production by specifying a different
59
+ [environment](https://jekyllrb.com/docs/configuration/environments/).
60
+
61
+ *Format:* `cdn_environments: (array of strings)`
62
+
63
+ *Example:* `cdn_environments: ['production', 'staging']`
64
+
65
+ *Default*: `['production']`
66
+
67
+ **Note that the default jekyll environment is `development`**, meaning that if you only set
68
+ `cdn_url` and run `jekyll serve` or `jekyll build`, nothing will change. Either run
69
+ `JEKYLL_ENV=production bundle exec jekyll build`, or add `development` to this setting.
@@ -1,5 +1,5 @@
1
1
  ---
2
- sort: 13
2
+ sort: 14
3
3
  ---
4
4
 
5
5
  # Default preset
@@ -20,4 +20,5 @@ presets:
20
20
  data_sizes: true
21
21
  gravity: center
22
22
  dimension_attributes: false
23
+ strip_metadata: true
23
24
  ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- sort: 12
2
+ sort: 13
3
3
  ---
4
4
  # Example _data/picture.yml
5
5
 
@@ -0,0 +1,13 @@
1
+ ---
2
+ sort: 12
3
+ ---
4
+
5
+ # Strip Metadata
6
+
7
+ _Format:_ `strip_metadata: (true|false)`
8
+
9
+ _Example:_ `strip_metadata: false`
10
+
11
+ _Default:_ `true`
12
+
13
+ Remove EXIF data, which can save a few tens of kilobytes per image.
@@ -0,0 +1,23 @@
1
+ # Configure and install imagemagick; detects if cached compiled version exists.
2
+
3
+ check_cached() {
4
+ [ "$(find . -name '*.o')" ]
5
+ }
6
+
7
+ build_im() {
8
+ git clone 'https://github.com/ImageMagick/ImageMagick' ./ \
9
+ --branch "$imagemagick_version"
10
+
11
+ rm -rf '.git'
12
+
13
+ ./configure
14
+ make
15
+ }
16
+
17
+ [ -d 'imagemagick' ] || mkdir imagemagick
18
+ cd imagemagick
19
+
20
+ check_cached || build_im
21
+
22
+ sudo make install
23
+ sudo ldconfig /usr/local/lib
@@ -29,12 +29,17 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency 'bundler', '~> 2.0'
31
31
  spec.add_development_dependency 'minitest', '~> 5.11'
32
+ spec.add_development_dependency 'minitest-rg'
32
33
  spec.add_development_dependency 'mocha', '~> 1.9'
33
34
  spec.add_development_dependency 'nokogiri', '~> 1.10'
34
35
  spec.add_development_dependency 'pry'
35
36
  spec.add_development_dependency 'rake', '~> 12.3'
36
- spec.add_development_dependency 'rubocop', '~> 0.8'
37
- spec.add_development_dependency 'simplecov'
37
+ spec.add_development_dependency 'rubocop', '~> 1.7.0'
38
+ spec.add_development_dependency 'rubocop-minitest', '~> 0.10.0'
39
+ spec.add_development_dependency 'rubocop-performance', '~> 1.9.0'
40
+ spec.add_development_dependency 'rubocop-rake', '~> 0.5.0'
41
+
42
+ spec.add_development_dependency 'simplecov', '~> 0.20.0'
38
43
  spec.add_development_dependency 'solargraph'
39
44
 
40
45
  spec.add_dependency 'addressable', '~> 2.6'
@@ -50,6 +50,7 @@ module PictureTag
50
50
  # care about the params (arguments passed to the liquid tag). Jekyll makes
51
51
  # no attempt to parse them; they're given as a string.
52
52
  def initialize(tag_name, raw_params, tokens)
53
+ Utils.warning 'You have called JPT without any arguments.' if raw_params.empty?
53
54
  @raw_params = raw_params
54
55
  super
55
56
  end
@@ -60,7 +61,7 @@ module PictureTag
60
61
  def render(context)
61
62
  setup(context)
62
63
 
63
- if PictureTag.disabled?
64
+ if PictureTag.disabled? || @raw_params.empty?
64
65
  ''
65
66
  else
66
67
  PictureTag.output_class.new.to_s
@@ -20,6 +20,8 @@ module PictureTag
20
20
 
21
21
  # Call after updating data.
22
22
  def write
23
+ return if PictureTag.site.config['disable_disk_cache']
24
+
23
25
  FileUtils.mkdir_p(File.join(base_directory, sub_directory))
24
26
 
25
27
  File.open(filename, 'w+') do |f|
@@ -9,3 +9,5 @@ picture:
9
9
  ignore_missing_images: false
10
10
  disabled: false
11
11
  fast_build: false
12
+ ignore_baseurl: false
13
+ baseurl_key: 'baseurl'
@@ -9,3 +9,4 @@ quality: 75
9
9
  data_sizes: true
10
10
  gravity: center
11
11
  dimension_attributes: false
12
+ strip_metadata: true
@@ -81,24 +81,27 @@ module PictureTag
81
81
  @id ||= Digest::MD5.hexdigest([@source.digest, @crop, @gravity, quality].join)[0..8]
82
82
  end
83
83
 
84
- # Post crop, before resizing and reformatting
85
84
  def image
86
- @image ||= open_image
85
+ return @image if defined? @image
86
+
87
+ # Post crop, before resizing and reformatting
88
+ @source_dimensions = { width: image_base.width, height: image_base.height }
89
+
90
+ @image = image_base
87
91
  end
88
92
 
89
- def open_image
90
- image_base = Image.open(@source.name)
91
- image_base.combine_options do |i|
92
- i.auto_orient
93
+ def image_base
94
+ @image_base ||= Image.open(@source.name).combine_options do |i|
95
+ if PictureTag.preset['strip_metadata']
96
+ i.auto_orient
97
+ i.strip
98
+ end
99
+
93
100
  if @crop
94
101
  i.gravity @gravity
95
102
  i.crop @crop
96
103
  end
97
104
  end
98
-
99
- @source_dimensions = { width: image_base.width, height: image_base.height }
100
-
101
- image_base
102
105
  end
103
106
 
104
107
  def generate_image
@@ -41,7 +41,9 @@ module PictureTag
41
41
  # ^^^^^^^^^^^^^
42
42
  # | domain | baseurl | directory | filename
43
43
  def baseurl
44
- PictureTag.config['baseurl'] || ''
44
+ return '' if PictureTag.pconfig['ignore_baseurl']
45
+
46
+ PictureTag.config[PictureTag.pconfig['baseurl_key']] || ''
45
47
  end
46
48
 
47
49
  # https://example.com/my-base-path/assets/generated-images/image.jpg
@@ -1,3 +1,3 @@
1
1
  module PictureTag
2
- VERSION = '1.13.0'.freeze
2
+ VERSION = '1.14.0'.freeze
3
3
  end
data/readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Jekyll Picture Tag
2
2
 
3
+ ![Tests & Formatting](https://github.com/rbuchberger/jekyll_picture_tag/workflows/Tests%20&%20Formatting/badge.svg)
4
+
3
5
  **Responsive Images done correctly.**
4
6
 
5
7
  It's simple to throw a photo on a page and call it a day, but doing justice to users on all
@@ -24,7 +26,7 @@ different image entirely.
24
26
 
25
27
  **Developer Sanity:** If you want to serve multiple images in multiple formats and resolutions, you
26
28
  have a litany of markup to write and a big pile of images to generate and organize. Jekyll Picture
27
- Tag is your responsive images minion - give it simple instructions and it'll handle the rest.
29
+ Tag is your responsive images minion - give it simple instructions and it'll handle the rest.
28
30
 
29
31
  ## Features
30
32
 
@@ -41,14 +43,15 @@ https://rbuchberger.github.io/jekyll_picture_tag/
41
43
 
42
44
  https://rbuchberger.github.io/jekyll_picture_tag/devs/releases
43
45
 
44
- Latest versions:
46
+ Recent releases:
45
47
 
46
- * 1.13.0 November 23, 2020
47
- * Add image quality interpolation; allows for variable image quality based on image size.
48
- * Bugfix: Perform format, resize, and quality changes simultaneously rather than individually.
49
- * Allows for actual lossless webp: simply set quality to 100.
50
- * Improves fresh (no cached images) build times by ~15%
51
- * Fix problems with poor image quality.
48
+ * 1.14.0 January 10, 2021
49
+ * Gracefully handle empty tag arguments.
50
+ * Re-add metadata stripping. I removed it inadvertently when refactoring; now
51
+ there's a test and a setting to turn it off.
52
+ * Respect Jekyll's `--disable-disk-cache` argument.
53
+ * Add baseurl configuration, allowing increased plugin support (such as I18n via `jekyll-multiple-languages-plugin`)
54
+ * Tooling & test suite maintenance and improvements.
52
55
 
53
56
  ## Help Wanted
54
57
 
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: 1.13.0
4
+ version: 1.14.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: 2020-11-23 00:00:00.000000000 Z
13
+ date: 2021-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -40,6 +40,20 @@ dependencies:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5.11'
43
+ - !ruby/object:Gem::Dependency
44
+ name: minitest-rg
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
43
57
  - !ruby/object:Gem::Dependency
44
58
  name: mocha
45
59
  requirement: !ruby/object:Gem::Requirement
@@ -102,28 +116,70 @@ dependencies:
102
116
  requirements:
103
117
  - - "~>"
104
118
  - !ruby/object:Gem::Version
105
- version: '0.8'
119
+ version: 1.7.0
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 1.7.0
127
+ - !ruby/object:Gem::Dependency
128
+ name: rubocop-minitest
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: 0.10.0
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: 0.10.0
141
+ - !ruby/object:Gem::Dependency
142
+ name: rubocop-performance
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: 1.9.0
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: 1.9.0
155
+ - !ruby/object:Gem::Dependency
156
+ name: rubocop-rake
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: 0.5.0
106
162
  type: :development
107
163
  prerelease: false
108
164
  version_requirements: !ruby/object:Gem::Requirement
109
165
  requirements:
110
166
  - - "~>"
111
167
  - !ruby/object:Gem::Version
112
- version: '0.8'
168
+ version: 0.5.0
113
169
  - !ruby/object:Gem::Dependency
114
170
  name: simplecov
115
171
  requirement: !ruby/object:Gem::Requirement
116
172
  requirements:
117
- - - ">="
173
+ - - "~>"
118
174
  - !ruby/object:Gem::Version
119
- version: '0'
175
+ version: 0.20.0
120
176
  type: :development
121
177
  prerelease: false
122
178
  version_requirements: !ruby/object:Gem::Requirement
123
179
  requirements:
124
- - - ">="
180
+ - - "~>"
125
181
  - !ruby/object:Gem::Version
126
- version: '0'
182
+ version: 0.20.0
127
183
  - !ruby/object:Gem::Dependency
128
184
  name: solargraph
129
185
  requirement: !ruby/object:Gem::Requirement
@@ -220,15 +276,17 @@ executables: []
220
276
  extensions: []
221
277
  extra_rdoc_files: []
222
278
  files:
279
+ - ".envrc"
280
+ - ".github/workflows/code-checks.yml"
223
281
  - ".gitignore"
224
282
  - ".rubocop.yml"
225
283
  - ".ruby-version"
226
284
  - ".solargraph.yml"
227
- - ".travis.yml"
228
285
  - Dockerfile
229
286
  - Gemfile
230
287
  - LICENSE.txt
231
288
  - Rakefile
289
+ - docs/.envrc
232
290
  - docs/Gemfile
233
291
  - docs/Gemfile.lock
234
292
  - docs/_config.yml
@@ -240,15 +298,14 @@ files:
240
298
  - docs/devs/index.md
241
299
  - docs/devs/releases.md
242
300
  - docs/index.md
243
- - docs/users/configuration/cdn.md
244
301
  - docs/users/configuration/directories.md
245
302
  - docs/users/configuration/disable.md
246
303
  - docs/users/configuration/fast_build.md
247
304
  - docs/users/configuration/ignore_missing.md
248
305
  - docs/users/configuration/index.md
249
306
  - docs/users/configuration/kramdown_fix.md
250
- - docs/users/configuration/relative_urls.md
251
307
  - docs/users/configuration/suppress_warnings.md
308
+ - docs/users/configuration/urls.md
252
309
  - docs/users/index.md
253
310
  - docs/users/installation.md
254
311
  - docs/users/liquid_tag/argument_reference/alternate_images.md
@@ -285,8 +342,10 @@ files:
285
342
  - docs/users/presets/nomarkdown_override.md
286
343
  - docs/users/presets/pixel_ratio_srcsets.md
287
344
  - docs/users/presets/quality_width_graph.png
345
+ - docs/users/presets/strip_metadata.md
288
346
  - docs/users/presets/width_height_attributes.md
289
347
  - docs/users/presets/width_srcsets.md
348
+ - install_imagemagick.sh
290
349
  - jekyll-picture-tag.gemspec
291
350
  - jekyll_picture_tag.gemspec
292
351
  - lib/jekyll-picture-tag.rb
@@ -350,7 +409,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
409
  - !ruby/object:Gem::Version
351
410
  version: '0'
352
411
  requirements: []
353
- rubygems_version: 3.1.4
412
+ rubyforge_project:
413
+ rubygems_version: 2.7.6.2
354
414
  signing_key:
355
415
  specification_version: 4
356
416
  summary: Easy responsive images for Jekyll.
@@ -1,8 +0,0 @@
1
- services:
2
- - docker
3
-
4
- before_install:
5
- - docker build . -t jpt
6
-
7
- script:
8
- - docker run -t jpt
@@ -1,35 +0,0 @@
1
- ---
2
- sort: 5
3
- ---
4
-
5
- # CDN
6
-
7
- Use for images that are hosted at a different domain or subdomain than the
8
- Jekyll site root. Overrides `relative_url`.
9
-
10
- ## URL
11
-
12
- *Format:* `cdn_url: (url)`
13
-
14
- *Example:* `cdn_url: https://cdn.example.com`
15
-
16
- *Default*: none
17
-
18
- ## Environments
19
-
20
- It's likely that if you're using a CDN, you may not want to use it in your local
21
- development environment. This allows you to build a site with local images while
22
- in development, and still push to a CDN when you build for production by
23
- specifying a different
24
- [environment](https://jekyllrb.com/docs/configuration/environments/).
25
-
26
- *Format:* `cdn_environments: (array of strings)`
27
-
28
- *Example:* `cdn_environments: ['production', 'staging']`
29
-
30
- *Default*: `['production']`
31
-
32
- **Note that the default jekyll environment is `development`**, meaning that if
33
- you only set `cdn_url` and run `jekyll serve` or `jekyll build`, nothing will
34
- change. Either run `JEKYLL_ENV=production bundle exec jekyll build`, or add
35
- `development` to this setting.
@@ -1,15 +0,0 @@
1
- ---
2
- sort: 6
3
- ---
4
-
5
- # Use Relative Urls
6
-
7
- *Format:* `relative_url: (true|false)`
8
-
9
- *Example:* `relative_url: false`
10
-
11
- *Default*: `true`
12
-
13
- Whether to use relative (`/generated/test(...).jpg`) or absolute
14
- (`https://example.com/generated/test(...).jpg`) urls in your src and srcset
15
- attributes.