jekyll_flexible_include 2.0.15 → 2.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -4
- data/CHANGELOG.md +16 -0
- data/README.md +72 -23
- data/jekyll_flexible_include_plugin.gemspec +1 -0
- data/lib/flexible_include/version.rb +1 -1
- data/lib/flexible_include.rb +82 -27
- data/lib/git_util.rb +41 -0
- metadata +19 -4
- /data/spec/{glob_spec.rb → flexible_include_spec.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f07914cb71b0dc833f7735175ef18ccde8357e7fcf14014d954cae6e40c5bc
|
4
|
+
data.tar.gz: e077293b1be82f05dedfd02e6326c6c64d4a87895fc4d6f90cc7d532d50df857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a476f8c116c18590acd67e5be96fb1d10889394f3c278cec7bb43d211be7a8f8dcacc158953c4e9bea3de29b6d32668e8d5500ae24a8a0bd405d091219ac6ff
|
7
|
+
data.tar.gz: 5bd8341a6eb53a35a520791a32d79ec587169650f56d36c3d4b4aa965f6247867037253d83c677cbdae913d79b19d6a18a901a63013cc49fbc526358583bb238
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require:
|
2
|
-
- rubocop-rspec
|
3
2
|
# - rubocop-jekyll
|
3
|
+
- rubocop-md
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
4
7
|
|
5
8
|
# inherit_gem:
|
6
9
|
# rubocop-jekyll: .rubocop.yml
|
@@ -20,8 +23,14 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
20
23
|
Gemspec/RequireMFA:
|
21
24
|
Enabled: false
|
22
25
|
|
26
|
+
Layout/InitialIndentation:
|
27
|
+
Exclude:
|
28
|
+
- README.md
|
29
|
+
|
23
30
|
Layout/HashAlignment:
|
24
|
-
|
31
|
+
EnforcedColonStyle: table
|
32
|
+
Exclude:
|
33
|
+
- jekyll_flexible_include_plugin.gemspec
|
25
34
|
|
26
35
|
Layout/LineLength:
|
27
36
|
Max: 150
|
@@ -29,6 +38,10 @@ Layout/LineLength:
|
|
29
38
|
Layout/MultilineMethodCallIndentation:
|
30
39
|
Enabled: false
|
31
40
|
|
41
|
+
Lint/RedundantCopDisableDirective:
|
42
|
+
Exclude:
|
43
|
+
- jekyll_flexible_include_plugin.gemspec
|
44
|
+
|
32
45
|
Metrics/AbcSize:
|
33
46
|
Max: 45
|
34
47
|
|
@@ -42,10 +55,10 @@ Metrics/ClassLength:
|
|
42
55
|
- spec/**/*
|
43
56
|
|
44
57
|
Metrics/CyclomaticComplexity:
|
45
|
-
Max:
|
58
|
+
Max: 20
|
46
59
|
|
47
60
|
Metrics/MethodLength:
|
48
|
-
Max:
|
61
|
+
Max: 40
|
49
62
|
|
50
63
|
Metrics/PerceivedComplexity:
|
51
64
|
Max: 15
|
@@ -63,6 +76,9 @@ RSpec/MultipleExpectations:
|
|
63
76
|
Style/CommandLiteral:
|
64
77
|
Enabled: false
|
65
78
|
|
79
|
+
Style/CommentedKeyword:
|
80
|
+
Enabled: false
|
81
|
+
|
66
82
|
Style/Documentation:
|
67
83
|
Enabled: false
|
68
84
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 2.0.18 / 2023-03-24
|
2
|
+
* The following are now parsed property:
|
3
|
+
`die_on_file_error`, `die_on_path_denied`, `die_on_run_error`, `die_on_path_denied`, and `die_on_other_error`.
|
4
|
+
|
5
|
+
## 2.0.17 / 2023-03-22
|
6
|
+
* Added `repo` and `git_ref` parameters, so files can be retrieved from git repositories at a given commit or tag.
|
7
|
+
|
8
|
+
## 2.0.16 / 2023-02-19
|
9
|
+
* Replaced hard-coded CSS in `denied` method with `flexible_error` class in
|
10
|
+
`demo/assets/css/style.css`.
|
11
|
+
* Added `-e` and `-x` options to `demo/_bin/debug`.
|
12
|
+
* Added configuration section `flexible_include` with supported parameters
|
13
|
+
`die_on_file_error`, `die_on_path_denied`, `die_on_run_error`,
|
14
|
+
`die_on_path_denied` and `die_on_other_error`.
|
15
|
+
* Fixed `undefined method 'path'` that occurred when `FLEXIBLE_INCLUDE_PATHS` was specified.
|
16
|
+
|
1
17
|
## 2.0.15 / 2023-02-18
|
2
18
|
* Replaced dependency `key-value-parser` with `jekyll_plugin_support`.
|
3
19
|
* Added `demo` website.
|
data/README.md
CHANGED
@@ -34,46 +34,78 @@ In addition, filenames that require environment expansion because they contain a
|
|
34
34
|
defined when <code>jekyll build</code> executes.
|
35
35
|
|
36
36
|
|
37
|
+
A file from a git repository can also be included.
|
38
|
+
Files can be retrieved from at a given commit or tag.
|
39
|
+
Two new options are provided for this purpose:
|
40
|
+
- `repo` - directory where git repo resides; environment variables are expanded; defaults to current directory.
|
41
|
+
- `git_ref` - Git ref of commit or tag to be examined for the file; defaults to `HEAD`.
|
42
|
+
|
43
|
+
|
44
|
+
### Configuration
|
45
|
+
Configuration parameters can be added to a section in `_config.yml` called `flexible_include`, like this:
|
46
|
+
|
47
|
+
```yaml
|
48
|
+
flexible_include:
|
49
|
+
die_on_file_error: true
|
50
|
+
die_on_path_denied: true
|
51
|
+
die_on_run_error: true
|
52
|
+
die_on_other_error: true
|
53
|
+
```
|
54
|
+
|
55
|
+
The default values for all of these parameters is `false`,
|
56
|
+
except for `die_on_other_error`, which defaults to `true`.
|
57
|
+
|
58
|
+
- If `die_on_file_error` is enabled, then an attempt to include a file that fails will cause Jekyll to die with an error message.
|
59
|
+
|
60
|
+
- If `die_on_path_denied` is enabled (see [Restricting Directory Access](#restricting-directory-access)), then an attempt to include a file that should be blocked will cause Jekyll to die with an error message.
|
61
|
+
|
62
|
+
- If `die_on_run_error` is enabled, then an attempt to run a process that fails will cause Jekyll to die with an error message.
|
63
|
+
|
64
|
+
- If `die_on_other_error` is enabled, then any other exception will cause Jekyll to die with an error message.
|
65
|
+
|
66
|
+
|
37
67
|
### Syntax
|
38
|
-
The following are equivalent:
|
68
|
+
The following are all equivalent, however, the first two are recommended:
|
39
69
|
```html
|
70
|
+
{% flexible_include file="path" [ OPTIONS ] %}
|
71
|
+
{% flexible_include file='path' [ OPTIONS ] %}
|
40
72
|
{% flexible_include path [ OPTIONS ] %}
|
41
73
|
{% flexible_include 'path' [ OPTIONS ] %}
|
42
74
|
{% flexible_include "path" [ OPTIONS ] %}
|
43
75
|
```
|
44
76
|
|
45
|
-
By default, the included file will escape characters <code><</code>,
|
46
|
-
<code>{</code> and <code>}</code> unless the <code>do_not_escape</code> keyword option is specified.
|
47
77
|
Note that the [square brackets] merely indicate optional parameters
|
48
78
|
and are not intended to be written literally.
|
49
79
|
|
50
80
|
|
51
81
|
### Options
|
52
|
-
* `do_not_escape`
|
82
|
+
* `do_not_escape` keyword option caused the content to be included without HTML escaping it.
|
83
|
+
By default, the included file will escape characters <code><</code>,
|
84
|
+
<code>{</code> and <code>}</code> unless the <code>do_not_escape</code> keyword option is specified.
|
53
85
|
|
54
86
|
* `highlight='regex pattern here'` wraps content matching the regex pattern within a
|
55
87
|
`<span class='bg_yellow'></span>` tag.
|
56
88
|
Note that the pattern can simply consist of the exact text that you want to highlight.
|
57
89
|
|
58
|
-
* `pre` causes the included file to be wrapped inside a
|
59
|
-
no label is generated.
|
90
|
+
* `pre` is a keyword option that causes the included file to be wrapped inside a
|
91
|
+
<pre></pre> tag; no label is generated.
|
60
92
|
The <pre></pre> tag has an `data-lt-active="false"` attribute, so
|
61
93
|
[LanguageTool](https://forum.languagetool.org/t/avoid-spell-check-on-certain-html-inputs-manually/3944)
|
62
94
|
will not attempt to check the spelling or grammar of the contents.
|
63
95
|
|
64
96
|
The following options imply `pre`:
|
65
|
-
* `dark` applies the `dark` class to the generated <pre></pre> tag.
|
97
|
+
* `dark` keyword option applies the `dark` class to the generated <pre></pre> tag.
|
66
98
|
You can define the `dark` and `darkLabel` classes as desired.
|
67
99
|
[This CSS is a good starting point.](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#pre_css)
|
68
100
|
|
69
|
-
* `download` uses the name of the file as a label,
|
101
|
+
* `download` keyword option uses the name of the file as a label,
|
70
102
|
and displays it above the <pre></pre> tag.
|
71
103
|
Clicking the label causes the file to be downloaded.
|
72
104
|
|
73
|
-
* `
|
105
|
+
* `copyButton` keyword option draws an icon at the top right of the <pre></pre>
|
74
106
|
tag that causes the included contents to be copied to the clipboard.
|
75
107
|
|
76
|
-
* `label` specifies that an automatically generated label be placed above the contents.
|
108
|
+
* `label` keyword option specifies that an automatically generated label be placed above the contents.
|
77
109
|
There is no need to specify this option if `download` or `copy_button` options are provided.
|
78
110
|
|
79
111
|
* `label="blah blah"` specifies a label for the contents; this value overrides the default label.
|
@@ -130,7 +162,7 @@ and a red error message will be logged on the console that says something like:
|
|
130
162
|
|
131
163
|
## Installation
|
132
164
|
1. Add the following to `Gemfile`, inside the `jekyll_plugins` group:
|
133
|
-
```
|
165
|
+
```ruby
|
134
166
|
group :jekyll_plugins do
|
135
167
|
gem 'jekyll_flexible_include', '~> 2.0.15'
|
136
168
|
end
|
@@ -172,13 +204,13 @@ and a red error message will be logged on the console that says something like:
|
|
172
204
|
{% flexible_include 'folder/within/jekyll/site/bar.js' %}
|
173
205
|
{% flexible_include '/etc/passwd' %}
|
174
206
|
{% flexible_include '~/.ssh/config' %}
|
175
|
-
{% flexible_include '!jekyll' %}
|
207
|
+
{% flexible_include '!jekyll help' %}
|
176
208
|
{% flexible_include '$HOME/.bash_aliases' %}
|
177
209
|
```
|
178
210
|
|
179
211
|
2. Include a JSON file (without escaping characters).
|
180
212
|
```
|
181
|
-
{% flexible_include '~/folder/under/home/directory/foo.html'
|
213
|
+
{% flexible_include do_not_escape file='~/folder/under/home/directory/foo.html' %}
|
182
214
|
```
|
183
215
|
|
184
216
|
## Additional Information
|
@@ -210,7 +242,7 @@ Following is a workaround.
|
|
210
242
|
## Known Issues
|
211
243
|
If the plugin does not work:
|
212
244
|
|
213
|
-
1. Ensure `_config.yml` doesn't have `safe: true
|
245
|
+
1. Ensure `_config.yml` doesn't have `safe: true` set.
|
214
246
|
That prevents all plugins from working.
|
215
247
|
|
216
248
|
2. If you have version older than v2.x.x,
|
@@ -246,19 +278,36 @@ jekyll_flexible_include (2.0.4)
|
|
246
278
|
```
|
247
279
|
|
248
280
|
|
249
|
-
## Demo
|
281
|
+
## Demo Website
|
250
282
|
A test/demo website is provided in the `demo` directory.
|
251
283
|
You can run it under a debugger, or let it run free.
|
252
284
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
285
|
+
The `demo/_bin/debug` script can set various parameters for the demo.
|
286
|
+
View the help information with the `-h` option:
|
287
|
+
```shell
|
288
|
+
$ demo/_bin/debug -h
|
289
|
+
|
290
|
+
debug - Run the demo Jekyll website.
|
291
|
+
|
292
|
+
By default the demo Jekyll website runs without restriction under ruby-debug-ide and debase.
|
293
|
+
View it at http://localhost:4444
|
294
|
+
|
295
|
+
Options:
|
296
|
+
-e Restrict the allowable directories to read from to the following regexes:
|
297
|
+
jekyll_flexible_include_plugin/.*
|
298
|
+
/dev/.*
|
299
|
+
/proc/.*
|
300
|
+
/run/.*
|
301
|
+
|
302
|
+
-h Show this error message
|
303
|
+
|
304
|
+
-r Run freely, without a debugger
|
305
|
+
|
306
|
+
-x Disable the ability to execute arbitrary commands
|
307
|
+
```
|
258
308
|
|
259
|
-
View the generated website at [`http://localhost:4444`](http://localhost:4444)
|
260
309
|
|
261
|
-
###
|
310
|
+
### Debugging the Demo
|
262
311
|
To run under a debugger, for example Visual Studio Code:
|
263
312
|
1. Set breakpoints.
|
264
313
|
|
@@ -269,7 +318,7 @@ To run under a debugger, for example Visual Studio Code:
|
|
269
318
|
|
270
319
|
3. Once the `Fast Debugger` signon appears, launch the Visual Studio Code launch configuration called `Attach rdebug-ide`.
|
271
320
|
|
272
|
-
4. View the generated website at [`http://localhost:4444`](http://localhost:4444)
|
321
|
+
4. View the generated website at [`http://localhost:4444`](http://localhost:4444).
|
273
322
|
|
274
323
|
|
275
324
|
### Build and Push to RubyGems
|
data/lib/flexible_include.rb
CHANGED
@@ -58,29 +58,21 @@ module FlexibleClassMethods
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
FlexibleIncludeError = Class.new(Liquid::Error)
|
62
62
|
|
63
|
-
class FlexibleInclude < JekyllSupport::JekyllTag
|
63
|
+
class FlexibleInclude < JekyllSupport::JekyllTag # rubocop: disable Metrics/ClassLength
|
64
64
|
include JekyllFlexibleIncludePluginVersion
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
FlexibleIncludeError = Class.new(Liquid::Error)
|
71
|
-
|
72
|
-
def render_impl
|
73
|
-
self.class.security_check
|
74
|
-
parse_args
|
66
|
+
def render_impl # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
67
|
+
setup
|
75
68
|
path = JekyllPluginHelper.expand_env(@filename)
|
76
|
-
|
77
69
|
case path
|
78
70
|
when /\A\// # Absolute path
|
79
|
-
return denied("Access to
|
71
|
+
return denied("Access to <code>#{path}</code> denied by <code>FLEXIBLE_INCLUDE_PATHS</code> value.") unless self.class.access_allowed(path)
|
80
72
|
|
81
73
|
@logger.debug { "Absolute path=#{path}, @filename=#{@filename}" }
|
82
74
|
when /\A~/ # Relative path to user's home directory
|
83
|
-
return denied("Access to
|
75
|
+
return denied("Access to <code>#{path}</code> denied by <code>FLEXIBLE_INCLUDE_PATHS</code> value.") unless self.class.access_allowed(path)
|
84
76
|
|
85
77
|
@logger.debug { "User home start @filename=#{@filename}, path=#{path}" }
|
86
78
|
@filename = @filename.delete_prefix '~/'
|
@@ -99,19 +91,49 @@ class FlexibleInclude < JekyllSupport::JekyllTag
|
|
99
91
|
@logger.debug { "Relative end @filename=#{@filename}, path=#{path}" }
|
100
92
|
end
|
101
93
|
render_completion(path, contents)
|
102
|
-
|
103
|
-
|
94
|
+
rescue Errno::EACCES => e
|
95
|
+
msg = format_error_message e.message
|
96
|
+
@logger.error msg
|
97
|
+
raise FlexibleIncludeError, msg, [] if @die_on_file_error
|
98
|
+
|
99
|
+
"<span class='flexible_error'>FlexibleIncludeError: #{msg}</span>"
|
100
|
+
rescue Errno::ENOENT => e
|
101
|
+
msg = format_error_message e.message
|
102
|
+
@logger.error msg
|
103
|
+
raise FlexibleIncludeError, msg, [] if @die_on_path_denied
|
104
|
+
|
105
|
+
"<span class='flexible_error'>FlexibleIncludeError: #{msg}</span>"
|
106
|
+
rescue FlexibleIncludeError => e
|
107
|
+
@logger.error e.message
|
108
|
+
raise e
|
109
|
+
rescue StandardError => e
|
110
|
+
msg = format_error_message e.message
|
111
|
+
@logger.error msg
|
112
|
+
raise FlexibleIncludeError, msg, [] if @die_on_other_error
|
113
|
+
|
114
|
+
"<span class='flexible_error'>FlexibleIncludeError: #{msg}</span>"
|
104
115
|
end
|
105
116
|
|
106
117
|
private
|
107
118
|
|
119
|
+
class << self
|
120
|
+
include FlexibleClassMethods
|
121
|
+
end
|
122
|
+
|
108
123
|
def denied(msg)
|
109
|
-
|
110
|
-
"
|
124
|
+
msg_no_html = remove_html_tags(msg)
|
125
|
+
@logger.error("#{@page['path']} - #{msg_no_html}")
|
126
|
+
raise FlexibleIncludeError, "#{@page['path']} - #{msg_no_html.red}", [] if @die_on_path_denied
|
127
|
+
|
128
|
+
"<p class='flexible_error'>#{msg}</p>"
|
129
|
+
end
|
130
|
+
|
131
|
+
def format_error_message(message)
|
132
|
+
"#{message} on line #{@line_number} (after front matter) of #{@page['path']}}"
|
111
133
|
end
|
112
134
|
|
113
135
|
def highlight(content, pattern)
|
114
|
-
content.gsub(Regexp
|
136
|
+
content.gsub(Regexp.new(pattern), "<span class='bg_yellow'>\\0</span>")
|
115
137
|
end
|
116
138
|
|
117
139
|
def parse_args
|
@@ -138,18 +160,19 @@ class FlexibleInclude < JekyllSupport::JekyllTag
|
|
138
160
|
@logger.debug("@filename=#{@filename}")
|
139
161
|
end
|
140
162
|
|
141
|
-
|
142
|
-
File.read(file)
|
143
|
-
end
|
144
|
-
|
163
|
+
# Not used, delete
|
145
164
|
def realpath_prefixed_with?(path, dir)
|
146
165
|
File.exist?(path) && File.realpath(path).start_with?(dir)
|
147
|
-
rescue StandardError
|
148
|
-
|
166
|
+
rescue StandardError => _e
|
167
|
+
raise FlexibleIncludeError, remove_html_tags(e.message).red, [] if @die_on_file_error
|
168
|
+
end
|
169
|
+
|
170
|
+
def remove_html_tags(string)
|
171
|
+
string.gsub(/<[^>]*>/, '')
|
149
172
|
end
|
150
173
|
|
151
174
|
def render_completion(path, contents)
|
152
|
-
contents ||=
|
175
|
+
contents ||= File.read(path)
|
153
176
|
contents.strip! if @strip
|
154
177
|
contents2 = @do_not_escape ? contents : FlexibleClassMethods.escape_html(contents)
|
155
178
|
contents2 = highlight(contents2, @highlight_pattern) if @highlight_pattern
|
@@ -158,8 +181,40 @@ class FlexibleInclude < JekyllSupport::JekyllTag
|
|
158
181
|
end
|
159
182
|
|
160
183
|
def run(cmd)
|
161
|
-
|
184
|
+
if cmd.empty?
|
185
|
+
msg = format_error_message 'FlexibleIncludeError: Empty command string'
|
186
|
+
@do_not_escape = true
|
187
|
+
return "<span class='flexible_error'>#{msg}</span>" unless @die_on_other_error
|
188
|
+
|
189
|
+
raise FlexibleIncludeError, msg, []
|
190
|
+
end
|
191
|
+
|
192
|
+
@logger.debug { "Executing #{cmd}" }
|
162
193
|
%x[#{cmd}].chomp
|
194
|
+
rescue FlexibleIncludeError => e
|
195
|
+
raise e
|
196
|
+
rescue StandardError => e
|
197
|
+
msg = format_error_message "#{e.class}: #{e.message.strip}"
|
198
|
+
@logger.error msg
|
199
|
+
@do_not_escape = true
|
200
|
+
return "<span class='flexible_error'>#{msg}</span>" unless @die_on_run_error
|
201
|
+
|
202
|
+
e.set_backtrace []
|
203
|
+
raise e
|
204
|
+
end
|
205
|
+
|
206
|
+
def setup
|
207
|
+
self.class.security_check
|
208
|
+
|
209
|
+
config = @config[JekyllFlexibleIncludeName::PLUGIN_NAME]
|
210
|
+
if config
|
211
|
+
@die_on_file_error = config['die_on_file_error'] == true
|
212
|
+
@die_on_other_error = config['die_on_other_error'] == true
|
213
|
+
@die_on_path_denied = config['die_on_path_denied'] == true
|
214
|
+
@die_on_run_error = config['die_on_run_error'] == true
|
215
|
+
end
|
216
|
+
|
217
|
+
parse_args
|
163
218
|
end
|
164
219
|
|
165
220
|
PREFIX = "<button class='copyBtn' data-clipboard-target=".freeze
|
data/lib/git_util.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rugged'
|
2
|
+
|
3
|
+
class GitFileReader
|
4
|
+
def initialize(repo_dir = '.')
|
5
|
+
@repo = Rugged::Repository.new repo_dir
|
6
|
+
end
|
7
|
+
|
8
|
+
def blob_at(ref, path)
|
9
|
+
commit = @repo.rev_parse ref # Rugged::Commit
|
10
|
+
@repo.blob_at(commit.oid, path) # Rugged::Blob
|
11
|
+
end
|
12
|
+
|
13
|
+
def commit_for_ref(ref)
|
14
|
+
reference = @repo.ref ref # Rugged::Reference
|
15
|
+
abort "Error: #{ref} is an invalid ref" if reference.nil?
|
16
|
+
|
17
|
+
reference_direct = reference.type == :symbolic ? reference.target : reference
|
18
|
+
@commit = reference_direct.target # Rugged::Commit
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return content of desired file
|
23
|
+
def contents(filename)
|
24
|
+
abort('Error: @commit is undefined; invoke commit_for_ref before invoking contents') if @commit.nil?
|
25
|
+
|
26
|
+
tree = @commit.tree # Rugged::Tree
|
27
|
+
entry = tree.get_entry filename # hash
|
28
|
+
abort("Error: #{filename} is not present in commit #{commit.oid}") if entry.nil?
|
29
|
+
|
30
|
+
sha = entry[:oid] # String
|
31
|
+
object = @repo.read sha # Rugged::ObdObject; this is a blob
|
32
|
+
object.data # String
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
if $PROGRAM_NAME == __FILE__
|
37
|
+
puts GitFileReader.new('.').blob_at('HEAD~2', 'README.md').content
|
38
|
+
# puts GitFileReader.new('.').commit_for_ref('HEAD^').contents('README.md')
|
39
|
+
# puts GitFileReader.new('.').commit_for_ref('HEAD').contents('README.md')
|
40
|
+
# puts GitFileReader.new('.').commit_for_ref('refs/heads/master').contents('README.md')
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_flexible_include
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jekyll_plugin_support
|
@@ -26,6 +26,20 @@ dependencies:
|
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 0.5.1
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rugged
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
29
43
|
description: |
|
30
44
|
Jekyll's built-in include tag only supports including files within the _includes folder.
|
31
45
|
This plugin supports 4 types of includes: absolute filenames,
|
@@ -45,7 +59,8 @@ files:
|
|
45
59
|
- jekyll_flexible_include_plugin.gemspec
|
46
60
|
- lib/flexible_include.rb
|
47
61
|
- lib/flexible_include/version.rb
|
48
|
-
-
|
62
|
+
- lib/git_util.rb
|
63
|
+
- spec/flexible_include_spec.rb
|
49
64
|
- spec/spec_helper.rb
|
50
65
|
- spec/status_persistence.txt
|
51
66
|
homepage: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#flexibleInclude
|
@@ -81,7 +96,7 @@ specification_version: 4
|
|
81
96
|
summary: Jekyll plugin supports various ways to include content into the generated
|
82
97
|
site.
|
83
98
|
test_files:
|
84
|
-
- spec/
|
99
|
+
- spec/flexible_include_spec.rb
|
85
100
|
- spec/spec_helper.rb
|
86
101
|
- spec/status_persistence.txt
|
87
102
|
...
|
File without changes
|