jekyll_plugin_support 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d96d3f40ca733d7fa1322a8fbec0a70131029baa063a32c55fdc003efcf0d24
4
- data.tar.gz: 2ebb3e46419147a2f1b60e2024fd7118617be61c6cd8f359e448aad2279bf92f
3
+ metadata.gz: 20c575e857da7ffa50f37a587494b25232e1eb1309040946dd13d8f896250f07
4
+ data.tar.gz: 4aa5e163875f4e99adca9a6bc4ca97927c95c4cc4d017f52ca0b108d9ea24670
5
5
  SHA512:
6
- metadata.gz: f4022b99e9b6b1eef55be72e3cbe6a8d99af12e6ec0004a1e2c610325c726ffdf5cef042ce8687eb9be4e352fc7372e3a51f7053e39303cb06ff2dd5f180d530
7
- data.tar.gz: 6d6b5d1221e8985a02bc8bfe32d6411cb516aa4376a0a3f27d9dc6d7b66bee43ce41c02b026e102f9b5035f0b6b116cf8983e1b8b6cea3847a5c2d70733cff69
6
+ metadata.gz: f2a2123c073c9e344e097e3eecd364606037bdd0213045d7060a09d48acaac1810eb609e201126e3f4fc8e5edc0e4e6e81db43800aa4eea954490d4e21e91cdc
7
+ data.tar.gz: 2d4e8daa6ea71e412065356a7029f3ff0b432fb7a06cdc98f403ba02709106f75c62e8236bae12668e6b181f4c52ccba328811fdb9619cd075597fea622052e7
data/CHANGELOG.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # Change Log
2
2
 
3
3
 
4
+ ## 0.8.5 / 2024-03-25
5
+
6
+ * Empty block tags now return a value. See https://talk.jekyllrb.com/t/empty-liquid-block-not-rendering
7
+
8
+
4
9
  ## 0.8.4 / 2024-02-27
5
10
 
6
11
  * Problem in error handler fixed.
12
+ * A warning is logged if an environment variable is undefined and `die_if_undefined` is not set.
7
13
 
8
14
 
9
15
  ## 0.8.3 / 2024-01-05
@@ -35,7 +35,6 @@ module JekyllSupportErrorHandling
35
35
  string.gsub(/\e\[([;\d]+)?m/, '')
36
36
  end
37
37
 
38
- # TODO: Delete this
39
38
  def maybe_reraise_error(error, throw_error: true)
40
39
  fmsg = format_error_message "#{error.class}: #{error.message.strip}"
41
40
  @logger.error { fmsg }
@@ -98,7 +98,7 @@ class JekyllPluginHelper
98
98
  .parse(@argv_original)
99
99
  @params_original = @keys_values_original unless respond_to?(:no_arg_parsing) && no_arg_parsing
100
100
 
101
- @argv = Shellwords.split(self.class.expand_env(markup))
101
+ @argv = Shellwords.split(self.class.expand_env(markup, logger))
102
102
  @keys_values = KeyValueParser
103
103
  .new({}, { array_values: false, normalize_keys: false, separator: /=/ })
104
104
  .parse(@argv)
@@ -5,12 +5,19 @@ require 'yaml'
5
5
  # Class methods for JekyllPluginHelper
6
6
  class JekyllPluginHelper
7
7
  # Expand an environment variable reference
8
- def self.expand_env(str, die_if_undefined: false)
9
- str&.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}|%\g<1>%/) do
8
+ def self.expand_env(str, logger = nil, die_if_undefined: false)
9
+ str&.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}/) do
10
10
  envar = Regexp.last_match(1)
11
- raise JekyllPluginSupportError, "jekyll_plugin_support error: #{envar} is undefined".red, [] \
12
- if !ENV.key?(envar) && die_if_undefined # Suppress stack trace
11
+ unless ENV.key? envar
12
+ msg = "jekyll_plugin_support error: environment variable #{envar} is undefined"
13
+ raise JekyllPluginSupportError, msg.red, [] if die_if_undefined
13
14
 
15
+ if logger
16
+ logger.warn msg
17
+ else
18
+ puts msg.red
19
+ end
20
+ end
14
21
  ENV.fetch(envar, nil)
15
22
  end
16
23
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllPluginSupportVersion
2
- VERSION = '0.8.4'.freeze
2
+ VERSION = '0.8.5'.freeze
3
3
  end
@@ -29,6 +29,12 @@ module JekyllSupport
29
29
  Jekyll::CustomError.factory @error_name
30
30
  end
31
31
 
32
+ # Liquid::Block subclasses do not render if there is no content within the tag
33
+ # This override fixes that
34
+ def blank?
35
+ false
36
+ end
37
+
32
38
  # Method prescribed by the Jekyll plugin lifecycle.
33
39
  # Defines @config, @envs, @mode, @page and @site
34
40
  # @return [String]
@@ -52,7 +58,7 @@ module JekyllSupport
52
58
 
53
59
  @mode = @config['env']&.key?('JEKYLL_ENV') ? @config['env']['JEKYLL_ENV'] : 'development'
54
60
 
55
- @helper.reinitialize(@markup.strip)
61
+ @helper.reinitialize @markup.strip
56
62
 
57
63
  @attribution = @helper.parameter_specified?('attribution') || false unless @no_arg_parsing
58
64
  @logger.debug { "@keys_values='#{@keys_values}'" }
@@ -60,7 +66,7 @@ module JekyllSupport
60
66
  markup = JekyllSupport.lookup_liquid_variables liquid_context, @argument_string
61
67
  @helper.reinitialize markup
62
68
 
63
- render_impl text
69
+ render_impl(text)
64
70
  rescue StandardError => e
65
71
  e.shorten_backtrace
66
72
  @logger.error { "#{e.class} on line #{@line_number} of #{e.backtrace[0].split(':').first} by #{tag_name} - #{e.message}" }
@@ -64,8 +64,9 @@ module JekyllSupport
64
64
  rescue StandardError => e
65
65
  e.shorten_backtrace
66
66
  file_name = e.backtrace[0]&.split(':')&.first
67
- of_file_name = "of #{file_name} " if file_name
68
- @logger.error { "#{e.class} on line #{@line_number} #{of_file_name}while processing #{tag_name} - #{e.message}" }
67
+ in_file_name = "in '#{file_name}' " if file_name
68
+ of_page = "of '#{@page['path']}'" if @page
69
+ @logger.error { "#{e.class} on line #{@line_number} #{of_page}while processing #{tag_name} #{in_file_name}- #{e.message}" }
69
70
  binding.pry if @pry_on_standard_error # rubocop:disable Lint/Debugger
70
71
  raise e if @die_on_standard_error
71
72
 
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
4
+ version: 0.8.5
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-02-27 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facets