jekyll_plugin_support 0.6.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ce28127788362fc89e19bc132113bbc169c4bfe0501e08821a2c425451d29c6
4
- data.tar.gz: 2e98d5294e503b7b510463037e8c93f7318df64f2e3a7728ebfd1fe82a397e6b
3
+ metadata.gz: eb10128c2e05e5b4cd74a5878d137d6ffea98ceaf0dcd792666f00fbe8e7555f
4
+ data.tar.gz: 59363370fe4c0a64db20ea2a8a2adbe456e66eecc53a0b50f4393dea64a71f04
5
5
  SHA512:
6
- metadata.gz: 916d5b3f843c68faec816a307491038d1eb670015e8c38f536e0b1b9fdba0162d428477a1a592975da56dd8b26f90a9bcb16c66db7cd2cb7cbde2e041c402ff9
7
- data.tar.gz: 3e7b7670207a9b552e28cb714ce2d3bc46c16b72259a2e58c987db41ab3e47debddcd8be2ef49b84a17c4434638ad67cd4222df18bc1d647b4ea481700aaf23b
6
+ metadata.gz: 2e6ce3ce7322e023604e57f23bcd55f5a14eeb098800ab19b477e0a5af1220266fc5f0a64f3e376c3882356bd1514ef1fa7a88040e83fe43355c2b8471ad1c6b
7
+ data.tar.gz: 4305d408b8ac6ff904c6c2090ff6c873c2f9631c60c8122a18b4a9f66fad377e314c0cc20f2b113488a5e4a8a141ab958da9a9181e162885003fcdf0a8598e9f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.6.2 / 2023-05-15
2
+ * Removed annoying blank line output when attribute was invoked.
3
+
4
+ ## 0.6.1 / 2023-04-12
5
+ * Added `CallChain.excerpt_caller` to detect if an excerpt is being generated.
6
+
1
7
  ## 0.6.0 / 2023-04-05
2
8
  * Added attribution support
3
9
  * Renamed `jekyll_plugin_support_helper.rb` to `jekyll_plugin_helper.rb`.
data/README.md CHANGED
@@ -243,6 +243,18 @@ An alternative attribution string can be specified properties can be output usin
243
243
  {% my_tag attribution="Generated by the #{name} #{version} Jekyll plugin, written by #{author} #{date}" %}
244
244
  ```
245
245
 
246
+ ### Attribution Generation
247
+ You can decide where you want the attribution string for your Jekyll tag to appear by invoking `@helper.attribute`. For example, this is how the [`jekyll_outline` tag](https://github.com/mslinn/jekyll_outline/blob/v1.1.1/lib/outline_tag.rb#L32-L46) generates output:
248
+
249
+ ```
250
+ <<~HEREDOC
251
+ <div class="outer_posts">
252
+ #{make_entries(collection)&.join("\n")}
253
+ </div>
254
+ #{@helper.attribute if @helper.attribution}
255
+ HEREDOC
256
+ ```
257
+
246
258
 
247
259
  ## Additional Information
248
260
  More information is available on
data/lib/call_chain.rb CHANGED
@@ -19,6 +19,18 @@ module CallChain
19
19
  )
20
20
  end
21
21
 
22
+ def self.excerpt_caller
23
+ call_sequence = caller
24
+ call_sequence.each do |caller_|
25
+ parsed_caller = parse_caller caller_
26
+ filepath = parsed_caller.filepath
27
+ excerpt = filepath.match? %r{jekyll[.0-9-]*/lib/jekyll/excerpt.rb\z}
28
+ puts "excerpt matched #{filepath}" if excerpt
29
+ return true if excerpt
30
+ end
31
+ false
32
+ end
33
+
22
34
  # Return ACaller prior to jekyll_plugin_support
23
35
  def self.jpsh_subclass_caller
24
36
  state = :nothing_found
data/lib/gem_support.rb CHANGED
@@ -3,6 +3,9 @@ module GemSupport
3
3
  # @param file must be a fully qualified file name that points to a file within a gem.
4
4
  # @return Gem::Specification of gem that file points into, or nil if not called from a gem
5
5
  def self.current_spec(file)
6
+ abort 'GemSupport::current_spec: file is nil' if file.nil?
7
+ return nil unless File.exist?(file)
8
+
6
9
  searcher = if Gem::Specification.respond_to?(:find)
7
10
  Gem::Specification
8
11
  elsif Gem.respond_to?(:searcher)
@@ -10,9 +13,7 @@ module GemSupport
10
13
  end
11
14
 
12
15
  searcher&.find do |spec|
13
- # The File.fnmatch pattern ** means to match directories recursively or files expansively.
14
- # This makes the method return the proper Gem::Specification when pointed at any file in any directory within a gem.
15
- File.fnmatch(File.join(spec.full_gem_path, '**'), file)
16
+ file.start_with? spec.full_gem_path
16
17
  end
17
18
  end
18
19
  end
@@ -7,7 +7,7 @@ require_relative 'gem_support'
7
7
  class JekyllPluginHelper # rubocop:disable Metrics/ClassLength
8
8
  attr_accessor :liquid_context
9
9
  attr_reader :argv, :attribution, :keys_values, :logger, :markup, :no_arg_parsing, :params, :tag_name,
10
- :argv_original, :keys_values_original, :params_original, :jpsh_subclass_caller
10
+ :argv_original, :excerpt_caller, :keys_values_original, :params_original, :jpsh_subclass_caller
11
11
 
12
12
  # Expand an environment variable reference
13
13
  def self.expand_env(str, die_if_undefined: false)
@@ -142,7 +142,6 @@ class JekyllPluginHelper # rubocop:disable Metrics/ClassLength
142
142
  else
143
143
  @attribution
144
144
  end
145
- puts { "Interpolationg #{string}" }
146
145
  String.interpolate { string }
147
146
  end
148
147
 
@@ -1,3 +1,3 @@
1
1
  module JekyllPluginSupportVersion
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.2'.freeze
3
3
  end
@@ -100,6 +100,8 @@ module JekyllSupport
100
100
 
101
101
  # Method prescribed by the Jekyll plugin lifecycle.
102
102
  def render(liquid_context)
103
+ return if @helper.excerpt_caller
104
+
103
105
  @helper.liquid_context = liquid_context
104
106
 
105
107
  @envs = liquid_context.environments.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_plugin_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.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-04-06 00:00:00.000000000 Z
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facets