jekyll_pre 1.0.0
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 +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +31 -0
- data/.ruby-version +1 -0
- data/.vscode/launch.json +47 -0
- data/.vscode/settings.json +3 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +134 -0
- data/LICENSE.txt +21 -0
- data/README.md +145 -0
- data/Rakefile +4 -0
- data/images/clippy.svg +3 -0
- data/images/clippy.svg:Zone.Identifier +0 -0
- data/jekyll_pre.gemspec +46 -0
- data/lib/jekyll_pre/version.rb +5 -0
- data/lib/jekyll_pre.rb +91 -0
- data/sig/jekyll_pre.rbs +4 -0
- metadata +220 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ffe453b56e03d1e78bce68257b601f3361c5e9f39e81842bd2bc3b40f64aaddf
|
|
4
|
+
data.tar.gz: be4f574ee5a94854d6c28ea225d0a08f44319639b48d569e48d65e627c966c45
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ea9a405d3fac946a19a6c306e188c1bec3b670398f6099d5de0ec35d40b7258ad559e300571c3291b965f17d647fb6eec045715acb3d23bd5e3bbfa6f35711c0
|
|
7
|
+
data.tar.gz: c77014a0cb77dcff1fcd63018d043b1b2dc4497028a03d8112b49d712bb1bd1c91cb542f297924bc05adf1cc23c0a9669ff41c99cbbbbef0cbf934cc10c63e0c
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require: rubocop-jekyll
|
|
2
|
+
inherit_gem:
|
|
3
|
+
rubocop-jekyll: .rubocop.yml
|
|
4
|
+
|
|
5
|
+
AllCops:
|
|
6
|
+
Exclude:
|
|
7
|
+
- vendor/**/*
|
|
8
|
+
- Gemfile*
|
|
9
|
+
NewCops: enable
|
|
10
|
+
TargetRubyVersion: 2.6
|
|
11
|
+
|
|
12
|
+
Layout/LineLength:
|
|
13
|
+
Max: 150
|
|
14
|
+
|
|
15
|
+
Layout/MultilineMethodCallIndentation:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Metrics/BlockLength:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Style/PercentLiteralDelimiters:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Style/RegexpLiteral:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Style/StringLiterals:
|
|
28
|
+
Enabled: false
|
|
29
|
+
|
|
30
|
+
Style/StringLiteralsInInterpolation:
|
|
31
|
+
Enabled: false
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.0.0
|
data/.vscode/launch.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"cwd": "${workspaceRoot}",
|
|
9
|
+
"name": "Attach rdebug-ide",
|
|
10
|
+
"request": "attach",
|
|
11
|
+
"remoteHost": "localhost",
|
|
12
|
+
"remotePort": "1234",
|
|
13
|
+
"remoteWorkspaceRoot": "/",
|
|
14
|
+
"restart": true,
|
|
15
|
+
"showDebuggerOutput": true,
|
|
16
|
+
"stopOnEntry": true,
|
|
17
|
+
"type": "Ruby",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"args": [
|
|
21
|
+
"-I",
|
|
22
|
+
"${workspaceRoot}",
|
|
23
|
+
"${file}"
|
|
24
|
+
],
|
|
25
|
+
"cwd": "${workspaceRoot}",
|
|
26
|
+
"name": "RSpec - active spec file only",
|
|
27
|
+
"program": "${env:HOME}/.rbenv/shims/rspec",
|
|
28
|
+
"showDebuggerOutput": false,
|
|
29
|
+
"request": "launch",
|
|
30
|
+
"type": "Ruby",
|
|
31
|
+
"useBundler": true,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"args": [
|
|
35
|
+
"-I",
|
|
36
|
+
"${workspaceRoot}"
|
|
37
|
+
],
|
|
38
|
+
"cwd": "${workspaceRoot}",
|
|
39
|
+
"name": "RSpec - all",
|
|
40
|
+
"program": "${env:HOME}/.rbenv/shims/rspec",
|
|
41
|
+
"request": "launch",
|
|
42
|
+
"showDebuggerOutput": false,
|
|
43
|
+
"type": "Ruby",
|
|
44
|
+
"useBundler": true,
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## 1.0.0 / 2022-03-13
|
|
2
|
+
* Made into a Ruby gem and published on RubyGems.org as [jekyll_pre](https://rubygems.org/gems/jekyll_pre).
|
|
3
|
+
* `bin/attach` script added for debugging
|
|
4
|
+
* Rubocop standards added
|
|
5
|
+
* Proper versioning and CHANGELOG.md added
|
|
6
|
+
|
|
7
|
+
## 2020-12-29
|
|
8
|
+
* Initial version published
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
jekyll_pre (1.0.0)
|
|
5
|
+
jekyll
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.8.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
12
|
+
ast (2.4.2)
|
|
13
|
+
coderay (1.1.3)
|
|
14
|
+
colorator (1.1.0)
|
|
15
|
+
concurrent-ruby (1.1.9)
|
|
16
|
+
debase (0.2.4.1)
|
|
17
|
+
debase-ruby_core_source (>= 0.10.2)
|
|
18
|
+
debase-ruby_core_source (0.10.14)
|
|
19
|
+
diff-lcs (1.5.0)
|
|
20
|
+
em-websocket (0.5.3)
|
|
21
|
+
eventmachine (>= 0.12.9)
|
|
22
|
+
http_parser.rb (~> 0)
|
|
23
|
+
eventmachine (1.2.7)
|
|
24
|
+
ffi (1.15.5)
|
|
25
|
+
forwardable-extended (2.6.0)
|
|
26
|
+
http_parser.rb (0.8.0)
|
|
27
|
+
i18n (1.10.0)
|
|
28
|
+
concurrent-ruby (~> 1.0)
|
|
29
|
+
jekyll (4.2.2)
|
|
30
|
+
addressable (~> 2.4)
|
|
31
|
+
colorator (~> 1.0)
|
|
32
|
+
em-websocket (~> 0.5)
|
|
33
|
+
i18n (~> 1.0)
|
|
34
|
+
jekyll-sass-converter (~> 2.0)
|
|
35
|
+
jekyll-watch (~> 2.0)
|
|
36
|
+
kramdown (~> 2.3)
|
|
37
|
+
kramdown-parser-gfm (~> 1.0)
|
|
38
|
+
liquid (~> 4.0)
|
|
39
|
+
mercenary (~> 0.4.0)
|
|
40
|
+
pathutil (~> 0.9)
|
|
41
|
+
rouge (~> 3.0)
|
|
42
|
+
safe_yaml (~> 1.0)
|
|
43
|
+
terminal-table (~> 2.0)
|
|
44
|
+
jekyll-sass-converter (2.2.0)
|
|
45
|
+
sassc (> 2.0.1, < 3.0)
|
|
46
|
+
jekyll-watch (2.2.1)
|
|
47
|
+
listen (~> 3.0)
|
|
48
|
+
kramdown (2.3.1)
|
|
49
|
+
rexml
|
|
50
|
+
kramdown-parser-gfm (1.1.0)
|
|
51
|
+
kramdown (~> 2.0)
|
|
52
|
+
liquid (4.0.3)
|
|
53
|
+
listen (3.7.1)
|
|
54
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
55
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
56
|
+
mercenary (0.4.0)
|
|
57
|
+
method_source (1.0.0)
|
|
58
|
+
parallel (1.21.0)
|
|
59
|
+
parser (3.1.1.0)
|
|
60
|
+
ast (~> 2.4.1)
|
|
61
|
+
pathutil (0.16.2)
|
|
62
|
+
forwardable-extended (~> 2.6)
|
|
63
|
+
pry (0.14.1)
|
|
64
|
+
coderay (~> 1.1)
|
|
65
|
+
method_source (~> 1.0)
|
|
66
|
+
public_suffix (4.0.6)
|
|
67
|
+
rainbow (3.1.1)
|
|
68
|
+
rake (13.0.6)
|
|
69
|
+
rb-fsevent (0.11.1)
|
|
70
|
+
rb-inotify (0.10.1)
|
|
71
|
+
ffi (~> 1.0)
|
|
72
|
+
regexp_parser (2.2.1)
|
|
73
|
+
rexml (3.2.5)
|
|
74
|
+
rouge (3.28.0)
|
|
75
|
+
rspec (3.11.0)
|
|
76
|
+
rspec-core (~> 3.11.0)
|
|
77
|
+
rspec-expectations (~> 3.11.0)
|
|
78
|
+
rspec-mocks (~> 3.11.0)
|
|
79
|
+
rspec-core (3.11.0)
|
|
80
|
+
rspec-support (~> 3.11.0)
|
|
81
|
+
rspec-expectations (3.11.0)
|
|
82
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
83
|
+
rspec-support (~> 3.11.0)
|
|
84
|
+
rspec-mocks (3.11.0)
|
|
85
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
86
|
+
rspec-support (~> 3.11.0)
|
|
87
|
+
rspec-support (3.11.0)
|
|
88
|
+
rubocop (1.18.4)
|
|
89
|
+
parallel (~> 1.10)
|
|
90
|
+
parser (>= 3.0.0.0)
|
|
91
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
92
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
93
|
+
rexml
|
|
94
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
|
95
|
+
ruby-progressbar (~> 1.7)
|
|
96
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
97
|
+
rubocop-ast (1.16.0)
|
|
98
|
+
parser (>= 3.1.1.0)
|
|
99
|
+
rubocop-jekyll (0.12.0)
|
|
100
|
+
rubocop (~> 1.18.0)
|
|
101
|
+
rubocop-performance (~> 1.2)
|
|
102
|
+
rubocop-performance (1.13.3)
|
|
103
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
104
|
+
rubocop-ast (>= 0.4.0)
|
|
105
|
+
rubocop-rake (0.6.0)
|
|
106
|
+
rubocop (~> 1.0)
|
|
107
|
+
ruby-debug-ide (0.7.3)
|
|
108
|
+
rake (>= 0.8.1)
|
|
109
|
+
ruby-progressbar (1.11.0)
|
|
110
|
+
safe_yaml (1.0.5)
|
|
111
|
+
sassc (2.4.0)
|
|
112
|
+
ffi (~> 1.9)
|
|
113
|
+
terminal-table (2.0.0)
|
|
114
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
115
|
+
unicode-display_width (1.8.0)
|
|
116
|
+
|
|
117
|
+
PLATFORMS
|
|
118
|
+
x86_64-linux
|
|
119
|
+
|
|
120
|
+
DEPENDENCIES
|
|
121
|
+
bundler
|
|
122
|
+
debase
|
|
123
|
+
jekyll
|
|
124
|
+
jekyll_pre!
|
|
125
|
+
pry
|
|
126
|
+
rake (~> 13.0)
|
|
127
|
+
rspec
|
|
128
|
+
rubocop
|
|
129
|
+
rubocop-jekyll
|
|
130
|
+
rubocop-rake
|
|
131
|
+
ruby-debug-ide
|
|
132
|
+
|
|
133
|
+
BUNDLED WITH
|
|
134
|
+
2.3.8
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Mike Slinn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Jekyll_pre
|
|
2
|
+
[](https://badge.fury.io/rb/jekyll_pre)
|
|
3
|
+
===========
|
|
4
|
+
|
|
5
|
+
This is a Jekyll plugin that provides two Liquid tags: `pre` and `noselect` that frequently work together:
|
|
6
|
+
|
|
7
|
+
* A `pre` block tag that can optionally display a copy button.
|
|
8
|
+
* A `noselect` tag that can renders HTML content passed to it unselectable.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile, within the `jekyll_plugins` group:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
group :jekyll_plugins do
|
|
17
|
+
gem 'jekyll_pre'
|
|
18
|
+
end
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
$ bundle install
|
|
24
|
+
|
|
25
|
+
Or install it yourself as:
|
|
26
|
+
|
|
27
|
+
$ gem install jekyll_pre
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Unfortunately markdown does not support CSS styles, so the HTML rendering of the examples is compromised.
|
|
33
|
+
|
|
34
|
+
### Syntax
|
|
35
|
+
|
|
36
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id7478d3e758a5"><button class="copyBtn" data-clipboard-target="#id7478d3e758a5" title="Copy to clipboard"><img src="images/clippy.svg" alt="Copy to clipboard" style="width: 13px"></button>{% pre [copyButton] [shell] [headline words] %}
|
|
37
|
+
Contents of pre tag
|
|
38
|
+
{% endpre %}</pre>
|
|
39
|
+
|
|
40
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="idbb1564f70e84">{% pre [copyButton] %}
|
|
41
|
+
{% noselect [text string]%}Contents of pre tag
|
|
42
|
+
{% endpre %}</pre>
|
|
43
|
+
|
|
44
|
+
### Usage Example 1
|
|
45
|
+
This example does not generate a copy button and does not demonstrate `noselect`.
|
|
46
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id110c50d624b4">{% pre %}
|
|
47
|
+
Contents of pre tag
|
|
48
|
+
{% endpre %}</pre>
|
|
49
|
+
|
|
50
|
+
Generates:
|
|
51
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="idddd87a0eb77d"><pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='id377433c30186'>Contents of pre tag</pre></pre>
|
|
52
|
+
|
|
53
|
+
Which renders as:
|
|
54
|
+
|
|
55
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id377433c30186">Contents of pre tag</pre>
|
|
56
|
+
|
|
57
|
+
### Usage Example 2
|
|
58
|
+
This example generates a copy button and does not demonstrate `noselect`.
|
|
59
|
+
|
|
60
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="idb92b40eba687">{% pre copyButton %}Contents of pre tag
|
|
61
|
+
{% endpre %}</pre>
|
|
62
|
+
|
|
63
|
+
Generates:
|
|
64
|
+
<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>
|
|
65
|
+
|
|
66
|
+
Which renders as:
|
|
67
|
+
<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>
|
|
68
|
+
|
|
69
|
+
### Usage Example 3
|
|
70
|
+
This example generates a copy button and does demonstrates the default usage of `noselect`, which renders an unselectable dollar sign followed by a space.
|
|
71
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id59feb02aa3b9">{% pre copyButton %}
|
|
72
|
+
{% noselect %}Contents of pre tag
|
|
73
|
+
{% endpre %}</pre>
|
|
74
|
+
|
|
75
|
+
Generates:
|
|
76
|
+
|
|
77
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id7935a9ec84be"><pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='id8103adbe3dc2'><button class='copyBtn' data-clipboard-target='#id8103adbe3dc2' title='Copy to clipboard'><img src='images/clippy.svg' alt='Copy to clipboard' style='width: 13px'></button><span class='unselectable'>$ </span>Contents of pre tag</pre></pre>
|
|
78
|
+
|
|
79
|
+
Which renders as:
|
|
80
|
+
|
|
81
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id8103adbe3dc2"><button class="copyBtn" data-clipboard-target="#id8103adbe3dc2" title="Copy to clipboard"><img src="images/clippy.svg" alt="Copy to clipboard" style="width: 13px"></button><span class="unselectable">$ </span>Contents of pre tag</pre>
|
|
82
|
+
|
|
83
|
+
### Usage Example 4
|
|
84
|
+
This example generates a copy button and does demonstrates the `noselect` being used twice:
|
|
85
|
+
the first time to render an unselectable custom prompt,
|
|
86
|
+
and the second time to render unselectable output.
|
|
87
|
+
|
|
88
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id0f0a8de5ecc5">{% pre copyButton %}{% noselect >>> %}Contents of pre tag
|
|
89
|
+
{% noselect How now brown cow%}
|
|
90
|
+
{% endpre %}</pre>
|
|
91
|
+
|
|
92
|
+
Generates:
|
|
93
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id3095048e2ec2"><pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='idcb8035dc3766'><button class='copyBtn' data-clipboard-target='#idcb8035dc3766' title='Copy to clipboard'><img src='images/clippy.svg' alt='Copy to clipboard' style='width: 13px'></button><span class='unselectable'>>>> </span>contents of pre tag
|
|
94
|
+
<span class='unselectable'>How now brown cow</span></pre></pre>
|
|
95
|
+
|
|
96
|
+
Which renders as:
|
|
97
|
+
|
|
98
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="idcb8035dc3766"><button class="copyBtn" data-clipboard-target="#idcb8035dc3766" title="Copy to clipboard"><img src="images/clippy.svg" alt="Copy to clipboard" style="width: 13px"></button><span class="unselectable">>>> </span>contents of pre tag
|
|
99
|
+
<span class="unselectable">How now brown cow</span></pre>
|
|
100
|
+
|
|
101
|
+
### CSS
|
|
102
|
+
Here are the CSS declarations that I defined pertaining to the `pre` and `noselect` tags:
|
|
103
|
+
|
|
104
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id68ec1ab4d04c"><button class="copyBtn" data-clipboard-target="#id68ec1ab4d04c" title="Copy to clipboard"><img src="images/clippy.svg" alt="Copy to clipboard" style="width: 13px"></button>.maxOneScreenHigh {
|
|
105
|
+
max-height: 500px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.unselectable {
|
|
109
|
+
color: #7922f9;
|
|
110
|
+
-moz-user-select: none;
|
|
111
|
+
-khtml-user-select: none;
|
|
112
|
+
user-select: none;
|
|
113
|
+
}</pre>
|
|
114
|
+
|
|
115
|
+
### Comprehensive Example
|
|
116
|
+
The code I wrote to generate the above CSS was a good example of how the plugins work together with
|
|
117
|
+
the `from` and `to` tags from my `from_to_until` plugin:
|
|
118
|
+
|
|
119
|
+
<pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="id1ad3df5c4a2f">
|
|
120
|
+
{% capture css %}{% flexible_include '_sass/mystyle.scss' %}{% endcapture %}
|
|
121
|
+
{% pre copyButton %}{{ css | from: '.copyBtn' | to: '^$' | strip }}
|
|
122
|
+
|
|
123
|
+
{{ css | from: '.copyContainer' | to: '^$' | strip }}
|
|
124
|
+
|
|
125
|
+
{{ css | from: '.maxOneScreenHigh' | to: '^$' | strip }}
|
|
126
|
+
|
|
127
|
+
{{ css | from: '.unselectable' | to: '^$' | strip }}
|
|
128
|
+
{% endpre %}</pre>
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
134
|
+
|
|
135
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Contributing
|
|
139
|
+
|
|
140
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll_pre.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/images/clippy.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg height="1024" width="896" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M128 768h256v64H128v-64z m320-384H128v64h320v-64z m128 192V448L384 640l192 192V704h320V576H576z m-288-64H128v64h160v-64zM128 704h160v-64H128v64z m576 64h64v128c-1 18-7 33-19 45s-27 18-45 19H64c-35 0-64-29-64-64V192c0-35 29-64 64-64h192C256 57 313 0 384 0s128 57 128 128h192c35 0 64 29 64 64v320h-64V320H64v576h640V768zM128 256h512c0-35-29-64-64-64h-64c-35 0-64-29-64-64s-29-64-64-64-64 29-64 64-29 64-64 64h-64c-35 0-64 29-64 64z" />
|
|
3
|
+
</svg>
|
|
File without changes
|
data/jekyll_pre.gemspec
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/jekyll_pre/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "jekyll_pre"
|
|
7
|
+
spec.version = JekyllPre::VERSION
|
|
8
|
+
spec.authors = ["Mike Slinn"]
|
|
9
|
+
spec.email = ["mslinn@mslinn.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable text."
|
|
12
|
+
spec.description = "Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable text."
|
|
13
|
+
spec.homepage = "https://github.com/mslinn/jekyll_pre"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
|
16
|
+
|
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
18
|
+
|
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/mslinn/jekyll_pre"
|
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/mslinn/jekyll_pre/CHANGELOG.md"
|
|
22
|
+
|
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
spec.bindir = "exe"
|
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
32
|
+
spec.require_paths = ["lib"]
|
|
33
|
+
|
|
34
|
+
spec.add_dependency 'jekyll'
|
|
35
|
+
|
|
36
|
+
spec.add_development_dependency 'bundler'
|
|
37
|
+
spec.add_development_dependency 'debase'
|
|
38
|
+
spec.add_development_dependency 'jekyll'
|
|
39
|
+
spec.add_development_dependency 'pry'
|
|
40
|
+
spec.add_development_dependency 'rake'
|
|
41
|
+
spec.add_development_dependency 'rspec'
|
|
42
|
+
spec.add_development_dependency 'rubocop'
|
|
43
|
+
spec.add_development_dependency 'rubocop-jekyll'
|
|
44
|
+
spec.add_development_dependency 'rubocop-rake'
|
|
45
|
+
spec.add_development_dependency 'ruby-debug-ide'
|
|
46
|
+
end
|
data/lib/jekyll_pre.rb
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "jekyll_pre/version"
|
|
4
|
+
|
|
5
|
+
module JekyllPre
|
|
6
|
+
class Error < StandardError; end
|
|
7
|
+
|
|
8
|
+
# """
|
|
9
|
+
# \\{% pre %}
|
|
10
|
+
# Content here
|
|
11
|
+
# \\{% endpre %}
|
|
12
|
+
#
|
|
13
|
+
# \\{% pre copyButton %}
|
|
14
|
+
# Content here
|
|
15
|
+
# \\{% endpre %}"""
|
|
16
|
+
#
|
|
17
|
+
# \\{% pre shell %}
|
|
18
|
+
# Content here
|
|
19
|
+
# \\{% endpre %}
|
|
20
|
+
#
|
|
21
|
+
# \\{% pre copyButton shell %}
|
|
22
|
+
# Content here
|
|
23
|
+
# \\{% endpre %}
|
|
24
|
+
#
|
|
25
|
+
# \\{% pre copyButton label %}
|
|
26
|
+
# Content here
|
|
27
|
+
# \\{% endpre %}"""
|
|
28
|
+
class PreTagBlock < Liquid::Block
|
|
29
|
+
@@prefix = "<button class='copyBtn' data-clipboard-target="
|
|
30
|
+
@@suffix = " title='Copy to clipboard'><img src='/assets/images/clippy.svg' " \
|
|
31
|
+
"alt='Copy to clipboard' style='width: 13px'></button>"
|
|
32
|
+
|
|
33
|
+
def self.make_copy_button(pre_id)
|
|
34
|
+
"#{@@prefix}'##{pre_id}'#{@@suffix}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.make_pre(make_copy_button, label, content)
|
|
38
|
+
label = if label.to_s.empty?
|
|
39
|
+
''
|
|
40
|
+
elsif label.to_s.downcase.strip == 'shell'
|
|
41
|
+
"<div class='codeLabel unselectable' data-lt-active='false'>Shell</div>"
|
|
42
|
+
else
|
|
43
|
+
"<div class='codeLabel unselectable' data-lt-active='false'>#{label}</div>"
|
|
44
|
+
end
|
|
45
|
+
pre_id = "id#{SecureRandom.hex(6)}"
|
|
46
|
+
copy_button = make_copy_button ? PreTagBlock.make_copy_button(pre_id) : ''
|
|
47
|
+
"#{label}<pre data-lt-active='false' class='maxOneScreenHigh copyContainer' id='#{pre_id}'>#{copy_button}#{content.strip}</pre>"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @param tag_name [String] is the name of the tag, which we already know.
|
|
51
|
+
# @param text [Hash, String, Liquid::Tag::Parser] the arguments from the web page.
|
|
52
|
+
# @param tokens [Liquid::ParseContext] tokenized command line
|
|
53
|
+
# @return [void]
|
|
54
|
+
def initialize(tag_name, text, tokens)
|
|
55
|
+
super(tag_name, text, tokens)
|
|
56
|
+
text = '' if text.nil?
|
|
57
|
+
text.strip!
|
|
58
|
+
@make_copy_button = text.include? 'copyButton'
|
|
59
|
+
remaining_text = text.sub('copyButton', '').strip
|
|
60
|
+
#puts "@make_copy_button = '#{@make_copy_button}'; text = '#{text}'; remaining_text = '#{remaining_text}'"
|
|
61
|
+
@label = remaining_text
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Method prescribed by the Jekyll plugin lifecycle.
|
|
65
|
+
# @return [String]
|
|
66
|
+
def render(context)
|
|
67
|
+
content = super
|
|
68
|
+
# puts "@make_copy_button = '#{@make_copy_button}'; @label = '#{@label}'"
|
|
69
|
+
PreTagBlock.make_pre(@make_copy_button, @label, content)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# """\\{% noselect %} or \\{% noselect this all gets copied.
|
|
74
|
+
# Also, space before the closing percent is signficant %}"""
|
|
75
|
+
class UnselectableTag < Liquid::Tag
|
|
76
|
+
def initialize(tag_name, text, tokens)
|
|
77
|
+
super(tag_name, text, tokens)
|
|
78
|
+
@content = text
|
|
79
|
+
# puts "UnselectableTag: content1= '#{@content}'"
|
|
80
|
+
@content = '$ ' if @content.nil? || @content.empty?
|
|
81
|
+
# puts "UnselectableTag: content2= '#{@content}'"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def render(_)
|
|
85
|
+
"<span class='unselectable'>#{@content}</span>"
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
Liquid::Template.register_tag('pre', JekyllPre::PreTagBlock)
|
|
91
|
+
Liquid::Template.register_tag('noselect', JekyllPre::UnselectableTag)
|
data/sig/jekyll_pre.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll_pre
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Mike Slinn
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-03-13 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: jekyll
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: debase
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: jekyll
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: pry
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rake
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rubocop
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: rubocop-jekyll
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rubocop-rake
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: ruby-debug-ide
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
167
|
+
description: Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|
|
168
|
+
text.
|
|
169
|
+
email:
|
|
170
|
+
- mslinn@mslinn.com
|
|
171
|
+
executables: []
|
|
172
|
+
extensions: []
|
|
173
|
+
extra_rdoc_files: []
|
|
174
|
+
files:
|
|
175
|
+
- ".rspec"
|
|
176
|
+
- ".rubocop.yml"
|
|
177
|
+
- ".ruby-version"
|
|
178
|
+
- ".vscode/launch.json"
|
|
179
|
+
- ".vscode/settings.json"
|
|
180
|
+
- CHANGELOG.md
|
|
181
|
+
- Gemfile
|
|
182
|
+
- Gemfile.lock
|
|
183
|
+
- LICENSE.txt
|
|
184
|
+
- README.md
|
|
185
|
+
- Rakefile
|
|
186
|
+
- images/clippy.svg
|
|
187
|
+
- images/clippy.svg:Zone.Identifier
|
|
188
|
+
- jekyll_pre.gemspec
|
|
189
|
+
- lib/jekyll_pre.rb
|
|
190
|
+
- lib/jekyll_pre/version.rb
|
|
191
|
+
- sig/jekyll_pre.rbs
|
|
192
|
+
homepage: https://github.com/mslinn/jekyll_pre
|
|
193
|
+
licenses:
|
|
194
|
+
- MIT
|
|
195
|
+
metadata:
|
|
196
|
+
allowed_push_host: https://rubygems.org
|
|
197
|
+
homepage_uri: https://github.com/mslinn/jekyll_pre
|
|
198
|
+
source_code_uri: https://github.com/mslinn/jekyll_pre
|
|
199
|
+
changelog_uri: https://github.com/mslinn/jekyll_pre/CHANGELOG.md
|
|
200
|
+
post_install_message:
|
|
201
|
+
rdoc_options: []
|
|
202
|
+
require_paths:
|
|
203
|
+
- lib
|
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - ">="
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: 2.6.0
|
|
209
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
|
+
requirements:
|
|
211
|
+
- - ">="
|
|
212
|
+
- !ruby/object:Gem::Version
|
|
213
|
+
version: '0'
|
|
214
|
+
requirements: []
|
|
215
|
+
rubygems_version: 3.2.3
|
|
216
|
+
signing_key:
|
|
217
|
+
specification_version: 4
|
|
218
|
+
summary: Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|
|
219
|
+
text.
|
|
220
|
+
test_files: []
|