jekyll_plugin_support 0.6.2 → 0.7.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 +4 -4
- data/CHANGELOG.md +3 -0
- data/jekyll_plugin_support.gemspec +1 -1
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support.rb +56 -5
- metadata +4 -8
- data/spec/jekyll_plugin_helper_call_spec.rb +0 -21
- data/spec/status_persistence.txt +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d4b97854b427b9113f6db8e175608ac5e2b3fc5866c0062449c9b7e5c530798
|
4
|
+
data.tar.gz: 39c0b2b1ee1b457df3e339edb166d295fdf14b83faeb44a6261be39993fc82f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db5aa2fe02695556bb5bc7c95e53c5eb98990688fd1920bcab97503262979ef4266ac95210da7fc5d60a67f635b2fe11e7b18ebd3d35ab6e4bdbeedc1d116442
|
7
|
+
data.tar.gz: accae0af9a79e92f812980db24e23e33b7555362f24e28f9dd099f6faa57e7484a7043ddeccb16aa10f1d6a7d187cf6ee9f023bbd030d8cb49bf9984dc8049eb
|
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
7
7
|
spec.authors = ['Mike Slinn']
|
8
8
|
spec.email = ['mslinn@mslinn.com']
|
9
9
|
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
10
|
-
spec.homepage = 'https://www.mslinn.com/
|
10
|
+
spec.homepage = 'https://www.mslinn.com/jekyll_plugins/jekyll_plugin_support.html'
|
11
11
|
spec.license = 'MIT'
|
12
12
|
spec.metadata = {
|
13
13
|
'allowed_push_host' => 'https://rubygems.org',
|
@@ -12,6 +12,26 @@ module NoArgParsing
|
|
12
12
|
end
|
13
13
|
|
14
14
|
module JekyllSupport
|
15
|
+
DISPLAYED_CALLS = 8
|
16
|
+
|
17
|
+
def self.error_short_trace(logger, error)
|
18
|
+
remaining = e.backtrace.length - DISPLAYED_CALLS
|
19
|
+
logger.error do
|
20
|
+
error.message + "\n" + # rubocop:disable Style/StringConcatenation
|
21
|
+
error.backtrace.take(DISPLAYED_CALLS).join("\n") +
|
22
|
+
"\n...Remaining #{remaining} call sites elided.\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.warn_short_trace(logger, error)
|
27
|
+
remaining = e.backtrace.length - DISPLAYED_CALLS
|
28
|
+
logger.warn do
|
29
|
+
error.message + "\n" + # rubocop:disable Style/StringConcatenation
|
30
|
+
error.backtrace.take(DISPLAYED_CALLS).join("\n") +
|
31
|
+
"\n...Remaining #{remaining} call sites elided.\n"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
15
35
|
# Base class for Jekyll block tags
|
16
36
|
class JekyllBlock < Liquid::Block
|
17
37
|
attr_reader :argument_string, :helper, :line_number, :logger, :page, :site, :text
|
@@ -34,16 +54,27 @@ module JekyllSupport
|
|
34
54
|
@helper = JekyllPluginHelper.new tag_name, argument_string, @logger, respond_to?(:no_arg_parsing)
|
35
55
|
end
|
36
56
|
|
57
|
+
# @return line number where tag or block was found, relative to the start of the page
|
58
|
+
def jekyll_line_number
|
59
|
+
@page['front_matter'].count("\n") + @line_number
|
60
|
+
end
|
61
|
+
|
37
62
|
# Method prescribed by the Jekyll plugin lifecycle.
|
63
|
+
# Defines @config, @envs, @mode, @page and @site
|
38
64
|
# @return [String]
|
39
65
|
def render(liquid_context)
|
40
66
|
text = super
|
41
67
|
@helper.liquid_context = liquid_context
|
42
68
|
|
43
|
-
@page = liquid_context.registers[:page] #
|
69
|
+
@page = liquid_context.registers[:page] # hash
|
44
70
|
@site = liquid_context.registers[:site]
|
45
71
|
@config = @site.config
|
46
72
|
@envs = liquid_context.environments.first
|
73
|
+
|
74
|
+
@layout = @envs[:layout]
|
75
|
+
@paginator = @envs[:paginator]
|
76
|
+
@theme = @envs[:theme]
|
77
|
+
|
47
78
|
@mode = @config['env']['JEKYLL_ENV'] || 'development'
|
48
79
|
|
49
80
|
render_impl text
|
@@ -54,12 +85,18 @@ module JekyllSupport
|
|
54
85
|
raise e
|
55
86
|
end
|
56
87
|
|
57
|
-
# Jekyll plugins should override this method, not render,
|
58
|
-
#
|
59
|
-
#
|
88
|
+
# Jekyll plugins should override this method, not render,
|
89
|
+
# so they can be tested more easily.
|
90
|
+
# The following variables are predefined:
|
91
|
+
# @argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site, @tag_name and @theme
|
92
|
+
# @return [String] The result to be rendered to the invoking page
|
60
93
|
def render_impl(text)
|
61
94
|
text
|
62
95
|
end
|
96
|
+
|
97
|
+
def warn_short_trace(error)
|
98
|
+
JekyllSupport.warn_short_trace(@logger, error)
|
99
|
+
end
|
63
100
|
end
|
64
101
|
|
65
102
|
class JekyllBlockNoArgParsing < JekyllBlock
|
@@ -74,6 +111,10 @@ module JekyllSupport
|
|
74
111
|
@logger.error { "#{self.class} died with a #{e.full_message}" }
|
75
112
|
exit 2
|
76
113
|
end
|
114
|
+
|
115
|
+
def warn_short_trace(error)
|
116
|
+
JekyllSupport.warn_short_trace(@logger, error)
|
117
|
+
end
|
77
118
|
end
|
78
119
|
|
79
120
|
# Base class for Jekyll tags
|
@@ -98,6 +139,11 @@ module JekyllSupport
|
|
98
139
|
@helper = JekyllPluginHelper.new(tag_name, argument_string, @logger, respond_to?(:no_arg_parsing))
|
99
140
|
end
|
100
141
|
|
142
|
+
# @return line number where tag or block was found, relative to the start of the page
|
143
|
+
def jekyll_line_number
|
144
|
+
@page['front_matter'].count("\n") + @line_number
|
145
|
+
end
|
146
|
+
|
101
147
|
# Method prescribed by the Jekyll plugin lifecycle.
|
102
148
|
def render(liquid_context)
|
103
149
|
return if @helper.excerpt_caller
|
@@ -123,10 +169,15 @@ module JekyllSupport
|
|
123
169
|
end
|
124
170
|
|
125
171
|
# Jekyll plugins must override this method, not render, so their plugin can be tested more easily
|
126
|
-
#
|
172
|
+
# The following variables are predefined:
|
173
|
+
# @argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site, @tag_name and @theme
|
127
174
|
def render_impl
|
128
175
|
abort "#{self.class}.render_impl for tag #{@tag_name} must be overridden, but it was not."
|
129
176
|
end
|
177
|
+
|
178
|
+
def warn_short_trace(error)
|
179
|
+
JekyllSupport.warn_short_trace(@logger, error)
|
180
|
+
end
|
130
181
|
end
|
131
182
|
|
132
183
|
class JekyllTagNoArgParsing < JekyllTag
|
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.
|
4
|
+
version: 0.7.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-
|
11
|
+
date: 2023-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -86,18 +86,16 @@ files:
|
|
86
86
|
- lib/jekyll_plugin_support.rb
|
87
87
|
- lib/jekyll_plugin_support/version.rb
|
88
88
|
- lib/jekyll_plugin_support_spec_support.rb
|
89
|
-
- spec/jekyll_plugin_helper_call_spec.rb
|
90
89
|
- spec/jekyll_plugin_helper_options_spec.rb
|
91
90
|
- spec/spec_helper.rb
|
92
|
-
|
93
|
-
homepage: https://www.mslinn.com/jekyll/10200-jekyll-plugin-support.html
|
91
|
+
homepage: https://www.mslinn.com/jekyll_plugins/jekyll_plugin_support.html
|
94
92
|
licenses:
|
95
93
|
- MIT
|
96
94
|
metadata:
|
97
95
|
allowed_push_host: https://rubygems.org
|
98
96
|
bug_tracker_uri: https://github.com/mslinn/jekyll_plugin_support/issues
|
99
97
|
changelog_uri: https://github.com/mslinn/jekyll_plugin_support/CHANGELOG.md
|
100
|
-
homepage_uri: https://www.mslinn.com/
|
98
|
+
homepage_uri: https://www.mslinn.com/jekyll_plugins/jekyll_plugin_support.html
|
101
99
|
source_code_uri: https://github.com/mslinn/jekyll_plugin_support
|
102
100
|
post_install_message: |2+
|
103
101
|
|
@@ -122,8 +120,6 @@ signing_key:
|
|
122
120
|
specification_version: 4
|
123
121
|
summary: Provides support for writing Jekyll plugins.
|
124
122
|
test_files:
|
125
|
-
- spec/jekyll_plugin_helper_call_spec.rb
|
126
123
|
- spec/jekyll_plugin_helper_options_spec.rb
|
127
124
|
- spec/spec_helper.rb
|
128
|
-
- spec/status_persistence.txt
|
129
125
|
...
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'jekyll_plugin_logger'
|
2
|
-
require 'rspec/match_ignoring_whitespace'
|
3
|
-
require_relative '../lib/jekyll_plugin_support'
|
4
|
-
require_relative '../lib/jekyll_plugin_support_spec_support'
|
5
|
-
|
6
|
-
class JekyllPluginHelperCallTest
|
7
|
-
RSpec.describe JekyllPluginHelper do
|
8
|
-
it 'might not return jpsh_subclass_caller value' do
|
9
|
-
jpsh_subclass_caller = CallChain.jpsh_subclass_caller
|
10
|
-
expect(jpsh_subclass_caller).to be_nil
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'asf' do
|
14
|
-
logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
15
|
-
jph = described_class.new('my_tag', 'attribution', logger, false)
|
16
|
-
actual = jph.jpsh_subclass_caller
|
17
|
-
expected = [__FILE__, 15, 'new'] # The 2nd element value depends on the line # of two lines up
|
18
|
-
expect(actual).to match_array(expected)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/spec/status_persistence.txt
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
example_id | status | run_time |
|
2
|
-
----------------------------------------------------------------------------------------------- | ------ | --------------- |
|
3
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_plugin_support/spec/jekyll_plugin_helper_call_spec.rb[1:1] | passed | 0.00436 seconds |
|
4
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_plugin_support/spec/jekyll_plugin_helper_call_spec.rb[1:2] | passed | 0.00476 seconds |
|