jekyll_plugin_support 0.8.5 → 0.8.6
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 +5 -0
- data/lib/{jekyll_plugin_support_block.rb → block/jekyll_plugin_support_block.rb} +5 -4
- data/lib/{jekyll_plugin_support_block_noarg.rb → block/jekyll_plugin_support_block_noarg.rb} +7 -1
- data/lib/generator/jekyll_plugin_support_generator.rb +78 -0
- data/lib/{jekyll_plugin_support_class.rb → jekyll_plugin_support/jekyll_plugin_support_class.rb} +1 -1
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support.rb +13 -8
- data/lib/{jekyll_plugin_support_tag.rb → tag/jekyll_plugin_support_tag.rb} +1 -1
- data/lib/{jekyll_plugin_support_tag_noarg.rb → tag/jekyll_plugin_support_tag_noarg.rb} +1 -1
- metadata +15 -14
- /data/lib/{jekyll_custom_error.rb → error/jekyll_custom_error.rb} +0 -0
- /data/lib/{jekyll_plugin_error_handling.rb → error/jekyll_plugin_error_handling.rb} +0 -0
- /data/lib/{jekyll_plugin_helper.rb → helper/jekyll_plugin_helper.rb} +0 -0
- /data/lib/{jekyll_plugin_helper_attribution.rb → helper/jekyll_plugin_helper_attribution.rb} +0 -0
- /data/lib/{jekyll_plugin_helper_class.rb → helper/jekyll_plugin_helper_class.rb} +0 -0
- /data/lib/{jekyll_plugin_support_spec_support.rb → jekyll_plugin_support/jekyll_plugin_support_spec_support.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bf93dd0ea77ecf7c70380afdddc398824f3e1e27226ed3b8e996e8170a15443
|
4
|
+
data.tar.gz: 32e434ab647fcfc81e674a54fb676b1b17450ceef5c38f0f51c1a5f59588f666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c254100e325c89dfd874e7403d83c5e3b10a808de8d987748fca7ef955d92dba2a90157868d7dd525953661968eb142a208bafc0015dbf99f357b1bf255dcf0
|
7
|
+
data.tar.gz: ae9cf29baf54d74c957bea4ff126edfe49ddcebb3ba327b2ae7729ef2e783fbe6f1df73a0a635f865a8f8fcbd00b33ebbc3e94ba949c892480a33543a31d21d4
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative 'jekyll_plugin_error_handling'
|
1
|
+
require_relative '../error/jekyll_plugin_error_handling'
|
2
2
|
|
3
3
|
module JekyllSupport
|
4
4
|
# Base class for Jekyll block tags
|
@@ -56,7 +56,8 @@ module JekyllSupport
|
|
56
56
|
@paginator = @envs[:paginator]
|
57
57
|
@theme = @envs[:theme]
|
58
58
|
|
59
|
-
|
59
|
+
env = @config['env']
|
60
|
+
@mode = env&.key?('JEKYLL_ENV') ? env['JEKYLL_ENV'] : 'development'
|
60
61
|
|
61
62
|
@helper.reinitialize @markup.strip
|
62
63
|
|
@@ -69,13 +70,13 @@ module JekyllSupport
|
|
69
70
|
render_impl(text)
|
70
71
|
rescue StandardError => e
|
71
72
|
e.shorten_backtrace
|
72
|
-
@logger.error { "#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{tag_name} - #{e.message}" }
|
73
|
+
@logger.error { "#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{@tag_name} - #{e.message}" }
|
73
74
|
binding.pry if @pry_on_standard_error # rubocop:disable Lint/Debugger
|
74
75
|
raise e if @die_on_standard_error
|
75
76
|
|
76
77
|
<<~END_MSG
|
77
78
|
<div class='standard_error'>
|
78
|
-
#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{tag_name}: #{e.message}
|
79
|
+
#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{@tag_name}: #{e.message}
|
79
80
|
</div>
|
80
81
|
END_MSG
|
81
82
|
end
|
data/lib/{jekyll_plugin_support_block_noarg.rb → block/jekyll_plugin_support_block_noarg.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative 'jekyll_plugin_error_handling'
|
1
|
+
require_relative '../error/jekyll_plugin_error_handling'
|
2
2
|
|
3
3
|
module JekyllSupport
|
4
4
|
class JekyllBlockNoArgParsing < JekyllBlock
|
@@ -20,6 +20,12 @@ module JekyllSupport
|
|
20
20
|
JekyllSupport.error_short_trace(@logger, e)
|
21
21
|
end
|
22
22
|
|
23
|
+
# Liquid::Block subclasses do not render if there is no content within the tag
|
24
|
+
# This override fixes that
|
25
|
+
def blank?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
23
29
|
# Jekyll plugins must override this method, not render, so their plugin can be tested more easily
|
24
30
|
# The following variables are predefined:
|
25
31
|
# @argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site, @tag_name and @theme
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'jekyll'
|
2
|
+
require_relative '../error/jekyll_plugin_error_handling'
|
3
|
+
|
4
|
+
module JekyllSupport
|
5
|
+
# Base class for Jekyll generators.
|
6
|
+
# PluginMetaLogger.instance.config is populated with the contents of `_config.yml` before Jekyll::Generator instances run.
|
7
|
+
class JekyllGenerator < Jekyll::Generator
|
8
|
+
attr_reader :helper, :line_number, :logger, :site
|
9
|
+
|
10
|
+
include JekyllSupportErrorHandling
|
11
|
+
extend JekyllSupportErrorHandling
|
12
|
+
|
13
|
+
# Method prescribed by the Jekyll plugin lifecycle.
|
14
|
+
# Defines @config, @envs, @mode and @site
|
15
|
+
# @return [void]
|
16
|
+
def generate(site)
|
17
|
+
@logger ||= PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
18
|
+
|
19
|
+
@error_name = "#{self.class.name}Error"
|
20
|
+
# Jekyll::CustomError.factory @error_name
|
21
|
+
|
22
|
+
@site = site
|
23
|
+
@config = @site.config
|
24
|
+
@envs = site.config['env']
|
25
|
+
@theme = @site.theme
|
26
|
+
|
27
|
+
@mode = ENV['JEKYLL_ENV'] || 'development'
|
28
|
+
|
29
|
+
# set_error_context(self.class)
|
30
|
+
|
31
|
+
generate_impl
|
32
|
+
rescue StandardError => e
|
33
|
+
e.shorten_backtrace
|
34
|
+
@logger.error { "#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{self.class.name} - #{e.message}" }
|
35
|
+
binding.pry if @pry_on_standard_error # rubocop:disable Lint/Debugger
|
36
|
+
raise e if @die_on_standard_error
|
37
|
+
|
38
|
+
<<~END_MSG
|
39
|
+
<div class='standard_error'>
|
40
|
+
#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{self.class.name}: #{e.message}
|
41
|
+
</div>
|
42
|
+
END_MSG
|
43
|
+
end
|
44
|
+
|
45
|
+
# Jekyll plugins should override this method, not `generate`, so they can be tested more easily.
|
46
|
+
# The following variables are predefined:
|
47
|
+
# @config, @envs, @helper, @logger, @mode, @paginator, @site and @theme
|
48
|
+
# @return [void]
|
49
|
+
def generate_impl; end
|
50
|
+
|
51
|
+
def self.register(klass)
|
52
|
+
abort("Error: The #{klass.name} plugin does not define VERSION") \
|
53
|
+
unless klass.const_defined?(:VERSION)
|
54
|
+
|
55
|
+
version = klass.const_get(:VERSION)
|
56
|
+
error_name_stub = klass.name.include?('::') ? klass.name.split('::')[1] : klass.name
|
57
|
+
error_ruby_class_name = "#{error_name_stub.camelcase(:upper)}Error"
|
58
|
+
error_css_class_name = error_ruby_class_name.split('::').last.snakecase
|
59
|
+
msg = <<~END_MSG
|
60
|
+
Loaded generator plugin #{klass.name} v#{version}. It has:
|
61
|
+
Error class: #{@error_name}
|
62
|
+
CSS class for error messages: #{error_css_class_name}
|
63
|
+
END_MSG
|
64
|
+
|
65
|
+
PluginMetaLogger.instance.info { msg }
|
66
|
+
end
|
67
|
+
|
68
|
+
def set_error_context(klass)
|
69
|
+
return unless Object.const_defined? @error_name
|
70
|
+
|
71
|
+
error_class = Object.const_get @error_name
|
72
|
+
error_class.class_variable_set(:@@argument_string, @argument_string)
|
73
|
+
error_class.class_variable_set(:@@line_number, @line_number)
|
74
|
+
error_class.class_variable_set(:@@path, @page['path'])
|
75
|
+
error_class.class_variable_set(:@@tag_name, klass.name)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'colorator'
|
2
2
|
require 'jekyll'
|
3
3
|
require 'jekyll_plugin_logger'
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
def require_directory(dir)
|
6
|
+
Dir[File.join(dir, '*.rb')].sort.each do |file|
|
7
|
+
require file unless file == __FILE__
|
8
|
+
end
|
9
|
+
end
|
6
10
|
|
7
11
|
module NoArgParsing
|
8
12
|
attr_accessor :no_arg_parsing
|
@@ -10,9 +14,10 @@ module NoArgParsing
|
|
10
14
|
@no_arg_parsing = true
|
11
15
|
end
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
require_directory __dir__
|
18
|
+
require_directory "#{__dir__}/block"
|
19
|
+
require_directory "#{__dir__}/error"
|
20
|
+
require_directory "#{__dir__}/generator"
|
21
|
+
require_directory "#{__dir__}/helper"
|
22
|
+
require_directory "#{__dir__}/jekyll_plugin_support"
|
23
|
+
require_directory "#{__dir__}/tag"
|
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: 0.8.
|
4
|
+
version: 0.8.6
|
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-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -94,19 +94,20 @@ files:
|
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
96
|
- jekyll_plugin_support.gemspec
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
97
|
+
- lib/block/jekyll_plugin_support_block.rb
|
98
|
+
- lib/block/jekyll_plugin_support_block_noarg.rb
|
99
|
+
- lib/error/jekyll_custom_error.rb
|
100
|
+
- lib/error/jekyll_plugin_error_handling.rb
|
101
|
+
- lib/generator/jekyll_plugin_support_generator.rb
|
102
|
+
- lib/helper/jekyll_plugin_helper.rb
|
103
|
+
- lib/helper/jekyll_plugin_helper_attribution.rb
|
104
|
+
- lib/helper/jekyll_plugin_helper_class.rb
|
102
105
|
- lib/jekyll_plugin_support.rb
|
106
|
+
- lib/jekyll_plugin_support/jekyll_plugin_support_class.rb
|
107
|
+
- lib/jekyll_plugin_support/jekyll_plugin_support_spec_support.rb
|
103
108
|
- lib/jekyll_plugin_support/version.rb
|
104
|
-
- lib/
|
105
|
-
- lib/
|
106
|
-
- lib/jekyll_plugin_support_class.rb
|
107
|
-
- lib/jekyll_plugin_support_spec_support.rb
|
108
|
-
- lib/jekyll_plugin_support_tag.rb
|
109
|
-
- lib/jekyll_plugin_support_tag_noarg.rb
|
109
|
+
- lib/tag/jekyll_plugin_support_tag.rb
|
110
|
+
- lib/tag/jekyll_plugin_support_tag_noarg.rb
|
110
111
|
- spec/custom_error_spec.rb
|
111
112
|
- spec/jekyll_plugin_helper_options_spec.rb
|
112
113
|
- spec/liquid_variable_parsing_spec.rb
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
140
|
- !ruby/object:Gem::Version
|
140
141
|
version: '0'
|
141
142
|
requirements: []
|
142
|
-
rubygems_version: 3.5.
|
143
|
+
rubygems_version: 3.5.10
|
143
144
|
signing_key:
|
144
145
|
specification_version: 4
|
145
146
|
summary: Provides a framework for writing and testing Jekyll plugins
|
File without changes
|
File without changes
|
File without changes
|
/data/lib/{jekyll_plugin_helper_attribution.rb → helper/jekyll_plugin_helper_attribution.rb}
RENAMED
File without changes
|
File without changes
|
File without changes
|