jekyll_img 0.1.5 → 0.2.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: 680dc86da728e4001fcbaf29a400b217690bd0242dd64a85a38e803286e0caa6
4
- data.tar.gz: 53e917f32db474dd507794e8467cd5e1fc6e3036428133e1b27f48fea0be4e4b
3
+ metadata.gz: 4f1c3ada28bfae9fa70ff421baa912391a64af4c156055e0f40438d6219c986b
4
+ data.tar.gz: 6915f59b67c6c0de7d91821553b4ecb7f246596f295d128ba6a850b6ddfb35af
5
5
  SHA512:
6
- metadata.gz: c1792d517f0913bf3ef12a2c116e27f02d35ba56cf783d2bb230f0258c388a58861ad7e212783e4745f9a4ca261193e327d86fb965f2a576525ab54ae607c42b
7
- data.tar.gz: 1c7f2ecc873f7b625bf18e42f50c191ccfeee09dcbc2a4a502b3f02ad8d81f1488730a51b9e9beb5580c13791e5bf1f784810aa4031d3c180db4d4075dd6940a
6
+ metadata.gz: 0c8281613ba38488ce8b32ac074abca3ce3ed7310d0fd70a0f6d78c87039b66a40b25775172ff88e910dcdb09cd9b78549bf4a1773a982e5a8c23f2109679f0d
7
+ data.tar.gz: 8ada70004b3b1328372f2675ed7b80edf1c6b9a1b2fdd44154a2ad40af1d9d1a64bbda2d53034394c860b79fd9489b74de4dd4542f9daf6db6be534df13e7c85
data/.rubocop.yml CHANGED
@@ -11,15 +11,17 @@ require:
11
11
  AllCops:
12
12
  Exclude:
13
13
  - vendor/**/*
14
- - exe/**/*
14
+ - binstub/**/*
15
15
  - Gemfile*
16
16
  - Rakefile
17
17
  NewCops: enable
18
- TargetRubyVersion: 2.6
19
18
 
20
19
  Gemspec/DeprecatedAttributeAssignment:
21
20
  Enabled: false
22
21
 
22
+ Gemspec/RequiredRubyVersion:
23
+ Enabled: false
24
+
23
25
  Gemspec/RequireMFA:
24
26
  Enabled: false
25
27
 
@@ -42,7 +44,7 @@ Lint/RedundantCopDisableDirective:
42
44
  - jekyll_img.gemspec
43
45
 
44
46
  Metrics/AbcSize:
45
- Max: 45
47
+ Max: 60
46
48
 
47
49
  Metrics/BlockLength:
48
50
  Max: 30
@@ -54,7 +56,7 @@ Metrics/CyclomaticComplexity:
54
56
  Max: 10
55
57
 
56
58
  Metrics/MethodLength:
57
- Max: 30
59
+ Max: 40
58
60
 
59
61
  Metrics/PerceivedComplexity:
60
62
  Max: 10
data/CHANGELOG.md CHANGED
@@ -1,16 +1,58 @@
1
+ # Change Log
2
+
3
+ ## 0.2.0 / 2023-11-20
4
+
5
+ * The [demo/](demo/) webapp has been upgraded to the latest features.
6
+ * Improved error messages.
7
+ * Renamed the `img` section of `_config.yml` to `jekyll_img`.
8
+ * Renamed `continue_on_error` to `die_on_img_error` and reversed the meaning.
9
+ * Now dependant on `jekyll_plugin_support` v0.8.0 or later, which had several breaking changes.
10
+ * CSS for this plugin is now defined in `demo/assets/css/jekyll_img.css`.
11
+ * Added a `pry_on_img_error` setting, which causes the `pry` debugger to be invoked when an `ImgError` is raised.
12
+ `pry` is now opened when an `ImgError` is raised if `_config.yml` contains:
13
+
14
+ ```yaml
15
+ jekyll_img:
16
+ pry_on_img_error: true
17
+ ```
18
+
19
+ ## 0.1.6 / 2023-08-10
20
+
21
+ * `.webp` file type is assumed and no longer needs to be specified.
22
+ For example, instead of writing this:
23
+
24
+ ```html
25
+ {% img src="blah.webp" %}
26
+ ```
27
+
28
+ You can now write:
29
+
30
+ ```html
31
+ {% img src="blah" %}
32
+ ```
33
+
34
+
1
35
  ## 0.1.5 / 2023-05-30
2
- * Updated dependencies
36
+
37
+ * Updated dependencies
38
+
3
39
 
4
40
  ## 0.1.4 / 2023-04-02
5
- * Added [`attribution` support](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
6
- * Fixed `style=' false'` that appeared when the `style` and `wrapper_style` attributes were not provided.
41
+
42
+ * Added [`attribution` support](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
43
+ * Fixed `style=' false'` that appeared when the `style` and `wrapper_style` attributes were not provided.
44
+
7
45
 
8
46
  ## 0.1.3 / 2023-02-22
9
- * Added `img/continue_on_error` configuration parameter.
47
+
48
+ * Added `img/continue_on_error` configuration parameter.
49
+
10
50
 
11
51
  ## 0.1.2 / 2023-02-14
12
- * Fixed `img_props.rb:91:in `size_unit_specified?': undefined method `end_with?' for false:FalseClass (NoMethodError)`
52
+
53
+ * Fixed `img_props.rb:91:in size_unit_specified?: undefined method end_with? for false:FalseClass (NoMethodError)`
13
54
 
14
55
 
15
56
  ## 0.1.1 / 2023-02-12
16
- * Initial release
57
+
58
+ * Initial release
data/README.md CHANGED
@@ -1,61 +1,116 @@
1
- `jekyll_img`
2
- [![Gem Version](https://badge.fury.io/rb/jekyll_img.svg)](https://badge.fury.io/rb/jekyll_img)
3
- ===========
1
+ # `jekyll_img` [![Gem Version](https://badge.fury.io/rb/jekyll_img.svg)](https://badge.fury.io/rb/jekyll_img)
2
+
4
3
 
5
4
  `Jekyll_img` is a Jekyll plugin that embeds images in HTML documents, with alignment options,
6
5
  flexible resizing, default styling, overridable styling, an optional caption, and an optional URL.
7
6
 
7
+ If you are not using `webp` images in your Jekyll website, this plugin is not for you.
8
+ Please read the next section for details.
9
+ If you have a use case that would benefit from expanding the supported file types,
10
+ please describe your use case on the [issue tracker](https://github.com/mslinn/jekyll_img/issues/5).
11
+
8
12
  See [demo/index.html](demo/index.html) for examples.
9
13
 
14
+
15
+ ## Image Fallback
16
+
17
+ This plugin provides support for the
18
+ [`webp`](https://developers.google.com/speed/webp) image format,
19
+ with a fallback to `png` format by using the HTML
20
+ [`picture`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture) element.
21
+
22
+ This means that 2 versions of every image are required: a `webp` version, and a `png` version.
23
+
24
+ You specify the desired image with a `webp` filetype (or no filetype),
25
+ and the plugin generates a `picture` element that contains a primary
26
+ `source` sub-element that specifies the given image URL,
27
+ and a secondary `img` sub-element with a [`png`](https://en.wikipedia.org/wiki/PNG) filetype.
28
+
29
+ For example, these two invocations yield the same result:
30
+
31
+ ```html
32
+ {% img src="blah" %}
33
+ {% img src="blah.webp" %}
34
+ ```
35
+
36
+ The above generates the following
37
+ (to support the other options, the generated HTML can be a lot more complex):
38
+
39
+ ```html
40
+ <picture>
41
+ <source srcset="blah.webp" type="image/webp" />
42
+ <source srcset="blah.png" type="image/png" />
43
+ <img src="blah.png" />
44
+ </picture>
45
+ ```
46
+
47
+ The above would fetch and display `blah.webp` if the web browser supported `webp` format,
48
+ otherwise it would fetch and display `blah.png`.
49
+
50
+
51
+ ## Demo
52
+
10
53
  Run the demo website by typing:
54
+
11
55
  ```shell
12
56
  $ demo/_bin/debug -r
13
57
  ```
58
+
14
59
  ... and point your web browser to http://localhost:4444
15
60
 
16
61
 
17
62
  ## Usage
18
- {% img [Options] src='path' %}
63
+
64
+ ```html
65
+ {% img [Options] src='path' %}
66
+ ```
19
67
 
20
68
  `Options` are:
21
69
 
22
- - `attribution` See [`jekyll_plugin_support`](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
23
- - `align="left|inline|right|center"` Default value is `inline`
24
- - `alt="Alt text"` Default value is the `caption` text, if provided
25
- - `caption="A caption"` No default value
26
- - `classes="class1 class2 classN"` Extra &lt;img&gt; classes; default is `rounded shadow`
27
- - `id="someId"` No default value
28
- - `nofollow` Generates `rel='nofollow'`; only applicable when `url` is specified
29
- - `size='eighthsize|fullsize|halfsize|initial|quartersize|XXXYY|XXX%'`
70
+ - `attribution` See [`jekyll_plugin_support`](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
71
+ - `align="left|inline|right|center"` Default value is `inline`
72
+ - `alt="Alt text"` Default value is the `caption` text, if provided
73
+ - `caption="A caption"` No default value
74
+ - `classes="class1 class2 classN"` Extra &lt;img&gt; classes; default is `rounded shadow`
75
+ - `id="someId"` No default value
76
+ - `nofollow` Generates `rel='nofollow'`; only applicable when `url` is specified
77
+ - `size='eighthsize|fullsize|halfsize|initial|quartersize|XXXYY|XXX%'`
30
78
  Defines width of image.
31
- - `initial` is the default behavior.
32
- - `eighthsize`, `fullsize`, `halfsize`, and `quartersize` are relative to the enclosing tag's width.
33
- - CSS units can also be used, for those cases `XXX` is a float and `YY` is `unit` (see below)
34
- - `style='css goes here'` CSS style for &lt;img&gt;; no default
35
- - `target='none|whatever'` Only applicable when `url` is specified; default value is `_blank`
36
- - `title="A title"` Default value is `caption` text, if provided
37
- - `url='https://domain.com'` No default value
38
- - `wrapper_class='class1 class2 classN'` Extra CSS classes for wrapper &lt;div&gt;; no default value
39
- - `wrapper_style='background-color: black;'` CSS style for wrapper &lt;div&gt;; no default value
40
-
41
- [`unit`](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numbers_lengths_and_percentages) is one of: `Q`, `ch`, `cm`, `em`, `dvh`, `dvw`, `ex`, `in`, `lh`,
79
+ - `initial` is the default behavior.
80
+ - `eighthsize`, `fullsize`, `halfsize`, and `quartersize` are relative to the enclosing tag's width.
81
+ - CSS units can also be used, for those cases `XXX` is a float and `YY` is `unit` (see below)
82
+ - `style='css goes here'` CSS style for &lt;img&gt;; no default
83
+ - `target='none|whatever'` Only applicable when `url` is specified; default value is `_blank`
84
+ - `title="A title"` Default value is `caption` text, if provided
85
+ - `url='https://domain.com'` No default value
86
+ - `wrapper_class='class1 class2 classN'` Extra CSS classes for wrapper &lt;div&gt;; no default value
87
+ - `wrapper_style='background-color: black;'` CSS style for wrapper &lt;div&gt;; no default value
88
+
89
+ [`unit`](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numbers_lengths_and_percentages)
90
+ is one of: `Q`, `ch`, `cm`, `em`, `dvh`, `dvw`, `ex`, `in`, `lh`,
42
91
  `lvh`, `lvw`, `mm`, `pc`, `px`, `pt`, `rem`, `rlh`, `svh`, `svw`, `vb`,
43
92
  `vh`, `vi`, `vmax`, `vmin`, or `vw`.
44
93
 
45
- CSS classes referenced by the `jekyll_img` plugin are at the bottom of [demo/assets/css/style.css](demo/assets/css/style.css). CSS marker classes are included, so CSS selectors can be used for additional styling.
94
+ CSS classes referenced by the `jekyll_img` plugin are in
95
+ [`demo/assets/css/jekyll_img.css`](demo/assets/css/jekyll_img.css) and
96
+ [`demo/assets/css/jekyll_plugin_support.css`](demo/assets/css/jekyll_plugin_support.css).
97
+ CSS marker classes are included, so CSS selectors can be used for additional styling.
46
98
 
47
99
 
48
100
  ## Configuration
49
- By default, any errors cause Jekyll to abort.
50
- You can allow Jekyll to continue by setting the following in `_config.yml`:
101
+
102
+ By default, errors cause Jekyll to abort.
103
+ You can allow Jekyll to halt by setting the following in `_config.yml`:
51
104
 
52
105
  ```yaml
53
- img:
54
- continue_on_error: true
106
+ jekyll_img:
107
+ die_on_img_error: true
108
+ pry_on_img_error: true
55
109
  ```
56
110
 
57
111
 
58
112
  ## Design
113
+
59
114
  The most significant design issue was the decision that image size and formatting should not change
60
115
  whether it had a caption.
61
116
  HTML captions exist within a `<figure />` element, which also surrounds the image.
@@ -67,10 +122,12 @@ CSS behavior differs for `<figure />` and `<img />`.
67
122
  For example, centering, floating right and left.
68
123
  That means the CSS and where it would need to be applied are completely different for
69
124
  naked `<img />` and `<figure />` tags.
70
- Handling all possible situations of these two scenarios would significantly raise the complexity of the plugin code. I know, because I went down that rabbit hole.
125
+ Handling all possible situations of these two scenarios would significantly raise the complexity of the plugin code.
126
+ I know, because I went down that rabbit hole.
71
127
 
72
128
 
73
129
  ### Wrapper &lt;div /&gt;
130
+
74
131
  To make the plugin code more manageable,
75
132
  the plugin always encloses the generated HTML & CSS within a wrapper `<div />`.
76
133
  The wrapper allows for a simple, consistent approach regardless of whether a caption is generated or not.
@@ -80,9 +137,12 @@ Within the wrapper `<div />`, the embedded `<img />` is displayed with `width=10
80
137
  If a caption is required, the generated `<figure />` only makes the space taken by the generated HTML longer;
81
138
  the image&rsquo;s width and height are not affected.
82
139
 
83
- The wrapper will not exceed the width of the tag that encloses it if the `size` parameter has values `eighthsize`, `fullsize`, `halfsize`, `initial` or `quartersize`.
140
+ The wrapper will not exceed the width of the tag that encloses it if the `size` parameter has values
141
+ `eighthsize`, `fullsize`, `halfsize`, `initial` or `quartersize`.
84
142
 
85
- The wrapper's width can be defined independently of its enclosing tag by using [CSS units](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numbers_lengths_and_percentages) for the `size` parameter:
143
+ The wrapper's width can be defined independently of its enclosing tag by using
144
+ [CSS units](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numbers_lengths_and_percentages)
145
+ for the `size` parameter:
86
146
  `Q`, `ch`, `cm`, `em`, `dvh`, `dvw`, `ex`, `in`, `lh`,
87
147
  `lvh`, `lvw`, `mm`, `pc`, `px`, `pt`, `rem`, `rlh`, `svh`, `svw`, `vb`,
88
148
  `vh`, `vi`, `vmax`, `vmin`, or `vw`.
@@ -101,21 +161,26 @@ end
101
161
 
102
162
  And then execute:
103
163
 
104
- $ bundle install
164
+ ```shell
165
+ $ bundle
166
+ ```
105
167
 
106
168
 
107
169
  ## Additional Information
170
+
108
171
  More information is available on
109
172
  [Mike Slinn&rsquo;s website](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
110
173
 
111
174
 
112
175
  ## Development
176
+
113
177
  After checking out the repo, run `bin/setup` to install dependencies.
114
178
 
115
179
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
116
180
 
117
181
 
118
182
  To build and install this gem onto your local machine, run:
183
+
119
184
  ```shell
120
185
  $ bundle exec rake install
121
186
  jekyll_img 0.1.0 built to pkg/jekyll_img-0.1.0.gem.
@@ -123,6 +188,7 @@ jekyll_img (0.1.0) installed.
123
188
  ```
124
189
 
125
190
  Examine the newly built gem:
191
+
126
192
  ```shell
127
193
  $ gem info jekyll_img
128
194
 
@@ -138,29 +204,49 @@ jekyll_img (0.1.0)
138
204
  Generates Jekyll logger with colored output.
139
205
  ```
140
206
 
207
+
208
+ ### Debugging
209
+
210
+ You can cause `pry` to open when an `ImgError` is raised by setting the following in `_config.yml`:
211
+
212
+ ```yaml
213
+ jekyll_img:
214
+ pry_on_img_error: true
215
+ ```
216
+
217
+
141
218
  ### Testing
219
+
142
220
  Examine the output by running:
221
+
143
222
  ```shell
144
223
  $ demo/_bin/debug -r
145
224
  ```
225
+
146
226
  ... and pointing your web browser to http://localhost:4444/
147
227
 
148
228
  ### Unit Tests
229
+
149
230
  Either run `rspec` from Visual Studio Code's *Run and Debug* environment
150
231
  (<kbd>Ctrl</kbd>-<kbd>shift</kbd>-<kbd>D</kbd>) and view the *Debug Console* output,
151
232
  or run it from the command line:
233
+
152
234
  ```shell
153
235
  $ rspec
154
236
  ```
155
237
 
156
238
  ### Build and Push to RubyGems
239
+
157
240
  To release a new version,
158
- 1. Update the version number in `version.rb`.
159
- 2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
160
- 3. Run the following:
161
- ```shell
162
- $ bundle exec rake release
163
- ```
241
+
242
+ 1. Update the version number in `version.rb`.
243
+ 2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
244
+ 3. Run the following:
245
+
246
+ ```shell
247
+ $ bundle exec rake release
248
+ ```
249
+
164
250
  The above creates a git tag for the version, commits the created tag,
165
251
  and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
166
252
 
data/jekyll_img.gemspec CHANGED
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.version = JekyllImgVersion::VERSION
30
30
 
31
31
  spec.add_dependency 'jekyll', '>= 3.5.0'
32
- spec.add_dependency 'jekyll_plugin_support', '>= 0.7.0'
32
+ spec.add_dependency 'jekyll_plugin_support', '>= 0.8.0'
33
33
  end
data/lib/img_props.rb CHANGED
@@ -1,12 +1,10 @@
1
- class ImgError < StandardError; end
2
-
3
1
  # Properties from user
4
2
  # All methods are idempotent.
5
3
  # attr_ methods can be called after compute_dependant_properties
6
4
  # All methods except compute_dependant_properties can be called in any order
7
5
  class ImgProperties
8
- attr_accessor :align, :alt, :attr_wrapper_align_class, :attribute, :attribution, :caption, :classes, :continue_on_error,
9
- :id, :img_display, :nofollow, :src, :size, :style, :target, :title,
6
+ attr_accessor :align, :alt, :attr_wrapper_align_class, :attribute, :attribution, :caption, :classes, :die_on_img_error,
7
+ :id, :img_display, :local_src, :nofollow, :src, :size, :style, :target, :title,
10
8
  :url, :wrapper_class, :wrapper_style
11
9
 
12
10
  SIZES = %w[eighthsize fullsize halfsize initial quartersize].freeze
@@ -33,7 +31,7 @@ class ImgProperties
33
31
 
34
32
  unless SIZES.include?(@size)
35
33
  msg = "'#{@size}' is not a recognized size; must be one of #{SIZES.join(', ')}, or an explicit unit."
36
- raise ImgError, msg
34
+ raise Jekyll::ImgError, msg
37
35
  end
38
36
  @size
39
37
  end
@@ -69,7 +67,7 @@ class ImgProperties
69
67
  end
70
68
 
71
69
  def src_png
72
- raise ImgError, "The 'src' parameter was not specified" if @src.to_s.empty?
70
+ raise Jekyll::ImgError, "The 'src' parameter was not specified" if @src.to_s.empty?
73
71
 
74
72
  @src.gsub('.webp', '.png')
75
73
  end
@@ -83,9 +81,16 @@ class ImgProperties
83
81
 
84
82
  def setup_src
85
83
  @src = @src.to_s.strip
86
- raise ImgError, "The 'src' parameter was not specified", [] if @src.empty?
84
+ raise Jekyll::ImgError, "The 'src' parameter was not specified" if @src.empty?
85
+
86
+ filetype = File.extname(URI(@src).path)
87
+ @src += '.webp' if filetype.empty?
87
88
 
88
89
  @src = "/assets/images/#{@src}" unless ImgProperties.local_path?(@src) || url?(@src)
90
+ return unless ImgProperties.local_path?(@src)
91
+
92
+ src = @src.start_with?('/') ? ".#{@src}" : @src
93
+ raise Jekyll::ImgError, "#{@src} does not exist" unless File.exist?(src)
89
94
  end
90
95
 
91
96
  UNITS = %w[Q ch cm em dvh dvw ex in lh lvh lvw mm pc px pt rem rlh svh svw vb vh vi vmax vmin vw %].freeze
@@ -1,3 +1,3 @@
1
1
  module JekyllImgVersion
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/lib/jekyll_img.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'jekyll_plugin_support'
2
2
  require 'jekyll_plugin_helper'
3
+ require 'pry'
3
4
  require_relative 'img_builder'
4
5
  require_relative 'img_props'
5
6
  require_relative 'jekyll_img/version'
@@ -12,15 +13,17 @@ module ImgModule
12
13
  end
13
14
 
14
15
  module Jekyll
16
+ ImgError = JekyllSupport.define_error
17
+
15
18
  # Plugin implementation
16
19
  class Img < JekyllSupport::JekyllTag
17
20
  include JekyllImgVersion
18
21
 
19
- def render_impl # rubocop:disable Metrics/AbcSize
22
+ def render_impl
20
23
  @helper.gem_file __FILE__ # This enables plugin attribution
21
24
 
22
- config = @config['img']
23
- @continue_on_error = config['continue_on_error'] == true if config
25
+ @die_on_img_error = @tag_config['die_on_img_error'] == true if @tag_config
26
+ @pry_on_img_error = @tag_config['pry_on_img_error'] == true if @tag_config
24
27
 
25
28
  props = ImgProperties.new
26
29
  props.attribute = @helper.attribute
@@ -29,7 +32,7 @@ module Jekyll
29
32
  props.alt = @helper.parameter_specified? 'alt'
30
33
  props.caption = @helper.parameter_specified? 'caption'
31
34
  props.classes = @helper.parameter_specified? 'class'
32
- props.continue_on_error = @continue_on_error
35
+ props.die_on_img_error = @die_on_img_error
33
36
  props.id = @helper.parameter_specified? 'id'
34
37
  props.nofollow = @helper.parameter_specified? 'nofollow'
35
38
  props.size = @helper.parameter_specified?('size') || @helper.parameter_specified?('_size')
@@ -43,14 +46,14 @@ module Jekyll
43
46
 
44
47
  @builder = ImgBuilder.new(props)
45
48
  @builder.to_s
46
- rescue ImgError => e
47
- msg = <<~END_ERR
48
- #{e.message} on line #{@line_number} (after front matter) of #{@page['path']}.
49
- The offending argument string was: #{@argument_string}
50
- END_ERR
51
- raise ImgError, msg.red, [] unless @continue_on_error
52
-
53
- @logger.warn msg
49
+ rescue ImgError => e # jekyll_plugin_support handles StandardError
50
+ e.shorten_backtrace
51
+ msg = format_error_message e.message
52
+ @logger.error { "#{e.class} raised #{msg}" }
53
+ binding.pry if @pry_on_img_error # rubocop:disable Lint/Debugger
54
+ raise e if @die_on_img_error
55
+
56
+ "<div class='jekyll_img_error'>#{e.class} raised in #{@tag_name} tag\n#{msg}</div>"
54
57
  end
55
58
 
56
59
  JekyllPluginHelper.register(self, ImgModule::PLUGIN_NAME)
data/spec/spec_helper.rb CHANGED
@@ -2,9 +2,8 @@ require 'jekyll'
2
2
  require_relative '../lib/jekyll_img'
3
3
 
4
4
  RSpec.configure do |config|
5
- config.filter_run :focus
5
+ config.filter_run_when_matching focus: true
6
6
  config.order = 'random'
7
- config.run_all_when_everything_filtered = true
8
7
 
9
8
  # See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
10
9
  config.example_status_persistence_file_path = 'spec/status_persistence.txt'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_img
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-25 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.7.0
33
+ version: 0.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.0
40
+ version: 0.8.0
41
41
  description:
42
42
  email:
43
43
  - mslinn@mslinn.com
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.3.3
89
+ rubygems_version: 3.3.7
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Provides a Jekyll tag that generates images.