jekyll_pre 1.4.1 → 1.4.2
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 +4 -4
- data/.rubocop.yml +4 -2
- data/CHANGELOG.md +86 -36
- data/README.md +135 -86
- 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 +3 -3
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,77 +1,127 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## 1.4.2
|
|
4
|
+
|
|
5
|
+
* Added missing `require` in `pre_tag_block.rb`.
|
|
6
|
+
|
|
7
|
+
|
|
1
8
|
## 1.4.1
|
|
2
|
-
|
|
9
|
+
|
|
10
|
+
* Fixed problem that caused exec tag to no produce output.
|
|
11
|
+
|
|
3
12
|
|
|
4
13
|
## 1.4.0
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
|
|
7
18
|
|
|
8
19
|
## 1.3.2
|
|
9
|
-
|
|
20
|
+
|
|
21
|
+
* No longer strips leading spaces from exec result lines.
|
|
22
|
+
|
|
10
23
|
|
|
11
24
|
## 1.3.1
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
|
|
19
36
|
|
|
20
37
|
## 1.3.0
|
|
21
|
-
|
|
38
|
+
|
|
39
|
+
* Updated to `jekyll_plugin_support` v0.6.0 for attribution support.
|
|
40
|
+
|
|
22
41
|
|
|
23
42
|
## 1.2.5
|
|
24
|
-
|
|
43
|
+
|
|
44
|
+
* Empty exec commands are detected and reported.
|
|
45
|
+
|
|
25
46
|
|
|
26
47
|
## 1.2.4
|
|
27
|
-
|
|
48
|
+
|
|
49
|
+
* The `exec` tag now evaluates environment variables in the command before execution.
|
|
50
|
+
|
|
28
51
|
|
|
29
52
|
## 1.2.3
|
|
30
|
-
|
|
53
|
+
|
|
54
|
+
* Added `cd` option to `exec` tag.
|
|
55
|
+
|
|
31
56
|
|
|
32
57
|
## 1.2.2
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
|
|
36
63
|
|
|
37
64
|
## 1.2.1
|
|
38
|
-
|
|
65
|
+
|
|
66
|
+
* Updated to `jekyll_plugin_support` v0.5.1 so the `noselect` tag is more efficient.
|
|
67
|
+
|
|
39
68
|
|
|
40
69
|
## 1.2.0
|
|
41
|
-
|
|
70
|
+
|
|
71
|
+
* Updated to `jekyll_plugin_support` v0.5.0.
|
|
72
|
+
|
|
42
73
|
|
|
43
74
|
## 1.1.7
|
|
44
|
-
|
|
75
|
+
|
|
76
|
+
* Fixed `noselect` tag content handling.
|
|
77
|
+
|
|
45
78
|
|
|
46
79
|
## 1.1.6
|
|
47
|
-
|
|
80
|
+
|
|
81
|
+
* Added `jekyll_plugin_support` as a dependency.
|
|
82
|
+
|
|
48
83
|
|
|
49
84
|
## 1.1.5
|
|
50
|
-
|
|
51
|
-
|
|
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
|
+
|
|
52
89
|
|
|
53
90
|
## 1.1.4
|
|
54
|
-
|
|
55
|
-
|
|
91
|
+
|
|
92
|
+
* Added `highlight` regex option
|
|
93
|
+
* Now using `lib/jekyll_tag_helper.rb` to parse markup
|
|
94
|
+
|
|
56
95
|
|
|
57
96
|
## 1.1.3
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
|
|
60
101
|
|
|
61
102
|
## 1.1.2 / 2022-04-05
|
|
62
|
-
|
|
103
|
+
|
|
104
|
+
* Updated to `jekyll_plugin_logger` v2.1.0
|
|
105
|
+
|
|
63
106
|
|
|
64
107
|
## 1.1.1 / 2022-03-31
|
|
65
|
-
|
|
108
|
+
|
|
109
|
+
* Added `numbered_line` CSS class for unselectable line numbers
|
|
110
|
+
|
|
66
111
|
|
|
67
112
|
## 1.1.0 / 2022-03-31
|
|
68
|
-
|
|
113
|
+
|
|
114
|
+
* Added `number` option, which generates unselectable line numbers for contents
|
|
115
|
+
|
|
69
116
|
|
|
70
117
|
## 1.0.0 / 2022-03-13
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
|
|
75
124
|
|
|
76
125
|
## 2020-12-29
|
|
77
|
-
|
|
126
|
+
|
|
127
|
+
* Initial version published
|
data/README.md
CHANGED
|
@@ -1,65 +1,73 @@
|
|
|
1
|
-
Jekyll_pre
|
|
2
|
-
[](https://badge.fury.io/rb/jekyll_pre)
|
|
3
|
-
===========
|
|
1
|
+
# Jekyll_pre [](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
|
+
|
|
61
68
|
|
|
62
69
|
## Keyword Options
|
|
70
|
+
|
|
63
71
|
For all keyword options, including keyword options for the `pre` and `exec` tags:
|
|
64
72
|
|
|
65
73
|
- Option values specified in the document *may* be provided.
|
|
@@ -70,19 +78,24 @@ For all keyword options, including keyword options for the `pre` and `exec` tags
|
|
|
70
78
|
Values that do not contain special characters *may* be wrapped in single or double quotes.
|
|
71
79
|
|
|
72
80
|
### Examples
|
|
81
|
+
|
|
73
82
|
#### Specifying Tag Option Values
|
|
83
|
+
|
|
74
84
|
The following sets `die_if_error` `true`:
|
|
75
|
-
|
|
85
|
+
|
|
86
|
+
```html
|
|
76
87
|
{% pre die_if_error %} ... {% endpre %}
|
|
77
88
|
```
|
|
78
89
|
|
|
79
90
|
The above is the same as writing:
|
|
80
|
-
|
|
91
|
+
|
|
92
|
+
```html
|
|
81
93
|
{% pre die_if_error='true' %} ... {% endpre %}
|
|
82
94
|
```
|
|
83
95
|
|
|
84
96
|
Or writing:
|
|
85
|
-
|
|
97
|
+
|
|
98
|
+
```html
|
|
86
99
|
{% pre die_if_error="true" %} ... {% endpre %}
|
|
87
100
|
```
|
|
88
101
|
|
|
@@ -92,23 +105,27 @@ For the `pre` tag, this means the erroneous string becomes part of the `label` v
|
|
|
92
105
|
For the `exec` tag, this means the erroneous string becomes part of the command to execute.
|
|
93
106
|
The following demonstrates the error.
|
|
94
107
|
|
|
95
|
-
```
|
|
108
|
+
```html
|
|
96
109
|
{% pre die_if_error=false %} ... {% endpre %}
|
|
97
110
|
```
|
|
111
|
+
|
|
98
112
|
The above causes the label to be `die_if_error=false`.
|
|
99
113
|
|
|
100
|
-
```
|
|
114
|
+
```html
|
|
101
115
|
{% exec die_if_error=false ls %} ... {% endpre %}
|
|
102
116
|
```
|
|
117
|
+
|
|
103
118
|
The above causes the command to be executed to be `die_if_error=false ls` instead of `ls`.
|
|
104
119
|
|
|
105
120
|
|
|
106
121
|
## CSS
|
|
122
|
+
|
|
107
123
|
See [`demo/assets/css/style.css`](demo/assets/css/style.css) for the CSS declarations,
|
|
108
124
|
between `/* Start of pre tag css */` and `/* End of pre tag css */`.
|
|
109
125
|
|
|
110
126
|
|
|
111
127
|
## Configuration
|
|
128
|
+
|
|
112
129
|
Default options can be set for the `pre` tag by entries in `_config.yml`.
|
|
113
130
|
The following demonstrates setting a default value for every possible option:
|
|
114
131
|
|
|
@@ -137,8 +154,10 @@ pre:
|
|
|
137
154
|
```
|
|
138
155
|
|
|
139
156
|
|
|
140
|
-
|
|
157
|
+
### Specifying Default Option Values
|
|
158
|
+
|
|
141
159
|
Specifying a default value for `die_if_error` in `_config.yml` could be done as follows:
|
|
160
|
+
|
|
142
161
|
```yaml
|
|
143
162
|
pre:
|
|
144
163
|
die_if_error: true
|
|
@@ -156,6 +175,7 @@ pre:
|
|
|
156
175
|
|
|
157
176
|
|
|
158
177
|
## Additional Information
|
|
178
|
+
|
|
159
179
|
More information is available on
|
|
160
180
|
[Mike Slinn’s website](https://www.mslinn.com/jekyll_plugins/jekyll_pre.html).
|
|
161
181
|
|
|
@@ -172,26 +192,33 @@ end
|
|
|
172
192
|
|
|
173
193
|
And then execute:
|
|
174
194
|
|
|
175
|
-
|
|
195
|
+
```shell
|
|
196
|
+
$ bundle
|
|
197
|
+
```
|
|
176
198
|
|
|
177
199
|
|
|
178
200
|
## Usage
|
|
201
|
+
|
|
179
202
|
The following examples are rendered on
|
|
180
203
|
[Mike Slinn’s website](https://www.mslinn.com/jekyll_plugins/jekyll_pre.html).
|
|
181
204
|
|
|
182
205
|
### Example 0
|
|
206
|
+
|
|
183
207
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id110c50d624b4">{% pre dedent %}
|
|
184
208
|
This line was indented 4 spaces
|
|
185
209
|
This line was indented 6 spaces
|
|
186
210
|
This line was indented 4 spaces
|
|
187
211
|
{% endpre %}</pre>
|
|
212
|
+
|
|
188
213
|
Which renders as:
|
|
189
214
|
|
|
190
215
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id377433c30186">This line was indented 4 spaces
|
|
191
216
|
This line was indented 6 spaces
|
|
192
217
|
This line was indented 4 spaces</pre>
|
|
193
218
|
|
|
219
|
+
|
|
194
220
|
### Example 1
|
|
221
|
+
|
|
195
222
|
This example does not generate a copy button and does not demonstrate `noselect`.
|
|
196
223
|
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id110c50d624b4">{% pre %}
|
|
197
224
|
Contents of pre tag
|
|
@@ -206,11 +233,12 @@ Which renders as:
|
|
|
206
233
|
|
|
207
234
|
|
|
208
235
|
### Example 2
|
|
236
|
+
|
|
209
237
|
This example generates a copy button and does not demonstrate `noselect`.
|
|
210
238
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
239
|
+
{% pre copyButton %}
|
|
240
|
+
Contents of pre tag
|
|
241
|
+
{% endpre %}
|
|
214
242
|
|
|
215
243
|
Generates:
|
|
216
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>
|
|
@@ -220,8 +248,10 @@ Which renders as (note the clipboard icon at the far right):
|
|
|
220
248
|
|
|
221
249
|
|
|
222
250
|
### Example 3
|
|
251
|
+
|
|
223
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.
|
|
224
|
-
|
|
253
|
+
|
|
254
|
+
```html
|
|
225
255
|
{% pre copyButton %}
|
|
226
256
|
{% noselect %}Contents of pre tag
|
|
227
257
|
{% endpre %}
|
|
@@ -229,7 +259,7 @@ This example generates a copy button and does demonstrates the default usage of
|
|
|
229
259
|
|
|
230
260
|
Generates:
|
|
231
261
|
|
|
232
|
-
```
|
|
262
|
+
```html
|
|
233
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>
|
|
234
264
|
```
|
|
235
265
|
|
|
@@ -239,11 +269,12 @@ Which renders as:
|
|
|
239
269
|
|
|
240
270
|
|
|
241
271
|
### Example 4
|
|
272
|
+
|
|
242
273
|
This example generates a copy button and does demonstrates the `noselect` being used twice:
|
|
243
274
|
the first time to render an unselectable custom prompt,
|
|
244
275
|
and the second time to render unselectable output.
|
|
245
276
|
|
|
246
|
-
```
|
|
277
|
+
```html
|
|
247
278
|
{% pre copyButton %}
|
|
248
279
|
{% noselect >>> %}Contents of pre tag
|
|
249
280
|
{% noselect How now brown cow%}
|
|
@@ -251,7 +282,8 @@ and the second time to render unselectable output.
|
|
|
251
282
|
```
|
|
252
283
|
|
|
253
284
|
Generates:
|
|
254
|
-
|
|
285
|
+
|
|
286
|
+
```html
|
|
255
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
|
|
256
288
|
<span class='unselectable'>How now brown cow</span></pre>
|
|
257
289
|
```
|
|
@@ -262,6 +294,7 @@ Which renders as:
|
|
|
262
294
|
|
|
263
295
|
|
|
264
296
|
### Example 5
|
|
297
|
+
|
|
265
298
|
A regular expression can be passed to the `highlight` option.
|
|
266
299
|
This causes text that matches the regex pattern to be wrapped within a <span class="bg_yellow"></span> tag.
|
|
267
300
|
|
|
@@ -274,9 +307,11 @@ The CSS stylesheet used for this page contains the following:
|
|
|
274
307
|
}
|
|
275
308
|
```
|
|
276
309
|
|
|
277
|
-
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).
|
|
278
313
|
|
|
279
|
-
```
|
|
314
|
+
```html
|
|
280
315
|
{% pre copyButton highlight="Line 2" %}
|
|
281
316
|
Line 1
|
|
282
317
|
Line 2
|
|
@@ -290,11 +325,12 @@ Line 7
|
|
|
290
325
|
|
|
291
326
|
|
|
292
327
|
### Example 6
|
|
328
|
+
|
|
293
329
|
Regular expressions match against lines, which are delimited via newlines (`\n`).
|
|
294
330
|
Thus to match an entire line that contains a phrase, specify the regex as `.*phrase.*`.
|
|
295
331
|
The following matches 3 possible phrases (`2`, `4` or `6`), then selects the entire line if matched.
|
|
296
332
|
|
|
297
|
-
```
|
|
333
|
+
```html
|
|
298
334
|
{% pre copyButton highlight=".*(2|4|6).*" %}
|
|
299
335
|
Line 1
|
|
300
336
|
Line 2
|
|
@@ -308,10 +344,11 @@ Line 7
|
|
|
308
344
|
|
|
309
345
|
|
|
310
346
|
### Example 7
|
|
347
|
+
|
|
311
348
|
This example floats an image to the right.
|
|
312
349
|
The `jekyll_pre plugin`’s `clear` option moves the generated HTML below the image.
|
|
313
350
|
|
|
314
|
-
```
|
|
351
|
+
```html
|
|
315
352
|
<img src="jekyll.webp" style="float: right; width: 100px; height: auto;">
|
|
316
353
|
{% pre clear copyButton label='Clear example' %}
|
|
317
354
|
Using clear, copyButton and label parameters
|
|
@@ -319,27 +356,30 @@ Using clear, copyButton and label parameters
|
|
|
319
356
|
```
|
|
320
357
|
|
|
321
358
|
### Example 8
|
|
359
|
+
|
|
322
360
|
The following executes `ls -alF /` and displays the output.
|
|
323
361
|
|
|
324
|
-
```
|
|
362
|
+
```html
|
|
325
363
|
{% pre clear copyButton label='Exec without error' %}
|
|
326
364
|
{% noselect %}{% exec die_if_nonzero='false' ls -alF / %}
|
|
327
365
|
{% endpre %}
|
|
328
366
|
```
|
|
329
367
|
|
|
330
368
|
### Example 9
|
|
369
|
+
|
|
331
370
|
The following changes to the home directory (`$HOME`), then executes `pwd` and displays the output.
|
|
332
371
|
|
|
333
|
-
```
|
|
372
|
+
```html
|
|
334
373
|
{% pre clear copyButton label='Exec without error' %}
|
|
335
374
|
{% noselect %}{% exec cd="$HOME" die_if_nonzero='false' pwd %}
|
|
336
375
|
{% endpre %}
|
|
337
376
|
```
|
|
338
377
|
|
|
339
378
|
### Example 10
|
|
379
|
+
|
|
340
380
|
The following executes `echo $USER` and displays the output.
|
|
341
381
|
|
|
342
|
-
```
|
|
382
|
+
```html
|
|
343
383
|
{% pre clear copyButton label='Exec display $USER' %}
|
|
344
384
|
{% noselect %}{% exec die_if_nonzero='false' echo $USER %}
|
|
345
385
|
{% endpre %}
|
|
@@ -347,10 +387,11 @@ The following executes `echo $USER` and displays the output.
|
|
|
347
387
|
|
|
348
388
|
|
|
349
389
|
### Comprehensive Example
|
|
390
|
+
|
|
350
391
|
The code I wrote to generate the above CSS was a good example of how the plugins work together with
|
|
351
392
|
the `from` and `to` tags from my [`from_to_until`](https://github.com/mslinn/jekyll_from_to_until) plugin:
|
|
352
393
|
|
|
353
|
-
```
|
|
394
|
+
```html
|
|
354
395
|
{% capture css %}{% flexible_include '_sass/mystyle.scss' %}{% endcapture %}
|
|
355
396
|
{% pre copyButton %}{{ css | from: '.copyBtn' | to: '^$' | strip }}
|
|
356
397
|
|
|
@@ -371,20 +412,22 @@ You can also run `bin/console` for an interactive prompt that will allow you to
|
|
|
371
412
|
|
|
372
413
|
|
|
373
414
|
## Test
|
|
415
|
+
|
|
374
416
|
A test website is provided in the `demo` directory.
|
|
375
|
-
1. Set breakpoints.
|
|
376
417
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
$ bin/attach demo
|
|
380
|
-
```
|
|
418
|
+
1. Set breakpoints.
|
|
419
|
+
2. Initiate a debug session from the command line:
|
|
381
420
|
|
|
382
|
-
|
|
421
|
+
```shell
|
|
422
|
+
$ bin/attach demo
|
|
423
|
+
```
|
|
383
424
|
|
|
384
|
-
|
|
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)
|
|
385
427
|
|
|
386
428
|
|
|
387
429
|
### Build and Install Locally
|
|
430
|
+
|
|
388
431
|
To build and install this gem onto your local machine, run:
|
|
389
432
|
|
|
390
433
|
```shell
|
|
@@ -392,6 +435,7 @@ $ bundle exec rake install
|
|
|
392
435
|
```
|
|
393
436
|
|
|
394
437
|
Examine the newly built gem:
|
|
438
|
+
|
|
395
439
|
```shell
|
|
396
440
|
$ gem info jekyll_pre
|
|
397
441
|
|
|
@@ -409,18 +453,23 @@ jekyll_pre (1.0.0)
|
|
|
409
453
|
|
|
410
454
|
|
|
411
455
|
### Build and Push to RubyGems
|
|
456
|
+
|
|
412
457
|
To release a new version,
|
|
458
|
+
|
|
413
459
|
1. Update the version number in `version.rb`.
|
|
414
460
|
2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
|
|
415
461
|
3. Run the following:
|
|
462
|
+
|
|
416
463
|
```shell
|
|
417
464
|
$ bundle exec rake release
|
|
418
465
|
```
|
|
466
|
+
|
|
419
467
|
The above creates a git tag for the version, commits the created tag,
|
|
420
468
|
and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
|
|
421
469
|
|
|
422
470
|
|
|
423
471
|
## Contributing
|
|
472
|
+
|
|
424
473
|
1. Fork the project
|
|
425
474
|
2. Create a descriptively named feature branch
|
|
426
475
|
3. Add your feature
|
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
|
|
@@ -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
|