jekyll_plugin_support 0.6.0 → 0.6.1

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: 1ce28127788362fc89e19bc132113bbc169c4bfe0501e08821a2c425451d29c6
4
- data.tar.gz: 2e98d5294e503b7b510463037e8c93f7318df64f2e3a7728ebfd1fe82a397e6b
3
+ metadata.gz: 5fa04aaa91759fb0cea5d52005f80d854c0e88bdc6c7300d167fd85737cdc584
4
+ data.tar.gz: '0183049f3234a4d97e071dc00055fd79d844da86ef8c6d836c1c8be3b1430d1b'
5
5
  SHA512:
6
- metadata.gz: 916d5b3f843c68faec816a307491038d1eb670015e8c38f536e0b1b9fdba0162d428477a1a592975da56dd8b26f90a9bcb16c66db7cd2cb7cbde2e041c402ff9
7
- data.tar.gz: 3e7b7670207a9b552e28cb714ce2d3bc46c16b72259a2e58c987db41ab3e47debddcd8be2ef49b84a17c4434638ad67cd4222df18bc1d647b4ea481700aaf23b
6
+ metadata.gz: 48bcfac7c6a918b7ad182bdcb5890c5707a5955d119df6ad03304c0a4712e07b7b5d523668fa6fc391a41e403706810d8939ac8c5c6ff1d7616db35ee804f017
7
+ data.tar.gz: 6adc3d6a4b5cebbf081b8b53abe3cc6abdac822046abbfe1d350f85f18d4c45f4861c0bed91cad29117d88605e49f22afb79d4b65adc6b35413924df6556d579
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.6.1 / 2023-04-12
2
+ * Added `CallChain.excerpt_caller` to detect if an excerpt is being generated.
3
+
1
4
  ## 0.6.0 / 2023-04-05
2
5
  * Added attribution support
3
6
  * 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)
@@ -1,3 +1,3 @@
1
1
  module JekyllPluginSupportVersion
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.1'.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.1
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-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facets