jekyll_outline 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/jekyll_outline.gemspec +1 -1
- data/lib/jekyll_outline/version.rb +1 -1
- data/lib/jekyll_outline.rb +0 -5
- data/lib/outline_js.rb +3 -3
- data/lib/outline_tag.rb +22 -6
- data/spec/outline_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296c5201e11daec7ec2e91ae703662ba44cfb7ca592da27adf61c23943a3c100
|
4
|
+
data.tar.gz: 246e14ecb99ecf5a7510e7bcbd40eb5cfa58eb8e3cd740f33a726bc7b42cda78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3667c2afb14fb58fb6192149d51265ea54cbb745968ce0a04ba208bbf7a1cf807994a2f2057d38a57759d5679a89ac2a69cd52f829b1e61034c7daea158d02f
|
7
|
+
data.tar.gz: 04e34bcdd95b84affb8b9a73e7a638c9013bc978ba393d11591772a132e4191237c168374fc6d203ce51525945a76350c2f79e6b31f140723f988296678c2585
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.2.4 / 2024-07-23
|
4
|
+
|
5
|
+
* Updated dependencies to rely on current `jekyll_draft`.
|
6
|
+
* Removes any leading whitespace in plugin content so the YAML is more likely to be well-formed.
|
7
|
+
* Handles poorly formed whitespace gracefully.
|
8
|
+
|
9
|
+
|
3
10
|
## 1.2.3 / 2024-07-23
|
4
11
|
|
5
12
|
* Made compatible with jekyll_plugin_support v1.0.0
|
data/jekyll_outline.gemspec
CHANGED
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.version = JekyllOutlineVersion::VERSION
|
36
36
|
|
37
37
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
38
|
-
spec.add_dependency 'jekyll_draft', '>=
|
38
|
+
spec.add_dependency 'jekyll_draft', '>= 2.0.2'
|
39
39
|
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.0'
|
40
40
|
end
|
data/lib/jekyll_outline.rb
CHANGED
data/lib/outline_js.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'jekyll_plugin_support'
|
2
2
|
require_relative 'jekyll_outline/version'
|
3
3
|
|
4
|
-
module
|
4
|
+
module JekyllSupport
|
5
5
|
PLUGIN_JS_NAME = 'outline_js'.freeze
|
6
6
|
|
7
|
-
class OutlineJsTag <
|
7
|
+
class OutlineJsTag < JekyllTag
|
8
8
|
include JekyllOutlineVersion
|
9
9
|
|
10
10
|
def render_impl
|
@@ -35,6 +35,6 @@ module OutlineJsTag
|
|
35
35
|
.join("\n")
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
JekyllPluginHelper.register(self, PLUGIN_JS_NAME)
|
39
39
|
end
|
40
40
|
end
|
data/lib/outline_tag.rb
CHANGED
@@ -33,8 +33,9 @@ require_relative 'jekyll_outline/version'
|
|
33
33
|
#
|
34
34
|
# Subclasses, such as jekyll_toc.rb, might generate other output.
|
35
35
|
|
36
|
-
module
|
36
|
+
module JekyllSupport
|
37
37
|
PLUGIN_NAME = 'outline'.freeze
|
38
|
+
OutlineError = JekyllSupport.define_error
|
38
39
|
|
39
40
|
# Interleaves with docs
|
40
41
|
# Duck type compatible with Jekyll doc
|
@@ -52,7 +53,7 @@ module OutlineTag
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
|
-
class OutlineTag <
|
56
|
+
class OutlineTag < JekyllBlock # rubocop:disable Metrics/ClassLength
|
56
57
|
include JekyllOutlineVersion
|
57
58
|
|
58
59
|
FIXNUM_MAX = (2**((0.size * 8) - 2)) - 1
|
@@ -64,7 +65,7 @@ module OutlineTag
|
|
64
65
|
@fields = @helper.parameter_specified?('fields')&.split || ['title']
|
65
66
|
@sort_by = @helper.parameter_specified?('sort_by_title') ? 'title' : 'order'
|
66
67
|
@collection_name = @helper.remaining_markup
|
67
|
-
|
68
|
+
raise OutlineError, 'collection_name was not specified' unless @collection_name
|
68
69
|
|
69
70
|
@docs = obtain_docs(@collection_name)
|
70
71
|
collection = headers + @docs
|
@@ -90,12 +91,19 @@ module OutlineTag
|
|
90
91
|
end
|
91
92
|
|
92
93
|
def make_headers(content)
|
93
|
-
|
94
|
+
content = remove_leading_zeros remove_leading_spaces content
|
95
|
+
yaml = YAML.safe_load content
|
94
96
|
yaml.map { |entry| Header.new entry }
|
97
|
+
rescue NoMethodError => e
|
98
|
+
raise OutlineError, "Invalid YAML within {% outline %} tag;<br>\nNoMethodError #{e.message}"
|
99
|
+
rescue Psych::SyntaxError => e
|
100
|
+
raise OutlineError, "Invalid YAML within {% outline %} tag;<br>\nPsych::SyntaxError #{e.message}"
|
101
|
+
rescue StandardError => e
|
102
|
+
raise OutlineError, e.message
|
95
103
|
end
|
96
104
|
|
97
105
|
# @section_state can have values: :head, :in_body
|
98
|
-
# @param collection Array of Jekyll::Document and
|
106
|
+
# @param collection Array of Jekyll::Document and JekyllSupport::Header
|
99
107
|
# @return Array of String
|
100
108
|
def make_entries(collection)
|
101
109
|
sorted = if @sort_by == 'order'
|
@@ -210,6 +218,14 @@ module OutlineTag
|
|
210
218
|
array
|
211
219
|
end
|
212
220
|
|
221
|
+
def remove_leading_spaces(multiline)
|
222
|
+
multiline
|
223
|
+
.strip
|
224
|
+
.split("\n")
|
225
|
+
.map { |x| x.gsub(/\A\s+/, '') }
|
226
|
+
.join("\n")
|
227
|
+
end
|
228
|
+
|
213
229
|
def remove_leading_zeros(multiline)
|
214
230
|
multiline
|
215
231
|
.strip
|
@@ -218,6 +234,6 @@ module OutlineTag
|
|
218
234
|
.join("\n")
|
219
235
|
end
|
220
236
|
|
221
|
-
|
237
|
+
JekyllPluginHelper.register(self, PLUGIN_NAME)
|
222
238
|
end
|
223
239
|
end
|
data/spec/outline_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_outline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.0.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jekyll_plugin_support
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|