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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/jekyll_plugin_error_handling.rb +0 -1
- data/lib/jekyll_plugin_helper.rb +1 -1
- data/lib/jekyll_plugin_helper_class.rb +11 -4
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support_block.rb +8 -2
- data/lib/jekyll_plugin_support_tag.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20c575e857da7ffa50f37a587494b25232e1eb1309040946dd13d8f896250f07
|
4
|
+
data.tar.gz: 4aa5e163875f4e99adca9a6bc4ca97927c95c4cc4d017f52ca0b108d9ea24670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/jekyll_plugin_helper.rb
CHANGED
@@ -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>}
|
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
|
-
|
12
|
-
|
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
|
@@ -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
|
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
|
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
|
-
|
68
|
-
|
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
|
+
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-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|