jekyll_plugin_support 1.0.0 → 1.0.2
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 +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +1 -2
- data/lib/error/jekyll_custom_error.rb +2 -4
- data/lib/error/jekyll_plugin_error_handling.rb +2 -4
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support.rb +18 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8c02963da77be335a8e4713e9bcffc12395912733d31781e16198f9f9392f0
|
4
|
+
data.tar.gz: 8851a2ede60d7a70f0cb7eab711c7a3cb06da87d9764740d5dd50a385ee8066d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06b06073d76ba15d23d69d585d3148edd0e2adcd86ffc0b6d7982d2659989aad9da79b6adab83220c9c4299354e423a4bc3490ace1f2c1348d5e9a01e1b848c8
|
7
|
+
data.tar.gz: 9e9bd5db4569abe954ba547e38538c62ecf99037f772a893ef73a1fe68c9a9766df4c15069f6e1ff3aea578913d92e91922ab076c2be632540eb1e31a73e33a4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
|
4
|
+
## 1.0.2 / 2024-08-19
|
5
|
+
|
6
|
+
* Computes line_number and path properly
|
7
|
+
* Refactored demo CSS
|
8
|
+
* Improved custom plugin error handling and sample code.
|
9
|
+
The following seems to be optimal for custom plugins; it suppresses the ridiculously long stack trace that used to be generated:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
rescue DemoInlineTagError => e # jekyll_plugin_support handles StandardError
|
13
|
+
@logger.error e.logger_message
|
14
|
+
exit! 1 if @die_on_demo_tag_error
|
15
|
+
|
16
|
+
e.html_message
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
## 1.0.1 / 2024-07-27
|
21
|
+
|
22
|
+
* Moved `warn_short_trace`, `maybe_reraise_error`, `remove_ansi_color`,
|
23
|
+
`format_error_message` and `exit_without_stack_trace` into `JekyllSupportError`.
|
24
|
+
* Added missing `shared_include.css` and `clippy.svg` to `demo/`.
|
25
|
+
* Fixed missing module name when invoking `format_error_message`.
|
26
|
+
|
27
|
+
|
3
28
|
## 1.0.0 / 2024-07-23
|
4
29
|
|
5
30
|
* Added the `redef_without_warning` method so tag and block plugins can be subclassed.
|
data/README.md
CHANGED
@@ -466,9 +466,8 @@ class DemoBlock < JekyllSupport::JekyllBlock
|
|
466
466
|
def render_impl(text)
|
467
467
|
raise DemoBlockTagError, 'Fall down, go boom.'
|
468
468
|
rescue DemoBlockTagError => e
|
469
|
-
e.shorten_backtrace
|
470
469
|
@logger.error e.logger_message
|
471
|
-
|
470
|
+
exit! 1 if @die_on_demo_block_error
|
472
471
|
|
473
472
|
e.html_message
|
474
473
|
end
|
@@ -23,8 +23,7 @@ module JekyllSupport
|
|
23
23
|
# @return HTML <div> tag with class set to the snake_case version of the error class name.
|
24
24
|
def html_message
|
25
25
|
shorten_backtrace
|
26
|
-
line_number =
|
27
|
-
path = self.class.class_variable_get :@@path
|
26
|
+
path, line_number, _caller = backtrace[1].split(':')
|
28
27
|
<<~END_MSG
|
29
28
|
<div class='#{error_name.snakecase}'>
|
30
29
|
#{self.class} raised in #{calling_file} while processing line #{line_number} (after front matter) of #{path}
|
@@ -36,8 +35,7 @@ module JekyllSupport
|
|
36
35
|
def logger_message
|
37
36
|
shorten_backtrace
|
38
37
|
kaller = caller(1..1).first
|
39
|
-
line_number =
|
40
|
-
path = self.class.class_variable_get :@@path
|
38
|
+
path, line_number, _caller = backtrace[1].split(':')
|
41
39
|
<<~END_MSG
|
42
40
|
#{error_name} raised in #{kaller} while processing line #{line_number} (after front matter) of #{path}
|
43
41
|
#{message}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module JekyllSupportError
|
2
2
|
attr_reader :logger, :page
|
3
3
|
|
4
4
|
# If a Jekyll plugin needs to crash exit, and stop Jekyll, call this method.
|
@@ -24,19 +24,17 @@ module JekyllSupport
|
|
24
24
|
exec "echo ''"
|
25
25
|
end
|
26
26
|
|
27
|
-
# TODO: Delete this
|
28
27
|
def format_error_message(message)
|
29
28
|
page = " of #{@page['path']}" if @page
|
30
29
|
remove_ansi_color "on line #{line_number} (after front matter)#{page}.\n#{message}"
|
31
30
|
end
|
32
31
|
|
33
|
-
# TODO: Delete this
|
34
32
|
def remove_ansi_color(string)
|
35
33
|
string.gsub(/\e\[([;\d]+)?m/, '')
|
36
34
|
end
|
37
35
|
|
38
36
|
def maybe_reraise_error(error, throw_error: true)
|
39
|
-
fmsg = format_error_message "#{error.class}: #{error.message.strip}"
|
37
|
+
fmsg = JekyllSupport.format_error_message "#{error.class}: #{error.message.strip}"
|
40
38
|
@logger.error { fmsg }
|
41
39
|
return "<span class='jekyll_plugin_support_error'>#{fmsg}</span>" unless throw_error
|
42
40
|
|
@@ -28,3 +28,21 @@ require_directory "#{__dir__}/generator"
|
|
28
28
|
require_directory "#{__dir__}/helper"
|
29
29
|
require_directory "#{__dir__}/jekyll_plugin_support"
|
30
30
|
require_directory "#{__dir__}/tag"
|
31
|
+
|
32
|
+
module JekyllSupport
|
33
|
+
class JekyllTag
|
34
|
+
include JekyllSupportError
|
35
|
+
end
|
36
|
+
|
37
|
+
class JekyllTagNoArgParsing
|
38
|
+
include JekyllSupportError
|
39
|
+
end
|
40
|
+
|
41
|
+
class JekyllBlock
|
42
|
+
include JekyllSupportError
|
43
|
+
end
|
44
|
+
|
45
|
+
class JekyllBlockNoArgParsing
|
46
|
+
include JekyllSupportError
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_plugin_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.5.
|
143
|
+
rubygems_version: 3.5.17
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Provides a framework for writing and testing Jekyll plugins
|