jekyll_plugin_template 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b8804da5578887e2b1dd581de8ad30d4e7e4f4ed4a9a4d6c517e710f52a94c3
4
- data.tar.gz: 9237ebfda58f9da784c9c19c13f60ca9f4b7fcaa62a818b9b383c58b66a931ae
3
+ metadata.gz: a4c4b04f631f93d694b6ac414c7c13e9ee040bdb054adad7d8fcacf74c86d26d
4
+ data.tar.gz: 83990ea5e791dc5fddf63e9493ca50af1ecacbd35021481f1400b09df70b0cc1
5
5
  SHA512:
6
- metadata.gz: 8a034a2186a0cd8835a96de90c959da5969b8703d8321c86cd3ed5a34fc8473d8ef6363c67aa6ce51a5214b97e97d19be8d790f8d22667ff9eb460f6279e27be
7
- data.tar.gz: 2286531c8782695985b19746a019f1215c257ea2c4ffee55bf2fdacf38d3555c85f8a15cd3145f30d466a67c6d31d7ba522b86b4baae1d6779bafeecb9bba86b
6
+ metadata.gz: f37621435bcb0c4d22a3765deee2e2a8942a3c6e1198ad2f737076c8aa8898937bc32d1ce2b2573fdfc16390cf05be92de5701226355764ab086553c21b03024
7
+ data.tar.gz: 3968dcc9173c86d0466cd00fb5d67e5236e716136a237b6e03b9a3509a319a948f8c804e22b1d46d5021d8f43d82911c6f1c75e22008bbb883b16234acb834ad
data/.rubocop.yml CHANGED
@@ -1,37 +1,80 @@
1
- # require: rubocop-jekyll
2
- # inherit_gem:
3
- # rubocop-jekyll: .rubocop.yml
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
- - vendor/**/*
8
- - Gemfile*
9
- - '*.gemspec' # This does nothing. Why?
10
+ - demo/_site/**/*
11
+ - exe/**/*
12
+ - vendor/**/*
13
+ - Gemfile*
14
+ - Rakefile
15
+ - jekyll_plugin_template.gemspec
10
16
  NewCops: enable
11
17
  TargetRubyVersion: 2.6
12
18
 
13
- # Gemspec/RequireMFA:
14
- # Enabled: false
19
+ Gemspec/DeprecatedAttributeAssignment:
20
+ Enabled: false
21
+
22
+ Gemspec/RequireMFA:
23
+ Enabled: false
15
24
 
16
- # Jekyll/NoPutsAllowed:
17
- # Enabled: false
25
+ Layout/InitialIndentation:
26
+ Exclude:
27
+ - README.md
18
28
 
19
29
  Layout/HashAlignment:
30
+ EnforcedColonStyle: table
20
31
  EnforcedHashRocketStyle: table
21
32
 
22
33
  Layout/LineLength:
23
34
  Max: 150
24
35
 
36
+ Layout/MultilineMethodCallIndentation:
37
+ Enabled: false
38
+
39
+ Lint/RedundantCopDisableDirective:
40
+ Exclude:
41
+ - jekyll_plugin_template.gemspec
42
+
25
43
  Metrics/AbcSize:
26
- Max: 20
44
+ Max: 35
27
45
 
28
46
  Metrics/BlockLength:
29
- Max: 50
47
+ Exclude:
48
+ - jekyll_plugin_template.gemspec
49
+ - spec/**/*
50
+
51
+ Metrics/ClassLength:
52
+ Exclude:
53
+ - spec/**/*
30
54
 
31
55
  Metrics/MethodLength:
32
56
  Max: 40
33
57
 
34
- Metrics/ModuleLength:
58
+ Metrics/CyclomaticComplexity:
59
+ Max: 10
60
+
61
+ Metrics/PerceivedComplexity:
62
+ Max: 10
63
+
64
+ Naming/FileName:
65
+ Exclude:
66
+ - Rakefile
67
+
68
+ RSpec/ExampleLength:
69
+ Max: 20
70
+
71
+ RSpec/MultipleExpectations:
72
+ Max: 15
73
+
74
+ Style/CommandLiteral:
75
+ Enabled: false
76
+
77
+ Style/CommentedKeyword:
35
78
  Enabled: false
36
79
 
37
80
  Style/Documentation:
@@ -40,5 +83,21 @@ Style/Documentation:
40
83
  Style/FrozenStringLiteralComment:
41
84
  Enabled: false
42
85
 
86
+ Style/PercentLiteralDelimiters:
87
+ Enabled: false
88
+
89
+ Style/RegexpLiteral:
90
+ Enabled: false
91
+
92
+ Style/StringConcatenation:
93
+ Exclude:
94
+ - spec/**/*
95
+
43
96
  Style/StringLiterals:
44
97
  Enabled: false
98
+
99
+ Style/StringLiteralsInInterpolation:
100
+ Enabled: false
101
+
102
+ Style/TrailingCommaInHashLiteral:
103
+ EnforcedStyleForMultiline: comma
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.0 / 2023-04-05
2
+ * Updated to `jekyll_plugin_support` v0.6.0 for attribution support.
3
+ * Fixed `jeky_block_tag_plugin.rb` so it works properly with `jekyll_plugin_support`.
4
+
1
5
  ## 0.2.0 / 2023-02-16
2
6
  * Updated to `jekyll_plugin_support` v0.5.0.
3
7
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
- task :default => :spec
5
+ task default: :spec
@@ -1,6 +1,6 @@
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
6
  spec.authors = ['Firstname Lastname']
@@ -14,7 +14,7 @@ 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/blog/2020/12/30/jekyll-plugin-template-collection.html'
17
+ spec.homepage = 'https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html'
18
18
  spec.license = 'CC0-1.0'
19
19
  spec.metadata = {
20
20
  'allowed_push_host' => 'https://rubygems.org',
@@ -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', '~> 0.5.0'
33
+ spec.add_dependency 'jekyll_plugin_support', '>= 0.7.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
- # See https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers#create-your-own-tags
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
- @argument_string = argument_string
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
- argv = Shellwords.split(argument_string) # Scans name/value arguments
42
- params = KeyValueParser.new.parse(argv) # Extracts key/value pairs, default value for non-existant keys is nil
43
- @param1 = params[:param1] # Obtain the value of parameter param1
44
- @param2 = params[:param2]
45
- @param3 = params[:param3]
46
- @param4 = params[:param4]
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
- #{params.map { |k, v| "#{k} = #{v}" }.join("\n ")}
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,8 +69,12 @@ 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
80
  JekyllPluginHelper.register(self, JekyllPluginBlockTagTemplate::PLUGIN_NAME)
@@ -1,3 +1,3 @@
1
1
  module JekyllPluginTemplateVersion
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -41,7 +41,7 @@ module JekyllTagPlugin
41
41
  'smiley' => '&#x1F601;', # default emoji
42
42
  'smirk' => '&#x1F60F;',
43
43
  'two_hearts' => '&#x1F495;',
44
- }.sort_by { |k, v| [k] }.to_h
44
+ }.sort_by { |k, _v| [k] }.to_h
45
45
 
46
46
  # @param tag_name [String] is the name of the tag, which we already know.
47
47
  # @param argument_string [String] the arguments from the web page.
@@ -101,11 +101,14 @@ module JekyllTagPlugin
101
101
  end
102
102
 
103
103
  def list
104
- "<ul class='emoji_list'>\n" +
105
- (@@emojis.map do |ename, hex_code|
106
- " <li>#{ assemble_emoji(ename, hex_code) }</li>\n"
107
- end).join +
108
- "</ul>\n"
104
+ items = @@emojis.map do |ename, hex_code|
105
+ " <li>#{assemble_emoji(ename, hex_code)}</li>"
106
+ end
107
+ <<~END_RESULT
108
+ <ul class='emoji_list'>
109
+ #{items.join("\n ")}
110
+ </ul>
111
+ END_RESULT
109
112
  end
110
113
 
111
114
  JekyllPluginHelper.register(self, JekyllPluginTagTemplate::PLUGIN_NAME)
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firstname Lastname
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-16 00:00:00.000000000 Z
11
+ date: 2023-07-06 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.5.0
33
+ version: 0.7.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.5.0
40
+ version: 0.7.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: git
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -143,14 +143,14 @@ files:
143
143
  - spec/run_this_first_helper.rb
144
144
  - spec/run_this_first_spec.rb
145
145
  - spec/spec_helper.rb
146
- homepage: https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html
146
+ homepage: https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html
147
147
  licenses:
148
148
  - CC0-1.0
149
149
  metadata:
150
150
  allowed_push_host: https://rubygems.org
151
151
  bug_tracker_uri: https://github.com/mslinn/jekyll_plugin_template/issues
152
152
  changelog_uri: https://github.com/mslinn/jekyll_plugin_template/CHANGELOG.md
153
- homepage_uri: https://www.mslinn.com/blog/2020/12/30/jekyll-plugin-template-collection.html
153
+ homepage_uri: https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html
154
154
  source_code_uri: https://github.com/mslinn/jekyll_plugin_template
155
155
  post_install_message:
156
156
  rdoc_options: []