jekyll_plugin_template 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +75 -14
- data/CHANGELOG.md +31 -10
- data/README.md +1 -1
- data/Rakefile +3 -3
- data/jekyll_plugin_template.gemspec +6 -9
- data/lib/jekyll_block_tag_plugin.rb +20 -48
- data/lib/jekyll_plugin_template/version.rb +1 -1
- data/lib/jekyll_tag_plugin.rb +12 -11
- data/spec/spec_helper.rb +1 -2
- data/spec/status_persistence.txt +5 -0
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf29c25ea3f418a5aaed7a236aedaf123bdc00a56e9c5d4d695ff0fba17b7ca
|
4
|
+
data.tar.gz: 753290a87bcab62f7f67649633b6c26b1a5cdff1ebde9d8bd44cad4370616e3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92dd8e9cade06df75d6cadde7156d9ef55762ae59e7f2a28a7d3965477742513aca7ec71cd24461148c3991e9f254f9c79df006b873dcaf365340f5a6c1c3b36
|
7
|
+
data.tar.gz: db9fc71ce9001fd46cb3a5068f707a1670288c574cb87e3b757e9bef23c11b249e6ca0ee00a6ffd52358e7779df7f1fa1230144cb18ec20560cf54ada57c86a9
|
data/.rubocop.yml
CHANGED
@@ -1,37 +1,82 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
1
|
+
require:
|
2
|
+
# - rubocop-jekyll
|
3
|
+
- rubocop-md
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
4
7
|
|
5
8
|
AllCops:
|
6
9
|
Exclude:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
+
- demo/_site/**/*
|
11
|
+
- binstub/**/*
|
12
|
+
- vendor/**/*
|
13
|
+
- Gemfile*
|
14
|
+
- Rakefile
|
15
|
+
- jekyll_plugin_template.gemspec
|
10
16
|
NewCops: enable
|
11
|
-
TargetRubyVersion: 2.6
|
12
17
|
|
13
|
-
|
14
|
-
|
18
|
+
Gemspec/DeprecatedAttributeAssignment:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Gemspec/RequiredRubyVersion:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Gemspec/RequireMFA:
|
25
|
+
Enabled: false
|
15
26
|
|
16
|
-
|
17
|
-
|
27
|
+
Layout/InitialIndentation:
|
28
|
+
Exclude:
|
29
|
+
- README.md
|
18
30
|
|
19
31
|
Layout/HashAlignment:
|
32
|
+
EnforcedColonStyle: table
|
20
33
|
EnforcedHashRocketStyle: table
|
21
34
|
|
22
35
|
Layout/LineLength:
|
23
36
|
Max: 150
|
24
37
|
|
38
|
+
Layout/MultilineMethodCallIndentation:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Lint/RedundantCopDisableDirective:
|
42
|
+
Exclude:
|
43
|
+
- jekyll_plugin_template.gemspec
|
44
|
+
|
25
45
|
Metrics/AbcSize:
|
26
|
-
Max:
|
46
|
+
Max: 35
|
27
47
|
|
28
48
|
Metrics/BlockLength:
|
29
|
-
|
49
|
+
Exclude:
|
50
|
+
- jekyll_plugin_template.gemspec
|
51
|
+
- spec/**/*
|
52
|
+
|
53
|
+
Metrics/ClassLength:
|
54
|
+
Exclude:
|
55
|
+
- spec/**/*
|
30
56
|
|
31
57
|
Metrics/MethodLength:
|
32
58
|
Max: 40
|
33
59
|
|
34
|
-
Metrics/
|
60
|
+
Metrics/CyclomaticComplexity:
|
61
|
+
Max: 10
|
62
|
+
|
63
|
+
Metrics/PerceivedComplexity:
|
64
|
+
Max: 10
|
65
|
+
|
66
|
+
Naming/FileName:
|
67
|
+
Exclude:
|
68
|
+
- Rakefile
|
69
|
+
|
70
|
+
RSpec/ExampleLength:
|
71
|
+
Max: 20
|
72
|
+
|
73
|
+
RSpec/MultipleExpectations:
|
74
|
+
Max: 15
|
75
|
+
|
76
|
+
Style/CommandLiteral:
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
Style/CommentedKeyword:
|
35
80
|
Enabled: false
|
36
81
|
|
37
82
|
Style/Documentation:
|
@@ -40,5 +85,21 @@ Style/Documentation:
|
|
40
85
|
Style/FrozenStringLiteralComment:
|
41
86
|
Enabled: false
|
42
87
|
|
88
|
+
Style/PercentLiteralDelimiters:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Style/RegexpLiteral:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Style/StringConcatenation:
|
95
|
+
Exclude:
|
96
|
+
- spec/**/*
|
97
|
+
|
43
98
|
Style/StringLiterals:
|
44
99
|
Enabled: false
|
100
|
+
|
101
|
+
Style/StringLiteralsInInterpolation:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Style/TrailingCommaInHashLiteral:
|
105
|
+
EnforcedStyleForMultiline: comma
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,38 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
|
4
|
+
## 0.3.1 / 2024-07-24
|
5
|
+
|
6
|
+
* Updated to `jekyll_plugin_support` v1.0.0.
|
7
|
+
|
8
|
+
|
9
|
+
## 0.3.0 / 2023-04-05
|
10
|
+
|
11
|
+
* Updated to `jekyll_plugin_support` v0.6.0 for attribution support.
|
12
|
+
* Fixed `jeky_block_tag_plugin.rb` so it works properly with `jekyll_plugin_support`.
|
13
|
+
|
14
|
+
|
1
15
|
## 0.2.0 / 2023-02-16
|
2
|
-
|
16
|
+
|
17
|
+
* Updated to `jekyll_plugin_support` v0.5.0.
|
18
|
+
|
3
19
|
|
4
20
|
## 0.1.3 / 2023-02-12
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
21
|
+
|
22
|
+
* Added `grin`, `horns`, `open`, `poop` and `sad` emojis.
|
23
|
+
* Now based on [`JekyllSupport::JekyllTag`](https://mslinn.com/jekyll/10200-jekyll-plugin-support.html) instead of `Liquid::Tag`.
|
24
|
+
* Added `list` and `emoji_and_name` options.
|
25
|
+
* Updated `demo` to exercise the new features.
|
26
|
+
* `Demo` now builds the plugins prior to each run.
|
27
|
+
|
10
28
|
|
11
29
|
## 0.1.3 / 2022-04-15
|
12
|
-
|
13
|
-
|
30
|
+
|
31
|
+
* Renamed `lib/jekyll_tag_plugins.rb` to `lib/jekyll_block_tag_plugin.rb`
|
32
|
+
* Added `lib/jekyll_tag_plugin.rb`
|
33
|
+
|
14
34
|
|
15
35
|
## 0.1.2 / 2022-04-05
|
16
|
-
|
17
|
-
|
36
|
+
|
37
|
+
* Initial version published
|
38
|
+
* `bin/run_this_first` is unfinished but plugins work
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ The customized gem is ready to be pushed to `RubyGems.org`, or any other Ruby ge
|
|
45
45
|
```
|
46
46
|
5) Build the plugins provided with this template.
|
47
47
|
```shell
|
48
|
-
$ rake install
|
48
|
+
$ bundle exec rake install
|
49
49
|
```
|
50
50
|
6) You can now use your new Jekyll plugins in a Jekyll website.
|
51
51
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative 'lib/jekyll_plugin_template/version'
|
2
2
|
|
3
|
-
Gem::Specification.new do |spec|
|
3
|
+
Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
4
4
|
github = 'https://github.com/mslinn/jekyll_plugin_template'
|
5
5
|
|
6
|
-
spec.authors = ['
|
7
|
-
spec.bindir = '
|
6
|
+
spec.authors = ['Mike Slinn']
|
7
|
+
spec.bindir = 'exe'
|
8
8
|
spec.description = <<~END_OF_DESC
|
9
9
|
Expand on what spec.summary says.
|
10
10
|
END_OF_DESC
|
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
# Specify which files should be added to the gem when it is released.
|
15
15
|
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
16
16
|
|
17
|
-
spec.homepage = 'https://www.mslinn.com/
|
18
|
-
spec.license = 'CC0-1.0'
|
17
|
+
spec.homepage = 'https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html'
|
18
|
+
spec.license = 'CC0-1.0' # MIT is most popular for Ruby gems
|
19
19
|
spec.metadata = {
|
20
20
|
'allowed_push_host' => 'https://rubygems.org',
|
21
21
|
'bug_tracker_uri' => "#{github}/issues",
|
@@ -30,13 +30,10 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.version = JekyllPluginTemplateVersion::VERSION
|
31
31
|
|
32
32
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
33
|
-
spec.add_dependency 'jekyll_plugin_support', '
|
33
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.0'
|
34
34
|
spec.add_dependency 'git'
|
35
35
|
spec.add_dependency 'nokogiri'
|
36
36
|
spec.add_dependency 'os'
|
37
37
|
spec.add_dependency 'talk_like_a_pirate', '~> 0.2.2'
|
38
38
|
spec.add_dependency 'tty-prompt'
|
39
|
-
|
40
|
-
# spec.add_development_dependency 'debase'
|
41
|
-
# spec.add_development_dependency 'ruby-debug-ide'
|
42
39
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'jekyll_plugin_support'
|
2
2
|
|
3
3
|
module JekyllPluginBlockTagTemplate
|
4
|
-
PLUGIN_NAME = 'block_tag_template'
|
4
|
+
PLUGIN_NAME = 'block_tag_template'.freeze
|
5
5
|
end
|
6
6
|
|
7
7
|
# This is the module-level description.
|
@@ -23,34 +23,24 @@ module JekyllBlockTagPlugin
|
|
23
23
|
class MyBlock < JekyllSupport::JekyllBlock
|
24
24
|
include JekyllPluginTemplateVersion
|
25
25
|
|
26
|
-
|
27
|
-
# @param tag_name [String] the name of the tag, which we already know.
|
28
|
-
# @param argument_string [String] the arguments from the tag, as a single string.
|
29
|
-
# @param _parse_context [Liquid::ParseContext] hash that stores Liquid options.
|
30
|
-
# By default it has two keys: :locale and :line_numbers, the first is a Liquid::I18n object, and the second,
|
31
|
-
# a boolean parameter that determines if error messages should display the line number the error occurred.
|
32
|
-
# This argument is used mostly to display localized error messages on Liquid built-in Tags and Filters.
|
33
|
-
# See https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers#create-your-own-tags
|
34
|
-
# @return [void]
|
35
|
-
def initialize(tag_name, argument_string, parse_context) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
36
|
-
super
|
37
|
-
@logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
26
|
+
REJECTED_ATTRIBUTES = %w[content excerpt next previous].freeze
|
38
27
|
|
39
|
-
|
28
|
+
# Method prescribed by the Jekyll support plugin.
|
29
|
+
# @return [String]
|
30
|
+
def render_impl(content)
|
31
|
+
@helper.gem_file __FILE__ # This enables attribution
|
40
32
|
|
41
|
-
|
42
|
-
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@param5 = params[:param5]
|
48
|
-
@param_x = params[:not_present] # The value of parameters that are present is nil, but displays as the empty string
|
33
|
+
@param1 = @helper.keys_values['param1'] # Obtain the value of parameter param1
|
34
|
+
@param2 = @helper.keys_values['param2']
|
35
|
+
@param3 = @helper.keys_values['param3']
|
36
|
+
@param4 = @helper.keys_values['param4']
|
37
|
+
@param5 = @helper.keys_values['param5']
|
38
|
+
@param_x = @helper.keys_values['not_present'] # The value of parameters that are present is nil, but displays as the empty string
|
49
39
|
|
50
40
|
@logger.debug do
|
51
41
|
<<~HEREDOC
|
52
|
-
tag_name = '#{tag_name}'
|
53
|
-
argument_string = '#{argument_string}'
|
42
|
+
tag_name = '#{@helper.tag_name}'
|
43
|
+
argument_string = '#{@helper.argument_string}'
|
54
44
|
@param1 = '#{@param1}'
|
55
45
|
@param2 = '#{@param2}'
|
56
46
|
@param3 = '#{@param3}'
|
@@ -58,36 +48,14 @@ module JekyllBlockTagPlugin
|
|
58
48
|
@param5 = '#{@param5}'
|
59
49
|
@param_x = '#{@param_x}'
|
60
50
|
params =
|
61
|
-
#{
|
51
|
+
#{@helper.keys_values.map { |k, v| "#{k} = #{v}" }.join("\n ")}
|
62
52
|
HEREDOC
|
63
53
|
end
|
64
|
-
end
|
65
|
-
|
66
|
-
REJECTED_ATTRIBUTES = %w[content excerpt next previous].freeze
|
67
|
-
|
68
|
-
# Method prescribed by the Jekyll plugin lifecycle.
|
69
|
-
# @param liquid_context [Liquid::Context]
|
70
|
-
# @return [String]
|
71
|
-
def render(liquid_context) # rubocop:disable Metrics/AbcSize
|
72
|
-
content = super # This underdocumented assignment returns the text within the block.
|
73
|
-
|
74
|
-
@site = liquid_context.registers[:site]
|
75
|
-
@config = @site.config
|
76
|
-
@mode = @config.dig('env', 'JEKYLL_ENV') || 'development'
|
77
|
-
|
78
|
-
# variables defined in pages are stored as hash values in liquid_context
|
79
|
-
_assigned_page_variable = liquid_context['assigned_page_variable']
|
80
|
-
|
81
|
-
# The names of front matter variables are hash keys for @page
|
82
|
-
@page = liquid_context.registers[:page] # @page is a Jekyll::Drops::DocumentDrop
|
83
|
-
# layout = @page['layout']
|
84
54
|
|
85
|
-
@envs = liquid_context.environments.first
|
86
55
|
@layout_hash = @envs['layout']
|
87
56
|
|
88
57
|
@logger.debug do
|
89
58
|
<<~HEREDOC
|
90
|
-
liquid_context.scopes=#{liquid_context.scopes}
|
91
59
|
mode="#{@mode}"
|
92
60
|
page attributes:
|
93
61
|
#{@page.sort
|
@@ -101,10 +69,14 @@ module JekyllBlockTagPlugin
|
|
101
69
|
<<~HEREDOC
|
102
70
|
<p style='color: green; background-color: yellow; padding: 1em; border: solid thin grey;'>
|
103
71
|
#{content} #{@param1}
|
72
|
+
#{@helper.attribute if @helper.attribution}
|
104
73
|
</p>
|
105
74
|
HEREDOC
|
75
|
+
rescue StandardError => e
|
76
|
+
@logger.error { "#{self.class} died with a #{e.full_message}" }
|
77
|
+
exit 3
|
106
78
|
end
|
107
79
|
|
108
|
-
JekyllPluginHelper.register(self, JekyllPluginBlockTagTemplate::PLUGIN_NAME)
|
80
|
+
JekyllSupport::JekyllPluginHelper.register(self, JekyllPluginBlockTagTemplate::PLUGIN_NAME)
|
109
81
|
end
|
110
82
|
end
|
data/lib/jekyll_tag_plugin.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'jekyll_plugin_support'
|
2
2
|
|
3
|
-
module JekyllPluginTagTemplate
|
4
|
-
PLUGIN_NAME = 'tag_template'.freeze
|
5
|
-
end
|
6
|
-
|
7
3
|
# This Jekyll tag plugin creates an emoji of the desired size and alignment.
|
8
4
|
#
|
9
5
|
# @example Float Smiley emoji right, sized 3em
|
@@ -22,6 +18,8 @@ end
|
|
22
18
|
# plugin_loggers:
|
23
19
|
# MyTag: debug
|
24
20
|
module JekyllTagPlugin
|
21
|
+
PLUGIN_NAME = 'tag_template'.freeze
|
22
|
+
|
25
23
|
# This class implements the Jekyll tag functionality
|
26
24
|
class MyTag < JekyllSupport::JekyllTag
|
27
25
|
include JekyllPluginTemplateVersion
|
@@ -41,7 +39,7 @@ module JekyllTagPlugin
|
|
41
39
|
'smiley' => '😁', # default emoji
|
42
40
|
'smirk' => '😏',
|
43
41
|
'two_hearts' => '💕',
|
44
|
-
}.sort_by { |k,
|
42
|
+
}.sort_by { |k, _v| [k] }.to_h
|
45
43
|
|
46
44
|
# @param tag_name [String] is the name of the tag, which we already know.
|
47
45
|
# @param argument_string [String] the arguments from the web page.
|
@@ -101,13 +99,16 @@ module JekyllTagPlugin
|
|
101
99
|
end
|
102
100
|
|
103
101
|
def list
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
102
|
+
items = @@emojis.map do |ename, hex_code|
|
103
|
+
" <li>#{assemble_emoji(ename, hex_code)}</li>"
|
104
|
+
end
|
105
|
+
<<~END_RESULT
|
106
|
+
<ul class='emoji_list'>
|
107
|
+
#{items.join("\n ")}
|
108
|
+
</ul>
|
109
|
+
END_RESULT
|
109
110
|
end
|
110
111
|
|
111
|
-
JekyllPluginHelper.register(self,
|
112
|
+
JekyllSupport::JekyllPluginHelper.register(self, JekyllTagPlugin::PLUGIN_NAME)
|
112
113
|
end
|
113
114
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,9 +8,8 @@ require_relative '../lib/jekyll_plugin_template'
|
|
8
8
|
Jekyll.logger.log_level = :info
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
11
|
-
config.
|
11
|
+
config.filter_run_when_matching focus: true
|
12
12
|
config.order = 'random'
|
13
|
-
config.run_all_when_everything_filtered = true
|
14
13
|
|
15
14
|
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
16
15
|
config.example_status_persistence_file_path = 'spec/status_persistence.txt'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------------ | ------ | --------------- |
|
3
|
+
./spec/jekyll_plugin_template_spec.rb[1:1] | passed | 0.02165 seconds |
|
4
|
+
./spec/run_this_first_spec.rb[1:1] | failed | 0.00134 seconds |
|
5
|
+
./spec/run_this_first_spec.rb[1:2] | failed | 2.84 seconds |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_plugin_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Mike Slinn
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: jekyll_plugin_support
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.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.
|
40
|
+
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: git
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,14 +143,15 @@ files:
|
|
143
143
|
- spec/run_this_first_helper.rb
|
144
144
|
- spec/run_this_first_spec.rb
|
145
145
|
- spec/spec_helper.rb
|
146
|
-
|
146
|
+
- spec/status_persistence.txt
|
147
|
+
homepage: https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html
|
147
148
|
licenses:
|
148
149
|
- CC0-1.0
|
149
150
|
metadata:
|
150
151
|
allowed_push_host: https://rubygems.org
|
151
152
|
bug_tracker_uri: https://github.com/mslinn/jekyll_plugin_template/issues
|
152
153
|
changelog_uri: https://github.com/mslinn/jekyll_plugin_template/CHANGELOG.md
|
153
|
-
homepage_uri: https://www.mslinn.com/
|
154
|
+
homepage_uri: https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html
|
154
155
|
source_code_uri: https://github.com/mslinn/jekyll_plugin_template
|
155
156
|
post_install_message:
|
156
157
|
rdoc_options: []
|
@@ -167,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.5.16
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Write a short summary; RubyGems requires one.
|