jekyll_pre 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -2
- data/CHANGELOG.md +88 -35
- data/README.md +193 -83
- data/jekyll_pre.gemspec +2 -2
- data/lib/exec_tag.rb +1 -1
- data/lib/jekyll_pre/version.rb +1 -1
- data/lib/pre_tag_block.rb +1 -0
- data/spec/spec_helper.rb +1 -2
- data/spec/status_persistence.txt +8 -13
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9891991d8f4517372a76f9a52f60dd8d063a5527738b2bd5194fc749bba5a02e
|
4
|
+
data.tar.gz: 52b238c5f9aee99c593bd552552411503a0dd49f2c470b1c48bc6600c257e114
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3629fe65cd677c4d964b89e5197f6f18862177da853d862a905bd0162eb6265aa3922e196a34c0149bfd627e9d959155a39675b5ebccde9dfc5cd5f6fa05a355
|
7
|
+
data.tar.gz: 341e7a4863fc7dccb227d997154cccf677ef4576403f8c75b74cc1a596cbc1c1232d95df1257d052c03f6a65d0fb2104024398902b1fa98e68f54b912df46974
|
data/.rubocop.yml
CHANGED
@@ -7,15 +7,17 @@ require:
|
|
7
7
|
|
8
8
|
AllCops:
|
9
9
|
Exclude:
|
10
|
-
-
|
10
|
+
- binstub/**/*
|
11
11
|
- vendor/**/*
|
12
12
|
- Gemfile*
|
13
13
|
NewCops: enable
|
14
|
-
TargetRubyVersion: 2.6
|
15
14
|
|
16
15
|
Gemspec/DeprecatedAttributeAssignment:
|
17
16
|
Enabled: false
|
18
17
|
|
18
|
+
Gemspec/RequiredRubyVersion:
|
19
|
+
Enabled: false
|
20
|
+
|
19
21
|
Gemspec/RequireMFA:
|
20
22
|
Enabled: false
|
21
23
|
|
data/CHANGELOG.md
CHANGED
@@ -1,74 +1,127 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 1.4.2
|
4
|
+
|
5
|
+
* Added missing `require` in `pre_tag_block.rb`.
|
6
|
+
|
7
|
+
|
8
|
+
## 1.4.1
|
9
|
+
|
10
|
+
* Fixed problem that caused exec tag to no produce output.
|
11
|
+
|
12
|
+
|
1
13
|
## 1.4.0
|
2
|
-
|
3
|
-
|
14
|
+
|
15
|
+
* Added `dedent` option and config setting.
|
16
|
+
* No longer dies when exec is passed an empty string, or a string with just whitespace.
|
17
|
+
|
4
18
|
|
5
19
|
## 1.3.2
|
6
|
-
|
20
|
+
|
21
|
+
* No longer strips leading spaces from exec result lines.
|
22
|
+
|
7
23
|
|
8
24
|
## 1.3.1
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
25
|
+
|
26
|
+
* Generates outer `div` with `jekyll_pre` class, like this:
|
27
|
+
|
28
|
+
```html
|
29
|
+
<div class="jekyll_pre">
|
30
|
+
... HTML generated by previous versions of `pre` tag here
|
31
|
+
</div>
|
32
|
+
```
|
33
|
+
|
34
|
+
* Added `wrapper_class` and `wrapper_style` name/value options.
|
35
|
+
|
16
36
|
|
17
37
|
## 1.3.0
|
18
|
-
|
38
|
+
|
39
|
+
* Updated to `jekyll_plugin_support` v0.6.0 for attribution support.
|
40
|
+
|
19
41
|
|
20
42
|
## 1.2.5
|
21
|
-
|
43
|
+
|
44
|
+
* Empty exec commands are detected and reported.
|
45
|
+
|
22
46
|
|
23
47
|
## 1.2.4
|
24
|
-
|
48
|
+
|
49
|
+
* The `exec` tag now evaluates environment variables in the command before execution.
|
50
|
+
|
25
51
|
|
26
52
|
## 1.2.3
|
27
|
-
|
53
|
+
|
54
|
+
* Added `cd` option to `exec` tag.
|
55
|
+
|
28
56
|
|
29
57
|
## 1.2.2
|
30
|
-
|
31
|
-
|
32
|
-
|
58
|
+
|
59
|
+
* Added `exec` tag.
|
60
|
+
* Demarked CSS for the `exec`, `noselect`, and `pre` tags in `demo/assets/css/style.css`
|
61
|
+
within `/* Start of pre tag css */` and `/* End of pre tag css */`.
|
62
|
+
|
33
63
|
|
34
64
|
## 1.2.1
|
35
|
-
|
65
|
+
|
66
|
+
* Updated to `jekyll_plugin_support` v0.5.1 so the `noselect` tag is more efficient.
|
67
|
+
|
36
68
|
|
37
69
|
## 1.2.0
|
38
|
-
|
70
|
+
|
71
|
+
* Updated to `jekyll_plugin_support` v0.5.0.
|
72
|
+
|
39
73
|
|
40
74
|
## 1.1.7
|
41
|
-
|
75
|
+
|
76
|
+
* Fixed `noselect` tag content handling.
|
77
|
+
|
42
78
|
|
43
79
|
## 1.1.6
|
44
|
-
|
80
|
+
|
81
|
+
* Added `jekyll_plugin_support` as a dependency.
|
82
|
+
|
45
83
|
|
46
84
|
## 1.1.5
|
47
|
-
|
48
|
-
|
85
|
+
|
86
|
+
* Added `class` and `style` options to allow for specifying additional CSS classes and inline CSS
|
87
|
+
* Added `clear` option to ensure no images overlap the pre output
|
88
|
+
|
49
89
|
|
50
90
|
## 1.1.4
|
51
|
-
|
52
|
-
|
91
|
+
|
92
|
+
* Added `highlight` regex option
|
93
|
+
* Now using `lib/jekyll_tag_helper.rb` to parse markup
|
94
|
+
|
53
95
|
|
54
96
|
## 1.1.3
|
55
|
-
|
56
|
-
|
97
|
+
|
98
|
+
* Documented the `data-lt-active="false"` attribute.
|
99
|
+
* Added the `dark` option, and [provided CSS](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#pre_css).
|
100
|
+
|
57
101
|
|
58
102
|
## 1.1.2 / 2022-04-05
|
59
|
-
|
103
|
+
|
104
|
+
* Updated to `jekyll_plugin_logger` v2.1.0
|
105
|
+
|
60
106
|
|
61
107
|
## 1.1.1 / 2022-03-31
|
62
|
-
|
108
|
+
|
109
|
+
* Added `numbered_line` CSS class for unselectable line numbers
|
110
|
+
|
63
111
|
|
64
112
|
## 1.1.0 / 2022-03-31
|
65
|
-
|
113
|
+
|
114
|
+
* Added `number` option, which generates unselectable line numbers for contents
|
115
|
+
|
66
116
|
|
67
117
|
## 1.0.0 / 2022-03-13
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
118
|
+
|
119
|
+
* Made into a Ruby gem and published on RubyGems.org as [jekyll_pre](https://rubygems.org/gems/jekyll_pre).
|
120
|
+
* `bin/attach` script added for debugging
|
121
|
+
* Rubocop standards added
|
122
|
+
* Proper versioning and CHANGELOG.md added
|
123
|
+
|
72
124
|
|
73
125
|
## 2020-12-29
|
74
|
-
|
126
|
+
|
127
|
+
* Initial version published
|
data/README.md
CHANGED
@@ -1,71 +1,131 @@
|
|
1
|
-
Jekyll_pre
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/jekyll_pre.svg)](https://badge.fury.io/rb/jekyll_pre)
|
3
|
-
===========
|
1
|
+
# Jekyll_pre [![Gem Version](https://badge.fury.io/rb/jekyll_pre.svg)](https://badge.fury.io/rb/jekyll_pre)
|
4
2
|
|
5
3
|
This Jekyll plugin provides 3 new Liquid tags that work together:
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
5
|
+
* A `pre` block tag that can be displayed various ways.
|
6
|
+
|
7
|
+
```html
|
8
|
+
{% pre [Options] [free text label] %}
|
9
|
+
Contents of pre tag
|
10
|
+
{% endpre %}
|
11
|
+
```
|
12
|
+
|
13
|
+
`Options` are:
|
14
|
+
|
15
|
+
- `class="class1 class2"` – Apply CSS classes
|
16
|
+
- `clear` – Line break after floating HTML elements
|
17
|
+
- `copyButton` – Generate a copy button
|
18
|
+
- `dark` – Dark mode
|
19
|
+
- `dedent` – Remove leading spaces common to all lines, like Ruby's <<~ squiggly heredoc (default is false)
|
20
|
+
- `label='This is a label'` – Apply text above `pre` tag.
|
21
|
+
The `label` parameter value can also be specified in free text.
|
22
|
+
For example, the following produce the same results:
|
23
|
+
|
24
|
+
- {% pre label="This is a label" %}<br>Contents of pre tag<br>{% endpre %}
|
25
|
+
|
26
|
+
- {% pre This is a label %}<br>Contents of pre tag<br>{% endpre %}
|
27
|
+
- `number` – Number the lines
|
28
|
+
- `shell` – Equivalent to `label='Shell'`
|
29
|
+
- `style` – Apply inline CSS styles
|
30
|
+
|
31
|
+
The generated <pre></pre> tag has an `data-lt-active="false"` attribute, so
|
32
|
+
[LanguageTool](https://forum.languagetool.org/t/avoid-spell-check-on-certain-html-inputs-manually/3944)
|
33
|
+
does not check the spelling or grammar of the contents.
|
34
|
+
|
35
|
+
* A `noselect` tag that can renders HTML content passed to it unselectable,
|
36
|
+
and generates a <code>$</code> prompt if no content is provided.
|
37
|
+
|
38
|
+
```html
|
39
|
+
{% pre %}
|
40
|
+
{% noselect [optional text string, defaults to $]%}Command
|
41
|
+
{% noselect unselectable output goes here %}
|
42
|
+
{% endpre %}
|
43
|
+
```
|
44
|
+
|
45
|
+
* An `exec` tag that executes shell commands and incorporates the command and its output into the content of the `pre` tag.
|
46
|
+
Environment variables are evaluated,
|
47
|
+
output data is escaped, whitespace is condensed, and wrapped in the same `unselectable` class as does `unselectable`.
|
48
|
+
|
49
|
+
```html
|
50
|
+
{% exec [Options] [shell command] %}
|
51
|
+
```
|
52
|
+
|
53
|
+
`Options` are:
|
54
|
+
|
55
|
+
- `cd="relative/or/absolute/directory"` - Change to specified directory before executing shell command.
|
56
|
+
Environment variables in the directory path will be expanded.
|
57
|
+
- `die_if_nonzero` – Set `false` to treat non-zero return codes as non-fatal.
|
58
|
+
Instead of terminating Jekyll with an error message,
|
59
|
+
the message will be displayed as an error by the Jekyll logger,
|
60
|
+
and a red message will appear in place of the result on the web page.
|
61
|
+
- `die_if_error` – Set `false` to treat exceptions generated by this plugin as non-fatal.
|
62
|
+
Instead of terminating Jekyll with an error message, the message will be displayed as an error by the Jekyll logger.
|
63
|
+
- `no_escape` – Do not HTML escape the result of running the shell command.
|
64
|
+
- `no_strip` – Do not remove leading and trailing whitespace from the result.
|
65
|
+
- `wrapper_class` class applied to outer `div`.
|
66
|
+
- `wrapper_style` style applied to outer `div`.
|
67
|
+
|
68
|
+
|
69
|
+
## Keyword Options
|
70
|
+
|
71
|
+
For all keyword options, including keyword options for the `pre` and `exec` tags:
|
72
|
+
|
73
|
+
- Option values specified in the document *may* be provided.
|
74
|
+
If a value is not provided, the value `true` is assumed.
|
75
|
+
Otherwise, if a value is provided, it *must* be wrapped in single or double quotes.
|
76
|
+
|
77
|
+
- Option values specified in `_config.yml` *must* be provided, and the value `true` cannot be implied.
|
78
|
+
Values that do not contain special characters *may* be wrapped in single or double quotes.
|
79
|
+
|
80
|
+
### Examples
|
81
|
+
|
82
|
+
#### Specifying Tag Option Values
|
83
|
+
|
84
|
+
The following sets `die_if_error` `true`:
|
85
|
+
|
86
|
+
```html
|
87
|
+
{% pre die_if_error %} ... {% endpre %}
|
88
|
+
```
|
89
|
+
|
90
|
+
The above is the same as writing:
|
91
|
+
|
92
|
+
```html
|
93
|
+
{% pre die_if_error='true' %} ... {% endpre %}
|
94
|
+
```
|
95
|
+
|
96
|
+
Or writing:
|
97
|
+
|
98
|
+
```html
|
99
|
+
{% pre die_if_error="true" %} ... {% endpre %}
|
100
|
+
```
|
101
|
+
|
102
|
+
Neglecting to provide surrounding quotes around the provided value causes the parser to not recognize the option.
|
103
|
+
Instead, what you had intended to be the keyword/value pair will be parsed as part of the command.
|
104
|
+
For the `pre` tag, this means the erroneous string becomes part of the `label` value, unless `label` is explicitly specified.
|
105
|
+
For the `exec` tag, this means the erroneous string becomes part of the command to execute.
|
106
|
+
The following demonstrates the error.
|
107
|
+
|
108
|
+
```html
|
109
|
+
{% pre die_if_error=false %} ... {% endpre %}
|
110
|
+
```
|
111
|
+
|
112
|
+
The above causes the label to be `die_if_error=false`.
|
113
|
+
|
114
|
+
```html
|
115
|
+
{% exec die_if_error=false ls %} ... {% endpre %}
|
116
|
+
```
|
117
|
+
|
118
|
+
The above causes the command to be executed to be `die_if_error=false ls` instead of `ls`.
|
61
119
|
|
62
120
|
|
63
121
|
## CSS
|
122
|
+
|
64
123
|
See [`demo/assets/css/style.css`](demo/assets/css/style.css) for the CSS declarations,
|
65
124
|
between `/* Start of pre tag css */` and `/* End of pre tag css */`.
|
66
125
|
|
67
126
|
|
68
127
|
## Configuration
|
128
|
+
|
69
129
|
Default options can be set for the `pre` tag by entries in `_config.yml`.
|
70
130
|
The following demonstrates setting a default value for every possible option:
|
71
131
|
|
@@ -94,7 +154,28 @@ pre:
|
|
94
154
|
```
|
95
155
|
|
96
156
|
|
157
|
+
### Specifying Default Option Values
|
158
|
+
|
159
|
+
Specifying a default value for `die_if_error` in `_config.yml` could be done as follows:
|
160
|
+
|
161
|
+
```yaml
|
162
|
+
pre:
|
163
|
+
die_if_error: true
|
164
|
+
```
|
165
|
+
|
166
|
+
```yaml
|
167
|
+
pre:
|
168
|
+
die_if_error: "true"
|
169
|
+
```
|
170
|
+
|
171
|
+
```yaml
|
172
|
+
pre:
|
173
|
+
die_if_error: 'true'
|
174
|
+
```
|
175
|
+
|
176
|
+
|
97
177
|
## Additional Information
|
178
|
+
|
98
179
|
More information is available on
|
99
180
|
[Mike Slinn’s website](https://www.mslinn.com/jekyll_plugins/jekyll_pre.html).
|
100
181
|
|
@@ -111,26 +192,33 @@ end
|
|
111
192
|
|
112
193
|
And then execute:
|
113
194
|
|
114
|
-
|
195
|
+
```shell
|
196
|
+
$ bundle
|
197
|
+
```
|
115
198
|
|
116
199
|
|
117
200
|
## Usage
|
201
|
+
|
118
202
|
The following examples are rendered on
|
119
203
|
[Mike Slinn’s website](https://www.mslinn.com/jekyll_plugins/jekyll_pre.html).
|
120
204
|
|
121
205
|
### Example 0
|
206
|
+
|
122
207
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id110c50d624b4">{% pre dedent %}
|
123
208
|
This line was indented 4 spaces
|
124
209
|
This line was indented 6 spaces
|
125
210
|
This line was indented 4 spaces
|
126
211
|
{% endpre %}</pre>
|
212
|
+
|
127
213
|
Which renders as:
|
128
214
|
|
129
215
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id377433c30186">This line was indented 4 spaces
|
130
216
|
This line was indented 6 spaces
|
131
217
|
This line was indented 4 spaces</pre>
|
132
218
|
|
219
|
+
|
133
220
|
### Example 1
|
221
|
+
|
134
222
|
This example does not generate a copy button and does not demonstrate `noselect`.
|
135
223
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id110c50d624b4">{% pre %}
|
136
224
|
Contents of pre tag
|
@@ -145,11 +233,12 @@ Which renders as:
|
|
145
233
|
|
146
234
|
|
147
235
|
### Example 2
|
236
|
+
|
148
237
|
This example generates a copy button and does not demonstrate `noselect`.
|
149
238
|
|
150
|
-
|
151
|
-
|
152
|
-
|
239
|
+
{% pre copyButton %}
|
240
|
+
Contents of pre tag
|
241
|
+
{% endpre %}
|
153
242
|
|
154
243
|
Generates:
|
155
244
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id08a5d26db177"><pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='id6a831a3e8992'><button class='copyBtn' data-clipboard-target='#id6a831a3e8992' title='Copy to clipboard'><img src='images/clippy.svg' alt='Copy to clipboard' style='width: 13px'></button>Contents of pre tag</pre></pre>
|
@@ -159,8 +248,10 @@ Which renders as (note the clipboard icon at the far right):
|
|
159
248
|
|
160
249
|
|
161
250
|
### Example 3
|
251
|
+
|
162
252
|
This example generates a copy button and does demonstrates the default usage of `noselect`, which renders an unselectable dollar sign followed by a space.
|
163
|
-
|
253
|
+
|
254
|
+
```html
|
164
255
|
{% pre copyButton %}
|
165
256
|
{% noselect %}Contents of pre tag
|
166
257
|
{% endpre %}
|
@@ -168,7 +259,7 @@ This example generates a copy button and does demonstrates the default usage of
|
|
168
259
|
|
169
260
|
Generates:
|
170
261
|
|
171
|
-
```
|
262
|
+
```html
|
172
263
|
<pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='id1e4a8fe53480'><button class='copyBtn' data-clipboard-target='#id1e4a8fe53480' title='Copy to clipboard'><img src='/assets/images/clippy.svg' alt='Copy to clipboard' style='width: 13px'></button><span class='unselectable'>$ </span>Contents of pre tag</pre>
|
173
264
|
```
|
174
265
|
|
@@ -178,11 +269,12 @@ Which renders as:
|
|
178
269
|
|
179
270
|
|
180
271
|
### Example 4
|
272
|
+
|
181
273
|
This example generates a copy button and does demonstrates the `noselect` being used twice:
|
182
274
|
the first time to render an unselectable custom prompt,
|
183
275
|
and the second time to render unselectable output.
|
184
276
|
|
185
|
-
```
|
277
|
+
```html
|
186
278
|
{% pre copyButton %}
|
187
279
|
{% noselect >>> %}Contents of pre tag
|
188
280
|
{% noselect How now brown cow%}
|
@@ -190,7 +282,8 @@ and the second time to render unselectable output.
|
|
190
282
|
```
|
191
283
|
|
192
284
|
Generates:
|
193
|
-
|
285
|
+
|
286
|
+
```html
|
194
287
|
<pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='idb58a6cf1761c'><button class='copyBtn' data-clipboard-target='#idb58a6cf1761c' title='Copy to clipboard'><img src='/assets/images/clippy.svg' alt='Copy to clipboard' style='width: 13px'></button><span class='unselectable'>>>> </span>contents of pre tag
|
195
288
|
<span class='unselectable'>How now brown cow</span></pre>
|
196
289
|
```
|
@@ -201,6 +294,7 @@ Which renders as:
|
|
201
294
|
|
202
295
|
|
203
296
|
### Example 5
|
297
|
+
|
204
298
|
A regular expression can be passed to the `highlight` option.
|
205
299
|
This causes text that matches the regex pattern to be wrapped within a <span class="bg_yellow"></span> tag.
|
206
300
|
|
@@ -213,9 +307,11 @@ The CSS stylesheet used for this page contains the following:
|
|
213
307
|
}
|
214
308
|
```
|
215
309
|
|
216
|
-
This example demonstrates highlighting text that matches a regular expression.
|
310
|
+
This example demonstrates highlighting text that matches a regular expression.
|
311
|
+
Regular expressions match against lines,
|
312
|
+
which are delimited via newlines (\n).
|
217
313
|
|
218
|
-
```
|
314
|
+
```html
|
219
315
|
{% pre copyButton highlight="Line 2" %}
|
220
316
|
Line 1
|
221
317
|
Line 2
|
@@ -229,11 +325,12 @@ Line 7
|
|
229
325
|
|
230
326
|
|
231
327
|
### Example 6
|
328
|
+
|
232
329
|
Regular expressions match against lines, which are delimited via newlines (`\n`).
|
233
330
|
Thus to match an entire line that contains a phrase, specify the regex as `.*phrase.*`.
|
234
331
|
The following matches 3 possible phrases (`2`, `4` or `6`), then selects the entire line if matched.
|
235
332
|
|
236
|
-
```
|
333
|
+
```html
|
237
334
|
{% pre copyButton highlight=".*(2|4|6).*" %}
|
238
335
|
Line 1
|
239
336
|
Line 2
|
@@ -247,10 +344,11 @@ Line 7
|
|
247
344
|
|
248
345
|
|
249
346
|
### Example 7
|
347
|
+
|
250
348
|
This example floats an image to the right.
|
251
349
|
The `jekyll_pre plugin`’s `clear` option moves the generated HTML below the image.
|
252
350
|
|
253
|
-
```
|
351
|
+
```html
|
254
352
|
<img src="jekyll.webp" style="float: right; width: 100px; height: auto;">
|
255
353
|
{% pre clear copyButton label='Clear example' %}
|
256
354
|
Using clear, copyButton and label parameters
|
@@ -258,38 +356,42 @@ Using clear, copyButton and label parameters
|
|
258
356
|
```
|
259
357
|
|
260
358
|
### Example 8
|
359
|
+
|
261
360
|
The following executes `ls -alF /` and displays the output.
|
262
361
|
|
263
|
-
```
|
362
|
+
```html
|
264
363
|
{% pre clear copyButton label='Exec without error' %}
|
265
|
-
{% noselect %}{% exec die_if_nonzero=false ls -alF / %}
|
364
|
+
{% noselect %}{% exec die_if_nonzero='false' ls -alF / %}
|
266
365
|
{% endpre %}
|
267
366
|
```
|
268
367
|
|
269
368
|
### Example 9
|
369
|
+
|
270
370
|
The following changes to the home directory (`$HOME`), then executes `pwd` and displays the output.
|
271
371
|
|
272
|
-
```
|
372
|
+
```html
|
273
373
|
{% pre clear copyButton label='Exec without error' %}
|
274
|
-
{% noselect %}{% exec cd="$HOME" die_if_nonzero=false pwd %}
|
374
|
+
{% noselect %}{% exec cd="$HOME" die_if_nonzero='false' pwd %}
|
275
375
|
{% endpre %}
|
276
376
|
```
|
277
377
|
|
278
378
|
### Example 10
|
379
|
+
|
279
380
|
The following executes `echo $USER` and displays the output.
|
280
381
|
|
281
|
-
```
|
382
|
+
```html
|
282
383
|
{% pre clear copyButton label='Exec display $USER' %}
|
283
|
-
{% noselect %}{% exec die_if_nonzero=false echo $USER %}
|
384
|
+
{% noselect %}{% exec die_if_nonzero='false' echo $USER %}
|
284
385
|
{% endpre %}
|
285
386
|
```
|
286
387
|
|
287
388
|
|
288
389
|
### Comprehensive Example
|
390
|
+
|
289
391
|
The code I wrote to generate the above CSS was a good example of how the plugins work together with
|
290
392
|
the `from` and `to` tags from my [`from_to_until`](https://github.com/mslinn/jekyll_from_to_until) plugin:
|
291
393
|
|
292
|
-
```
|
394
|
+
```html
|
293
395
|
{% capture css %}{% flexible_include '_sass/mystyle.scss' %}{% endcapture %}
|
294
396
|
{% pre copyButton %}{{ css | from: '.copyBtn' | to: '^$' | strip }}
|
295
397
|
|
@@ -310,20 +412,22 @@ You can also run `bin/console` for an interactive prompt that will allow you to
|
|
310
412
|
|
311
413
|
|
312
414
|
## Test
|
415
|
+
|
313
416
|
A test website is provided in the `demo` directory.
|
314
|
-
1. Set breakpoints.
|
315
417
|
|
316
|
-
|
317
|
-
|
318
|
-
$ bin/attach demo
|
319
|
-
```
|
418
|
+
1. Set breakpoints.
|
419
|
+
2. Initiate a debug session from the command line:
|
320
420
|
|
321
|
-
|
421
|
+
```shell
|
422
|
+
$ bin/attach demo
|
423
|
+
```
|
322
424
|
|
323
|
-
|
425
|
+
3. Once the `Fast Debugger` signon appears, launch the Visual Studio Code launch configuration called `Attach rdebug-ide`.
|
426
|
+
4. View the generated website at [`http://localhost:4444`](http://localhost:4444)
|
324
427
|
|
325
428
|
|
326
429
|
### Build and Install Locally
|
430
|
+
|
327
431
|
To build and install this gem onto your local machine, run:
|
328
432
|
|
329
433
|
```shell
|
@@ -331,6 +435,7 @@ $ bundle exec rake install
|
|
331
435
|
```
|
332
436
|
|
333
437
|
Examine the newly built gem:
|
438
|
+
|
334
439
|
```shell
|
335
440
|
$ gem info jekyll_pre
|
336
441
|
|
@@ -348,18 +453,23 @@ jekyll_pre (1.0.0)
|
|
348
453
|
|
349
454
|
|
350
455
|
### Build and Push to RubyGems
|
456
|
+
|
351
457
|
To release a new version,
|
458
|
+
|
352
459
|
1. Update the version number in `version.rb`.
|
353
460
|
2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
|
354
461
|
3. Run the following:
|
462
|
+
|
355
463
|
```shell
|
356
464
|
$ bundle exec rake release
|
357
465
|
```
|
466
|
+
|
358
467
|
The above creates a git tag for the version, commits the created tag,
|
359
468
|
and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
|
360
469
|
|
361
470
|
|
362
471
|
## Contributing
|
472
|
+
|
363
473
|
1. Fork the project
|
364
474
|
2. Create a descriptively named feature branch
|
365
475
|
3. Add your feature
|
data/jekyll_pre.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
END_OF_DESC
|
12
12
|
spec.email = ['mslinn@mslinn.com']
|
13
13
|
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
14
|
-
spec.homepage = 'https://www.mslinn.com/
|
14
|
+
spec.homepage = 'https://www.mslinn.com/jekyll_plugins/jekyll_pre.html'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
spec.metadata = {
|
17
17
|
'allowed_push_host' => 'https://rubygems.org',
|
@@ -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', '
|
36
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 0.7.0'
|
37
37
|
spec.add_dependency 'rack'
|
38
38
|
end
|
data/lib/exec_tag.rb
CHANGED
data/lib/jekyll_pre/version.rb
CHANGED
data/lib/pre_tag_block.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -10,9 +10,8 @@ require_relative '../lib/jekyll_pre'
|
|
10
10
|
Jekyll.logger.log_level = :info
|
11
11
|
|
12
12
|
RSpec.configure do |config|
|
13
|
-
config.
|
13
|
+
config.filter_run_when_matching focus: true
|
14
14
|
# config.order = 'random'
|
15
|
-
config.run_all_when_everything_filtered = true
|
16
15
|
|
17
16
|
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
18
17
|
config.example_status_persistence_file_path = 'spec/status_persistence.txt'
|
data/spec/status_persistence.txt
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/exec_spec.rb[1:1]
|
4
|
-
./spec/pre_spec.rb[1:1]
|
5
|
-
./spec/pre_spec.rb[1:2]
|
6
|
-
./spec/pre_spec.rb[1:3]
|
7
|
-
./spec/pre_spec.rb[1:4]
|
8
|
-
|
9
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_pre/spec/pre_spec.rb[1:1] | passed | 0.00326 seconds |
|
10
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_pre/spec/pre_spec.rb[1:2] | passed | 0.00067 seconds |
|
11
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_pre/spec/pre_spec.rb[1:3] | passed | 0.00362 seconds |
|
12
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_pre/spec/pre_spec.rb[1:4] | passed | 0.00033 seconds |
|
13
|
-
/mnt/_/work/jekyll/my_plugins/jekyll_pre/spec/pre_spec.rb[1:5] | passed | 0.00083 seconds |
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------ | ------ | --------------- |
|
3
|
+
./spec/exec_spec.rb[1:1] | passed | 0.00133 seconds |
|
4
|
+
./spec/pre_spec.rb[1:1] | passed | 0.00007 seconds |
|
5
|
+
./spec/pre_spec.rb[1:2] | passed | 0.00003 seconds |
|
6
|
+
./spec/pre_spec.rb[1:3] | passed | 0.00133 seconds |
|
7
|
+
./spec/pre_spec.rb[1:4] | passed | 0.00005 seconds |
|
8
|
+
./spec/pre_spec.rb[1:5] | passed | 0.00004 seconds |
|
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.2
|
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-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: jekyll_plugin_support
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.7.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.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,14 +77,14 @@ files:
|
|
77
77
|
- spec/pre_spec.rb
|
78
78
|
- spec/spec_helper.rb
|
79
79
|
- spec/status_persistence.txt
|
80
|
-
homepage: https://www.mslinn.com/
|
80
|
+
homepage: https://www.mslinn.com/jekyll_plugins/jekyll_pre.html
|
81
81
|
licenses:
|
82
82
|
- MIT
|
83
83
|
metadata:
|
84
84
|
allowed_push_host: https://rubygems.org
|
85
85
|
bug_tracker_uri: https://github.com/mslinn/jekyll_pre/issues
|
86
86
|
changelog_uri: https://github.com/mslinn/jekyll_pre/CHANGELOG.md
|
87
|
-
homepage_uri: https://www.mslinn.com/
|
87
|
+
homepage_uri: https://www.mslinn.com/jekyll_plugins/jekyll_pre.html
|
88
88
|
source_code_uri: https://github.com/mslinn/jekyll_pre
|
89
89
|
post_install_message: |2+
|
90
90
|
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
|
-
rubygems_version: 3.3.
|
107
|
+
rubygems_version: 3.3.7
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|