jekyll_pre 1.4.2 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +10 -0
- data/jekyll_pre.gemspec +1 -1
- data/lib/exec_tag.rb +23 -11
- data/lib/jekyll_pre/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7d377e36ea0a56b8f739226880016398a4f777fb510c43bee01bd3010c7ddd3
|
4
|
+
data.tar.gz: 9a3330b73d8f8c314ce9c363fe9f0acf1a3092de37c3a156b4ba0bc65a2e8d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd099f9d1b63bfd5be501d998a7ed594cb9597a433d644dce96554b642079c94e944e28ebc99260bdf08ee0ee649593843063a14c9559b8a19f290242ffe6d95
|
7
|
+
data.tar.gz: 8b5e35e564f47477a96a7bab9b69aee4477e3ab11e0977d062357df2691c5c6b03054a75d4f524387e364a2d0e5c7f1653db7b0b9653f71cbb76e1e23474eddb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -61,6 +61,16 @@ This Jekyll plugin provides 3 new Liquid tags that work together:
|
|
61
61
|
- `die_if_error` – Set `false` to treat exceptions generated by this plugin as non-fatal.
|
62
62
|
Instead of terminating Jekyll with an error message, the message will be displayed as an error by the Jekyll logger.
|
63
63
|
- `no_escape` – Do not HTML escape the result of running the shell command.
|
64
|
+
- `no_stderr` - Discard STDERR output.
|
65
|
+
This is helpful for suppressing annoying `groff` error messages that are emitted when the `exec` subcommand runs `man`.
|
66
|
+
Use it like this:
|
67
|
+
|
68
|
+
```html
|
69
|
+
{% pre copyButton dedent shell %}
|
70
|
+
{% noselect %}{% exec no_stderr man netplan %}
|
71
|
+
{% endpre %}
|
72
|
+
```
|
73
|
+
|
64
74
|
- `no_strip` – Do not remove leading and trailing whitespace from the result.
|
65
75
|
- `wrapper_class` class applied to outer `div`.
|
66
76
|
- `wrapper_style` style applied to outer `div`.
|
data/jekyll_pre.gemspec
CHANGED
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.version = JekyllPreVersion::VERSION
|
34
34
|
|
35
35
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
36
|
-
spec.add_dependency 'jekyll_plugin_support', '>= 0.
|
36
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 0.8.0'
|
37
37
|
spec.add_dependency 'rack'
|
38
38
|
end
|
data/lib/exec_tag.rb
CHANGED
@@ -77,31 +77,43 @@ module JekyllPreModule
|
|
77
77
|
|
78
78
|
@no_escape = @helper.parameter_specified? 'no_escape'
|
79
79
|
@no_strip = @helper.parameter_specified? 'no_strip'
|
80
|
+
@no_stderr = @helper.parameter_specified? 'no_stderr'
|
80
81
|
@die_if_nonzero = @helper.parameter_specified?('die_if_nonzero') # Implies die_if_error
|
81
82
|
@die_if_error = @helper.parameter_specified?('die_if_error') | @die_if_nonzero
|
82
83
|
end
|
83
84
|
|
84
85
|
# References @cd
|
85
86
|
# Defines @child_status
|
87
|
+
# Ignores stderr output
|
86
88
|
# @return result of running command
|
87
89
|
# @param command [String] Shell command to execute
|
88
90
|
def run_command(command)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
91
|
+
stdout_str = ''
|
92
|
+
stderr_str = ''
|
93
|
+
if @cd
|
94
|
+
Dir.chdir(@cd) do
|
95
|
+
@logger.debug { "Executing '#{command}' from '#{@cd}'" }
|
96
|
+
stdout_str, stderr_str, @child_status = Open3.capture3 command
|
97
|
+
end
|
98
|
+
else
|
99
|
+
@logger.debug { "Executing '#{command}'" }
|
100
|
+
stdout_str, stderr_str, @child_status = Open3.capture3 command
|
101
|
+
end
|
102
|
+
unless @no_stderr
|
103
|
+
stderr_str.strip!
|
104
|
+
unless stderr_str.empty?
|
105
|
+
@logger.info do
|
106
|
+
"'#{command}' STDERR=#{stderr_str}\nThe exec subcommand's 'no_stderr' option suppresses this message."
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
stdout_str
|
98
111
|
rescue StandardError => e
|
99
112
|
msg = self.class.remove_html_tags(e.message) +
|
100
113
|
" from executing '#{@original_command}' on line #{@line_number} (after front matter) of #{@page['path']}"
|
101
114
|
raise PreError, msg.red, [] if @die_if_error
|
102
115
|
ensure
|
103
|
-
|
104
|
-
result
|
116
|
+
stdout_str
|
105
117
|
end
|
106
118
|
|
107
119
|
JekyllPluginHelper.register(self, 'exec')
|
data/lib/jekyll_pre/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_pre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.8.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: 0.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|