jekyll_from_to_until 1.0.1 → 1.0.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 +4 -4
- data/.rubocop.yml +95 -6
- data/CHANGELOG.md +4 -0
- data/README.md +38 -12
- data/Rakefile +1 -3
- data/jekyll_from_to_until.gemspec +19 -29
- data/lib/jekyll_from_to_until/version.rb +1 -3
- data/lib/jekyll_from_to_until.rb +13 -13
- data/spec/from_to_until_spec.rb +0 -2
- data/spec/spec_helper.rb +0 -2
- metadata +6 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae2bab81284396893b6c47b1bd67c4e95c95f2d44ed2521405eb1ce8905d05f8
|
|
4
|
+
data.tar.gz: 98decead66f66d2a77dc55e752ee6d2a17cb947adbd259783a5e992f32b95480
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 881d77fdb20184c3062ee5da4faf129bb8a0e7bac2311308de006f63ace6183906075b19a886e84f1814ed6dbd00bd53faba10bcba4e6d95af27efadce0e86fd
|
|
7
|
+
data.tar.gz: 2220e933a40ec1a17231c21f7d620e1734bad5402147dc5f5ddeb5961246ef7a9bb84637b0836a5be0b1a7f6dd299c2653d81732752a14e3681490c66ec5604c
|
data/.rubocop.yml
CHANGED
|
@@ -1,16 +1,105 @@
|
|
|
1
|
-
require:
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
require:
|
|
2
|
+
# - rubocop-jekyll
|
|
3
|
+
- rubocop-md
|
|
4
|
+
- rubocop-performance
|
|
5
|
+
- rubocop-rake
|
|
6
|
+
- rubocop-rspec
|
|
7
|
+
|
|
8
|
+
# inherit_gem:
|
|
9
|
+
# rubocop-jekyll: .rubocop.yml
|
|
4
10
|
|
|
5
11
|
AllCops:
|
|
6
12
|
Exclude:
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
- demo/_site/**/*
|
|
14
|
+
- exe/**/*
|
|
15
|
+
- vendor/**/*
|
|
16
|
+
- Gemfile*
|
|
9
17
|
NewCops: enable
|
|
10
18
|
TargetRubyVersion: 2.6
|
|
11
19
|
|
|
20
|
+
Gemspec/DeprecatedAttributeAssignment:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
Gemspec/RequireMFA:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
Layout/InitialIndentation:
|
|
27
|
+
Exclude:
|
|
28
|
+
- README.md
|
|
29
|
+
|
|
30
|
+
Layout/HashAlignment:
|
|
31
|
+
EnforcedColonStyle: table
|
|
32
|
+
Exclude:
|
|
33
|
+
- jekyll_from_to_until.gemspec
|
|
34
|
+
|
|
12
35
|
Layout/LineLength:
|
|
13
36
|
Max: 150
|
|
14
37
|
|
|
15
|
-
Layout/
|
|
38
|
+
Layout/MultilineMethodCallIndentation:
|
|
39
|
+
Enabled: false
|
|
40
|
+
|
|
41
|
+
Lint/RedundantCopDisableDirective:
|
|
42
|
+
Exclude:
|
|
43
|
+
- jekyll_from_to_until.gemspec
|
|
44
|
+
|
|
45
|
+
Metrics/AbcSize:
|
|
46
|
+
Max: 45
|
|
47
|
+
|
|
48
|
+
Metrics/BlockLength:
|
|
49
|
+
Exclude:
|
|
50
|
+
- jekyll_from_to_until.gemspec
|
|
51
|
+
- spec/**/*
|
|
52
|
+
|
|
53
|
+
Metrics/ClassLength:
|
|
54
|
+
Exclude:
|
|
55
|
+
- spec/**/*
|
|
56
|
+
|
|
57
|
+
Metrics/CyclomaticComplexity:
|
|
58
|
+
Max: 20
|
|
59
|
+
|
|
60
|
+
Metrics/MethodLength:
|
|
61
|
+
Max: 40
|
|
62
|
+
|
|
63
|
+
Metrics/PerceivedComplexity:
|
|
64
|
+
Max: 15
|
|
65
|
+
|
|
66
|
+
Naming/FileName:
|
|
67
|
+
Exclude:
|
|
68
|
+
- Rakefile
|
|
69
|
+
|
|
70
|
+
RSpec/ExampleLength:
|
|
71
|
+
Max: 20
|
|
72
|
+
|
|
73
|
+
RSpec/MultipleExpectations:
|
|
74
|
+
Max: 15
|
|
75
|
+
|
|
76
|
+
Style/CommandLiteral:
|
|
77
|
+
Enabled: false
|
|
78
|
+
|
|
79
|
+
Style/CommentedKeyword:
|
|
16
80
|
Enabled: false
|
|
81
|
+
|
|
82
|
+
Style/Documentation:
|
|
83
|
+
Enabled: false
|
|
84
|
+
|
|
85
|
+
Style/FrozenStringLiteralComment:
|
|
86
|
+
Enabled: false
|
|
87
|
+
|
|
88
|
+
Style/PercentLiteralDelimiters:
|
|
89
|
+
Enabled: false
|
|
90
|
+
|
|
91
|
+
Style/RegexpLiteral:
|
|
92
|
+
Enabled: false
|
|
93
|
+
|
|
94
|
+
Style/StringConcatenation:
|
|
95
|
+
Exclude:
|
|
96
|
+
- spec/**/*
|
|
97
|
+
|
|
98
|
+
Style/StringLiterals:
|
|
99
|
+
Enabled: false
|
|
100
|
+
|
|
101
|
+
Style/StringLiteralsInInterpolation:
|
|
102
|
+
Enabled: false
|
|
103
|
+
|
|
104
|
+
Style/TrailingCommaInHashLiteral:
|
|
105
|
+
EnforcedStyleForMultiline: comma
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -23,14 +23,10 @@ Add this line to your application's Gemfile:
|
|
|
23
23
|
gem 'jekyll_from_to_until'
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
And then
|
|
26
|
+
And then install in the usual fashion:
|
|
27
27
|
|
|
28
28
|
$ bundle install
|
|
29
29
|
|
|
30
|
-
Or install it yourself as:
|
|
31
|
-
|
|
32
|
-
$ gem install jekyll_from_to_until
|
|
33
|
-
|
|
34
30
|
|
|
35
31
|
## Syntax
|
|
36
32
|
The regular expression may be enclosed in single quotes, double quotes, or nothing.
|
|
@@ -92,7 +88,6 @@ target/
|
|
|
92
88
|
.idea
|
|
93
89
|
.jekyll-cache/
|
|
94
90
|
.jekyll-metadata
|
|
95
|
-
.makeAwsBucketAndDistribution.log
|
|
96
91
|
.sass-cache/
|
|
97
92
|
.yardoc/
|
|
98
93
|
__pycache__/
|
|
@@ -237,7 +232,9 @@ mslinn_aws.tar
|
|
|
237
232
|
```
|
|
238
233
|
|
|
239
234
|
### More Complex Regular Expressions
|
|
240
|
-
The from
|
|
235
|
+
The `from`, `to` and `until` filters can all accept regular expressions.
|
|
236
|
+
The regular expression matches lines that have either the string `sun` or `cloud`
|
|
237
|
+
at the beginning of the line.
|
|
241
238
|
```
|
|
242
239
|
{{ gitignore | from: '^(cloud|sun)' }}
|
|
243
240
|
```
|
|
@@ -259,11 +256,6 @@ You can also run `bin/console` for an interactive prompt that will allow you to
|
|
|
259
256
|
### Build and Install Locally
|
|
260
257
|
To build and install this gem onto your local machine, run:
|
|
261
258
|
```shell
|
|
262
|
-
$ rake install:local
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
The following also does the same thing:
|
|
266
|
-
```shell
|
|
267
259
|
$ bundle exec rake install
|
|
268
260
|
```
|
|
269
261
|
|
|
@@ -283,6 +275,40 @@ jekyll_from_to_until (1.0.0)
|
|
|
283
275
|
Generates Jekyll logger with colored output.
|
|
284
276
|
```
|
|
285
277
|
|
|
278
|
+
## Demo Website
|
|
279
|
+
A test/demo website is provided in the `demo` directory.
|
|
280
|
+
You can run it under a debugger, or let it run free.
|
|
281
|
+
|
|
282
|
+
The `demo/_bin/debug` script can set various parameters for the demo.
|
|
283
|
+
View the help information with the `-h` option:
|
|
284
|
+
```shell
|
|
285
|
+
$ demo/_bin/debug -h
|
|
286
|
+
|
|
287
|
+
debug - Run the demo Jekyll website.
|
|
288
|
+
|
|
289
|
+
By default the demo Jekyll website runs without restriction under ruby-debug-ide and debase.
|
|
290
|
+
View it at http://localhost:4444
|
|
291
|
+
|
|
292
|
+
Options:
|
|
293
|
+
-h Show this error message
|
|
294
|
+
|
|
295
|
+
-r Run freely, without a debugger
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
### Debugging the Demo
|
|
300
|
+
To run under a debugger, for example Visual Studio Code:
|
|
301
|
+
1. Set breakpoints.
|
|
302
|
+
|
|
303
|
+
2. Initiate a debug session from the command line:
|
|
304
|
+
```shell
|
|
305
|
+
$ demo/bin/debug
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
3. Once the `Fast Debugger` signon appears, launch the Visual Studio Code launch configuration called `Attach rdebug-ide`.
|
|
309
|
+
|
|
310
|
+
4. View the generated website at [`http://localhost:4444`](http://localhost:4444).
|
|
311
|
+
|
|
286
312
|
|
|
287
313
|
### Build and Push to RubyGems
|
|
288
314
|
To release a new version,
|
data/Rakefile
CHANGED
|
@@ -1,47 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative 'lib/jekyll_from_to_until/version'
|
|
2
2
|
|
|
3
|
-
require_relative "lib/jekyll_from_to_until/version"
|
|
4
|
-
|
|
5
|
-
# rubocop:disable Metrics/BlockLength
|
|
6
3
|
Gem::Specification.new do |spec|
|
|
7
|
-
github =
|
|
4
|
+
github = 'https://github.com/mslinn/jekyll_from_to_until'
|
|
8
5
|
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.bindir =
|
|
6
|
+
spec.authors = ['Mike Slinn']
|
|
7
|
+
spec.bindir = 'exe'
|
|
11
8
|
spec.description = <<~END_DESC
|
|
12
9
|
This Jekyll plugin provides 3 filters that return portions of a multiline string: from, to and until.
|
|
13
10
|
Regular expression is used to specify matches; the simplest regular expression is a string.
|
|
14
11
|
END_DESC
|
|
15
|
-
spec.email = [
|
|
16
|
-
spec.files = Dir[
|
|
17
|
-
spec.homepage =
|
|
18
|
-
spec.license =
|
|
12
|
+
spec.email = ['mslinn@mslinn.com']
|
|
13
|
+
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
|
14
|
+
spec.homepage = 'https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#from_to_until'
|
|
15
|
+
spec.license = 'MIT'
|
|
19
16
|
spec.metadata = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
'allowed_push_host' => 'https://rubygems.org',
|
|
18
|
+
'bug_tracker_uri' => "#{github}/issues",
|
|
19
|
+
'changelog_uri' => "#{github}/CHANGELOG.md",
|
|
20
|
+
'homepage_uri' => spec.homepage,
|
|
21
|
+
'source_code_uri' => github,
|
|
25
22
|
}
|
|
26
|
-
spec.name =
|
|
23
|
+
spec.name = 'jekyll_from_to_until'
|
|
27
24
|
spec.post_install_message = <<~END_MESSAGE
|
|
28
25
|
|
|
29
26
|
Thanks for installing #{spec.name}!
|
|
30
27
|
|
|
31
28
|
END_MESSAGE
|
|
32
|
-
spec.require_paths = [
|
|
33
|
-
spec.required_ruby_version =
|
|
34
|
-
spec.summary =
|
|
29
|
+
spec.require_paths = ['lib']
|
|
30
|
+
spec.required_ruby_version = '>= 2.6.0'
|
|
31
|
+
spec.summary = 'This Jekyll plugin provides 3 filters that return portions of a multiline string: from, to and until.'
|
|
35
32
|
spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
|
|
36
33
|
spec.version = JekyllFromToUntilVersion::VERSION
|
|
37
34
|
|
|
38
|
-
spec.add_dependency
|
|
39
|
-
spec.add_dependency
|
|
40
|
-
|
|
41
|
-
spec.add_development_dependency "debase"
|
|
42
|
-
# spec.add_development_dependency "rubocop-jekyll"
|
|
43
|
-
# spec.add_development_dependency "rubocop-rake"
|
|
44
|
-
# spec.add_development_dependency "rubocop-rspec"
|
|
45
|
-
spec.add_development_dependency "ruby-debug-ide"
|
|
35
|
+
spec.add_dependency 'jekyll', '>= 3.5.0'
|
|
36
|
+
spec.add_dependency 'jekyll_plugin_logger'
|
|
46
37
|
end
|
|
47
|
-
# rubocop:enable Metrics/BlockLength
|
data/lib/jekyll_from_to_until.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
1
|
# @author Copyright 2020 Michael Slinn
|
|
4
2
|
# Jekyll filters for working with multiline strings.
|
|
5
3
|
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require_relative
|
|
4
|
+
require 'jekyll_plugin_logger'
|
|
5
|
+
require 'liquid'
|
|
6
|
+
require_relative 'jekyll_from_to_until/version'
|
|
9
7
|
|
|
10
8
|
module JekyllPluginFromToUntilName
|
|
11
|
-
PLUGIN_NAME =
|
|
9
|
+
PLUGIN_NAME = 'jekyll_from_to_until'.freeze
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
module FromToUntil
|
|
15
|
-
|
|
13
|
+
def initialize(_)
|
|
14
|
+
@logger = PluginMetaLogger.instance.new_logger("FromToUntil", PluginMetaLogger.instance.config)
|
|
15
|
+
end
|
|
16
16
|
|
|
17
17
|
# Filters a multiline string, returning the portion beginning with the line that satisfies a regex.
|
|
18
18
|
# The regex could be enclosed in single quotes, double quotes, or nothing.
|
|
@@ -22,11 +22,11 @@ module FromToUntil
|
|
|
22
22
|
# @example Returns remaining lines starting with the line containing the word `module`.
|
|
23
23
|
# {{ flexible_include '/blog/2020/10/03/jekyll-plugins.html' | from 'module' }}
|
|
24
24
|
def from(input_strings, regex)
|
|
25
|
-
return
|
|
25
|
+
return '' unless check_parameters(input_strings, regex)
|
|
26
26
|
|
|
27
27
|
regex = remove_quotations(regex.to_s.strip)
|
|
28
28
|
matched = false
|
|
29
|
-
result =
|
|
29
|
+
result = ''
|
|
30
30
|
input_strings.each_line do |line|
|
|
31
31
|
matched = true if !matched && line =~ %r!#{regex}!
|
|
32
32
|
result += line if matched
|
|
@@ -39,10 +39,10 @@ module FromToUntil
|
|
|
39
39
|
# @example Returns lines up to and including the line containing the word `module`.
|
|
40
40
|
# {{ flexible_include '/blog/2020/10/03/jekyll-plugins.html' | to 'module' }}
|
|
41
41
|
def to(input_strings, regex)
|
|
42
|
-
return
|
|
42
|
+
return '' unless check_parameters(input_strings, regex)
|
|
43
43
|
|
|
44
44
|
regex = remove_quotations(regex.to_s.strip)
|
|
45
|
-
result =
|
|
45
|
+
result = ''
|
|
46
46
|
input_strings.each_line do |line|
|
|
47
47
|
result += line
|
|
48
48
|
return result if line.match?(%r!#{regex}!)
|
|
@@ -55,10 +55,10 @@ module FromToUntil
|
|
|
55
55
|
# @example Returns lines up to but not including the line containing the word `module`.
|
|
56
56
|
# {{ flexible_include '/blog/2020/10/03/jekyll-plugins.html' | until 'module' }}
|
|
57
57
|
def until(input_strings, regex)
|
|
58
|
-
return
|
|
58
|
+
return '' unless check_parameters(input_strings, regex)
|
|
59
59
|
|
|
60
60
|
regex = remove_quotations(regex.to_s.strip)
|
|
61
|
-
result =
|
|
61
|
+
result = ''
|
|
62
62
|
input_strings.each_line do |line|
|
|
63
63
|
return result if line.match?(%r!#{regex}!)
|
|
64
64
|
|
data/spec/from_to_until_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll_from_to_until
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Slinn
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -38,34 +38,6 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: debase
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: ruby-debug-ide
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
41
|
description: |
|
|
70
42
|
This Jekyll plugin provides 3 filters that return portions of a multiline string: from, to and until.
|
|
71
43
|
Regular expression is used to specify matches; the simplest regular expression is a string.
|
|
@@ -112,11 +84,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
84
|
- !ruby/object:Gem::Version
|
|
113
85
|
version: '0'
|
|
114
86
|
requirements: []
|
|
115
|
-
rubygems_version: 3.
|
|
116
|
-
signing_key:
|
|
87
|
+
rubygems_version: 3.3.3
|
|
88
|
+
signing_key:
|
|
117
89
|
specification_version: 4
|
|
118
90
|
summary: 'This Jekyll plugin provides 3 filters that return portions of a multiline
|
|
119
91
|
string: from, to and until.'
|
|
120
92
|
test_files:
|
|
121
93
|
- spec/from_to_until_spec.rb
|
|
122
94
|
- spec/spec_helper.rb
|
|
95
|
+
...
|