jekyll_pre 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +10 -0
- data/lib/exec_tag.rb +23 -10
- data/lib/jekyll_pre/version.rb +1 -1
- 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: c9c89dfed1bd63dfb97f8eea204a543d7ea06af6dca9f8b627b2bcf51ad0e65d
|
4
|
+
data.tar.gz: e81ee9721c99b5391d401c6a19fbbd2bca8371225b9cc2bf82ff3bfbcc4ab274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79af8ae474c13a9ad92436e1c916f4b21269b2944fc41725f59976ca543da264ebe8fd669cfe9de119c7f882d138b860006dc70c328c7ad6a58c16c700987a53
|
7
|
+
data.tar.gz: 004b17970a50fbe7c9df57d47b38456b36d5786d831db067dba9be7d219fac72823768a63247013beffb02ba9c9a24faa2379323dcdb6e8d1fb08dd99e4c628b
|
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/lib/exec_tag.rb
CHANGED
@@ -77,31 +77,44 @@ 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
116
|
@child_status = $CHILD_STATUS
|
104
|
-
|
117
|
+
stdout_str
|
105
118
|
end
|
106
119
|
|
107
120
|
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.3
|
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-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|