jekyll_plugin_support 3.1.0 → 3.1.1

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: c20bec384d298ac931d132f59dbcaf621e9f55440954dc8c6579b1c9131df62e
4
- data.tar.gz: 4cfd22137529da35c52f788ab70ec81fe9457d6b533ec5bc70f653b22791db0e
3
+ metadata.gz: 89c80e46269ce8e9476f0758550b2d0acb48bd9462ffe0e6d957c436d1c98d2d
4
+ data.tar.gz: 920e92f0c86d0884193650af1039790df087edc158b529537d37c1fa1d04e680
5
5
  SHA512:
6
- metadata.gz: eafd8b44d05e23011bd30a2bb3bab69befb3cd90b520585d4cf05d164b1b2c76a5218cdd0bdbf3bc7ba6f9a25e789f171403f3553d2cb68d13e0c54346d69b5e
7
- data.tar.gz: 1beb29113474e1d501d5394b90288f7e46047e846b868df80f1a5afe9287ae7eece17e7d00e95e9443b7d3b2a69d6d93d9c27d0f6d81d1f4d2f0afba8ae152fe
6
+ metadata.gz: 1d0045d9f09b3b76c8306073d50c06b1f93fd4c7914a08ce24a826d75ffa033c84660710d8822ea25f18e5585cb94232e7634d68f7b4822aee311865768fc028
7
+ data.tar.gz: 779da912b97c957c69f8829265c7ad2ad213c6ccf286acae65d87e13a03c24d23e32eea85d22edd9c93aa4084f07732178325f9e7cb7bbb5484859b8e2f8ca79
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.1.1 / 2025-09-13
4
+
5
+ * Now looks up Windows environment variables (surrounded by `%` characters).
6
+ An error is generated for undefined variables.
7
+
8
+
3
9
  ## 3.1.0 / 2025-06-10
4
10
 
5
11
  * Added attribute `order` and method `field` to support `jekyll_outline`.
data/README.md CHANGED
@@ -71,6 +71,24 @@ Jekyll plugin tags created from `jekyll_plugin_support` framework automatically
71
71
 
72
72
  ## Installation
73
73
 
74
+ ### If You Need Windows Environment Variable Expansion
75
+
76
+ This only works if Jekyll is running on a Windows / WSL machine.
77
+ If you have a Mac, ignore the rest of this section, however be sure
78
+ not to try to include a file whose name contains two percent characters.
79
+
80
+ If a %WindowsStyleEnvironmentVariable% is detected in the `url` parameter,
81
+ `wslvar` is called.
82
+ If your WSL installation is old it might not have the `wslvar` command
83
+
84
+ The wslvar utility is part of the wslu package, a collection of useful utilities that come with WSL.
85
+ The most straightforward fix is to reinstall it.
86
+
87
+ ```shell
88
+ $ sudo apt update
89
+ $ sudo apt install wslu
90
+ ```
91
+
74
92
  ### For A Jekyll Website
75
93
 
76
94
  `Jekyll_plugin_support` is packaged as a Ruby gem.
@@ -5,10 +5,10 @@ require 'yaml'
5
5
  module JekyllSupport
6
6
  # Class methods for JekyllPluginHelper
7
7
  class JekyllPluginHelper
8
- # Expand an environment variable reference
8
+ # Expand an environment variable reference; first expand bash environment variables, then expand windows environment vars
9
9
  def self.expand_env(str, logger = nil, die_if_undefined: false)
10
- str&.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}/) do
11
- envar = Regexp.last_match(1)
10
+ x = str&.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}/) do
11
+ envar = Regexp.last_match 1
12
12
  unless ENV.key? envar
13
13
  msg = "jekyll_plugin_support error: environment variable #{envar} is undefined"
14
14
  raise JekyllPluginSupportError, msg.red, [] if die_if_undefined
@@ -21,6 +21,26 @@ module JekyllSupport
21
21
  end
22
22
  ENV.fetch(envar, nil)
23
23
  end
24
+ # Only expand %VAR% if x is not nil and contains a %
25
+ if x&.include?('%')
26
+ x.gsub(/%([a-zA-Z_][a-zA-Z0-9_]*)%|{\g<1>}/) do
27
+ envar = Regexp.last_match 1
28
+ value = `wslvar #{envar} &2> /dev/null`.chomp
29
+ unless value
30
+ msg = "jekyll_plugin_support error: Windows environment variable %#{envar}% is undefined"
31
+ raise JekyllPluginSupportError, msg.red, [] if die_if_undefined
32
+
33
+ if logger
34
+ logger.warn msg
35
+ else
36
+ puts msg.red
37
+ end
38
+ end
39
+ value
40
+ end
41
+ else
42
+ x
43
+ end
24
44
  end
25
45
 
26
46
  def self.generate_message(klass, tag_name, version)
@@ -1,3 +1,3 @@
1
1
  module JekyllPluginSupportVersion
2
- VERSION = '3.1.0'.freeze unless defined?(VERSION)
2
+ VERSION = '3.1.1'.freeze unless defined?(VERSION)
3
3
  end
@@ -1,6 +1,9 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------------------------ | ------ | --------------- |
3
- ./spec/jekyll_plugin_helper_options_spec.rb[1:1] | passed | 0.00559 seconds |
4
- ./spec/jekyll_plugin_helper_options_spec.rb[1:2] | passed | 0.00583 seconds |
5
- ./spec/jekyll_plugin_helper_options_spec.rb[1:3] | passed | 0.00543 seconds |
6
- ./spec/jekyll_plugin_helper_options_spec.rb[1:4] | passed | 0.00157 seconds |
3
+ ./spec/custom_error_spec.rb[1:1] | failed | 0.00772 seconds |
4
+ ./spec/custom_error_spec.rb[2:1] | passed | 0.0011 seconds |
5
+ ./spec/jekyll_plugin_helper_options_spec.rb[1:1] | failed | 0.00005 seconds |
6
+ ./spec/jekyll_plugin_helper_options_spec.rb[1:2] | failed | 0.00003 seconds |
7
+ ./spec/jekyll_plugin_helper_options_spec.rb[1:3] | failed | 0.00003 seconds |
8
+ ./spec/jekyll_plugin_helper_options_spec.rb[1:4] | failed | 0.00003 seconds |
9
+ ./spec/liquid_variable_parsing_spec.rb[1:1] | failed | 0.00003 seconds |
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_plugin_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubygems_version: 3.6.9
184
+ rubygems_version: 3.7.2
185
185
  specification_version: 4
186
186
  summary: Provides a framework for writing and testing Jekyll plugins
187
187
  test_files: