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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a78213a8f26a3d6743a9b706501a5c0f87279eeb243e492956fdd557b0a1e6d
4
- data.tar.gz: 64c8640dee1fe914ac54f9813df8bb3f365518d41d13aecd62bda8c752d0488e
3
+ metadata.gz: bc048288e5f189d4519766b6db9a8807d6f41b4193be5fcd7ea7d39ed1af4a7b
4
+ data.tar.gz: 356f768bba6d1bbdb4abe52394a75e6aa387257b4fd1c58d7f9775324382ac6f
5
5
  SHA512:
6
- metadata.gz: e89f23e343045045c93f7fe7843a43611608f8702e934f4ce0f3c50b52bed7d71b856c79af679d4af9fbdd25921bbcf6977acbd709033a171bbfffc136ff358d
7
- data.tar.gz: bba7c4caf281ab09415560e63a525c632bd98019bb475d53e526fade9c43ed4f77a9de7ef8395085c82308cf4fe31c4e4bbc52c58870f942cd7f6db1181e23ae
6
+ metadata.gz: 5e0833a721b44a3f9078d9ae76a70152d516469bb6062424366c3a7dc1171fe78a9407d6195e5ba5ae728224f78a278cff2f8fb145d94c5bc9346bf75bc44435
7
+ data.tar.gz: ff46960e6cfd7fd339e9d835e2bcaf0934d29dc7bb14bcf860208ced8bfab349f6bd680ac9b5cab7b426d4af5f0ae1dc10758181e24327e645cbeb0a323f8d63
data/.rubocop.yml CHANGED
@@ -26,7 +26,7 @@ Layout/LineLength:
26
26
  Max: 150
27
27
 
28
28
  Metrics/AbcSize:
29
- Max: 25
29
+ Max: 35
30
30
 
31
31
  Metrics/BlockLength:
32
32
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.3.0
2
+ * Updated to `jekyll_plugin_support` v0.6.0 for attribution support.
3
+
4
+ ## 1.2.5
5
+ * Empty exec commands are detected and reported.
6
+
1
7
  ## 1.2.4
2
8
  * The `exec` tag now evaluates environment variables in the command before execution.
3
9
 
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/blog/2020/10/03/jekyll-plugins.html#pre'
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.5.0', '>= 0.5.3'
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(@original_command)
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)
@@ -1,3 +1,3 @@
1
1
  module JekyllPreVersion
2
- VERSION = '1.2.4'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
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
- self.class.make_pre(@make_copy_button, @number_lines, @label, @dark, @highlight, @class, @style, @clear, text)
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.2.4
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-03-19 00:00:00.000000000 Z
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.5.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.5.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/blog/2020/10/03/jekyll-plugins.html#pre
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/blog/2020/10/03/jekyll-plugins.html#pre
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