jekyll_plugin_support 0.6.0 → 0.6.1
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +12 -0
- data/lib/call_chain.rb +12 -0
- data/lib/gem_support.rb +4 -3
- data/lib/jekyll_plugin_helper.rb +1 -1
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fa04aaa91759fb0cea5d52005f80d854c0e88bdc6c7300d167fd85737cdc584
|
4
|
+
data.tar.gz: '0183049f3234a4d97e071dc00055fd79d844da86ef8c6d836c1c8be3b1430d1b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48bcfac7c6a918b7ad182bdcb5890c5707a5955d119df6ad03304c0a4712e07b7b5d523668fa6fc391a41e403706810d8939ac8c5c6ff1d7616db35ee804f017
|
7
|
+
data.tar.gz: 6adc3d6a4b5cebbf081b8b53abe3cc6abdac822046abbfe1d350f85f18d4c45f4861c0bed91cad29117d88605e49f22afb79d4b65adc6b35413924df6556d579
|
data/CHANGELOG.md
CHANGED
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
|
-
|
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
|
data/lib/jekyll_plugin_helper.rb
CHANGED
@@ -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)
|
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.
|
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-
|
11
|
+
date: 2023-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|