jekyll_pre 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/jekyll_pre.gemspec +2 -2
- data/lib/exec_tag.rb +3 -1
- data/lib/jekyll_pre/version.rb +1 -1
- data/lib/pre_tag_block.rb +38 -30
- metadata +6 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc048288e5f189d4519766b6db9a8807d6f41b4193be5fcd7ea7d39ed1af4a7b
|
4
|
+
data.tar.gz: 356f768bba6d1bbdb4abe52394a75e6aa387257b4fd1c58d7f9775324382ac6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0833a721b44a3f9078d9ae76a70152d516469bb6062424366c3a7dc1171fe78a9407d6195e5ba5ae728224f78a278cff2f8fb145d94c5bc9346bf75bc44435
|
7
|
+
data.tar.gz: ff46960e6cfd7fd339e9d835e2bcaf0934d29dc7bb14bcf860208ced8bfab349f6bd680ac9b5cab7b426d4af5f0ae1dc10758181e24327e645cbeb0a323f8d63
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/jekyll_pre.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
END_OF_DESC
|
11
11
|
spec.email = ['mslinn@mslinn.com']
|
12
12
|
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
13
|
-
spec.homepage = 'https://www.mslinn.com/
|
13
|
+
spec.homepage = 'https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#jekyll_pre'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.metadata = {
|
16
16
|
'allowed_push_host' => 'https://rubygems.org',
|
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.version = JekyllPreVersion::VERSION
|
33
33
|
|
34
34
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
35
|
-
spec.add_dependency 'jekyll_plugin_support', '~> 0.
|
35
|
+
spec.add_dependency 'jekyll_plugin_support', '~> 0.6.0'
|
36
36
|
end
|
data/lib/exec_tag.rb
CHANGED
@@ -12,7 +12,9 @@ module ExecTag
|
|
12
12
|
def render_impl
|
13
13
|
parse_args
|
14
14
|
@original_command = @helper.remaining_markup_original
|
15
|
-
command = JekyllPluginHelper.expand_env
|
15
|
+
command = JekyllPluginHelper.expand_env @original_command
|
16
|
+
raise PreError, "Command is empty on on line #{@line_number} (after front matter) of #{@page['path']}", [] if command.strip.empty?
|
17
|
+
|
16
18
|
response = run_command(command)
|
17
19
|
response = if @child_status.success?
|
18
20
|
compress(response)
|
data/lib/jekyll_pre/version.rb
CHANGED
data/lib/pre_tag_block.rb
CHANGED
@@ -17,35 +17,6 @@ module PreTagBlock
|
|
17
17
|
"#{@@prefix}'##{pre_id}'#{@@suffix}"
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.make_pre(make_copy_button, number_lines, label, dark, highlight_pattern, css_class, style, clear, content) # rubocop:disable Metrics/ParameterLists
|
21
|
-
pre_clear = label_clear = ''
|
22
|
-
if clear
|
23
|
-
if label.to_s.empty?
|
24
|
-
pre_clear = ' clear'
|
25
|
-
else
|
26
|
-
label_clear = ' clear'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
css_class = css_class ? " #{css_class}" : ''
|
30
|
-
style = style ? " style='#{style}'" : ''
|
31
|
-
dark_label = ' darkLabel' if dark
|
32
|
-
label = if label.to_s.empty?
|
33
|
-
''
|
34
|
-
elsif label.to_s.downcase.strip == 'shell'
|
35
|
-
"<div class='codeLabel unselectable#{dark_label}#{label_clear}' data-lt-active='false'>Shell</div>"
|
36
|
-
else
|
37
|
-
"<div class='codeLabel unselectable#{dark_label}#{label_clear}' data-lt-active='false'>#{label}</div>"
|
38
|
-
end
|
39
|
-
pre_id = "id#{SecureRandom.hex(6)}"
|
40
|
-
copy_button = make_copy_button ? PreTagBlock.make_copy_button(pre_id) : ''
|
41
|
-
content = PreTagBlock.highlight(content, highlight_pattern) if highlight_pattern
|
42
|
-
content = PreTagBlock.number_content(content) if number_lines
|
43
|
-
|
44
|
-
classes = "maxOneScreenHigh copyContainer#{dark}#{pre_clear}#{css_class}"
|
45
|
-
pre_content = "#{copy_button}#{content.strip}"
|
46
|
-
"#{label}<pre data-lt-active='false' class='#{classes}'#{style} id='#{pre_id}'>#{pre_content}</pre>"
|
47
|
-
end
|
48
|
-
|
49
20
|
def self.number_content(content)
|
50
21
|
lines = content.split("\n")
|
51
22
|
digits = lines.length.to_s.length
|
@@ -62,6 +33,7 @@ module PreTagBlock
|
|
62
33
|
|
63
34
|
def render_impl(text)
|
64
35
|
text.strip!
|
36
|
+
@helper.gem_file __FILE__ # Enables plugin attribution
|
65
37
|
|
66
38
|
@clear = @helper.parameter_specified? 'clear'
|
67
39
|
@class = @helper.parameter_specified? 'class'
|
@@ -76,7 +48,43 @@ module PreTagBlock
|
|
76
48
|
@label ||= @helper.argv.join(' ')
|
77
49
|
|
78
50
|
@logger.debug { "@make_copy_button = '#{@make_copy_button}'; @label = '#{@label}'" }
|
79
|
-
|
51
|
+
make_pre(text)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def make_pre(content)
|
57
|
+
pre_clear = label_clear = ''
|
58
|
+
if @clear
|
59
|
+
if @label.to_s.empty?
|
60
|
+
pre_clear = ' clear'
|
61
|
+
else
|
62
|
+
label_clear = ' clear'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
@class = @class ? " #{@class}" : ''
|
66
|
+
@style = @style ? " style='#{@style}'" : ''
|
67
|
+
dark_label = ' darkLabel' if @dark
|
68
|
+
@label = if @label.to_s.empty?
|
69
|
+
''
|
70
|
+
elsif @label.to_s.casecmp('shell').zero?
|
71
|
+
"<div class='codeLabel unselectable#{dark_label}#{label_clear}' data-lt-active='false'>Shell</div>"
|
72
|
+
else
|
73
|
+
"<div class='codeLabel unselectable#{dark_label}#{label_clear}' data-lt-active='false'>#{@label}</div>"
|
74
|
+
end
|
75
|
+
pre_id = "id#{SecureRandom.hex(6)}"
|
76
|
+
copy_button = @make_copy_button ? PreTagBlock.make_copy_button(pre_id) : ''
|
77
|
+
content = PreTagBlock.highlight(content, @highlight) if @highlight
|
78
|
+
content = PreTagBlock.number_content(content) if @number_lines
|
79
|
+
|
80
|
+
classes = "maxOneScreenHigh copyContainer#{@dark}#{pre_clear}#{@class}"
|
81
|
+
pre_content = "#{copy_button}#{content}"
|
82
|
+
attribution = @helper.attribute if @helper.attribution
|
83
|
+
<<~END_OUTPUT
|
84
|
+
#{@label}
|
85
|
+
<pre data-lt-active='false' class='#{classes}'#{@style} id='#{pre_id}'>#{pre_content}</pre>
|
86
|
+
#{attribution}
|
87
|
+
END_OUTPUT
|
80
88
|
end
|
81
89
|
|
82
90
|
JekyllPluginHelper.register(self, 'pre')
|
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
|
+
version: 1.3.0
|
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-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -30,20 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.5.3
|
33
|
+
version: 0.6.0
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.5.3
|
40
|
+
version: 0.6.0
|
47
41
|
description: 'Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|
48
42
|
text. Can number lines.
|
49
43
|
|
@@ -68,14 +62,14 @@ files:
|
|
68
62
|
- spec/pre_spec.rb
|
69
63
|
- spec/spec_helper.rb
|
70
64
|
- spec/status_persistence.txt
|
71
|
-
homepage: https://www.mslinn.com/
|
65
|
+
homepage: https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#jekyll_pre
|
72
66
|
licenses:
|
73
67
|
- MIT
|
74
68
|
metadata:
|
75
69
|
allowed_push_host: https://rubygems.org
|
76
70
|
bug_tracker_uri: https://github.com/mslinn/jekyll_pre/issues
|
77
71
|
changelog_uri: https://github.com/mslinn/jekyll_pre/CHANGELOG.md
|
78
|
-
homepage_uri: https://www.mslinn.com/
|
72
|
+
homepage_uri: https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#jekyll_pre
|
79
73
|
source_code_uri: https://github.com/mslinn/jekyll_pre
|
80
74
|
post_install_message: |2+
|
81
75
|
|