jekyll_outline 1.2.3 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/jekyll_outline.gemspec +2 -2
- 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 +39 -6
- data/spec/outline_spec.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a31ba9e3b1f1b0962f5ac28695f41b2594acde555195fdcbbf0460fa220be66e
|
4
|
+
data.tar.gz: bdd1e6536607a24271019aa3cc24e5de35e71b1ac4c61b925f286bb41dd5521c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e815455631865429afb66cfffce54187e4696e0ecb7e3571050ab98fa6991bd679791a212cdc9915b4e9a9d0c199bf6af0ca9d77a09babe89d7d5fa83a88fa4d
|
7
|
+
data.tar.gz: bcc3910b01ca8d3c99ed101764350f17c95826f3b375733215f35659a6027605452881b528197709d1143b576c7c52cf2b51aad3971c1781b03b97c414f8d1dc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.2.5 / 2024-08-20
|
4
|
+
|
5
|
+
* Added configurable error handling
|
6
|
+
* Updated to jekyll_plugin_support v1.0.2
|
7
|
+
* Defined `outline_error` CSS class in `demo/assets/css/jekyll_outline.css`.
|
8
|
+
|
9
|
+
|
10
|
+
## 1.2.4 / 2024-07-23
|
11
|
+
|
12
|
+
* Updated dependencies to rely on current `jekyll_draft`.
|
13
|
+
* Removes any leading whitespace in plugin content so the YAML is more likely to be well-formed.
|
14
|
+
* Handles poorly formed whitespace gracefully.
|
15
|
+
|
16
|
+
|
3
17
|
## 1.2.3 / 2024-07-23
|
4
18
|
|
5
19
|
* 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', '>=
|
39
|
-
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.
|
38
|
+
spec.add_dependency 'jekyll_draft', '>= 2.0.2'
|
39
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.2'
|
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
|
@@ -61,14 +62,24 @@ module OutlineTag
|
|
61
62
|
headers = make_headers(super) # Process the block content.
|
62
63
|
|
63
64
|
@helper.gem_file __FILE__
|
65
|
+
|
66
|
+
@die_on_outline_error = @tag_config['die_on_outline_error'] == true if @tag_config
|
67
|
+
@pry_on_outline_error = @tag_config['pry_on_outline_error'] == true if @tag_config
|
68
|
+
|
64
69
|
@fields = @helper.parameter_specified?('fields')&.split || ['title']
|
65
70
|
@sort_by = @helper.parameter_specified?('sort_by_title') ? 'title' : 'order'
|
66
71
|
@collection_name = @helper.remaining_markup
|
67
|
-
|
72
|
+
raise OutlineError, 'collection_name was not specified' unless @collection_name
|
68
73
|
|
69
74
|
@docs = obtain_docs(@collection_name)
|
70
75
|
collection = headers + @docs
|
71
76
|
render_outline collection
|
77
|
+
rescue OutlineError => e # jekyll_plugin_support handles StandardError
|
78
|
+
@logger.error { JekyllPluginHelper.remove_html_tags e.logger_message }
|
79
|
+
binding.pry if @pry_on_outline_error # rubocop:disable Lint/Debugger
|
80
|
+
exit! 1 if @die_on_outline_error
|
81
|
+
|
82
|
+
e.html_message
|
72
83
|
end
|
73
84
|
|
74
85
|
# Overload this for a subclass
|
@@ -90,12 +101,26 @@ module OutlineTag
|
|
90
101
|
end
|
91
102
|
|
92
103
|
def make_headers(content)
|
93
|
-
|
104
|
+
content = remove_leading_zeros remove_leading_spaces content
|
105
|
+
yaml = YAML.safe_load content
|
94
106
|
yaml.map { |entry| Header.new entry }
|
107
|
+
rescue NoMethodError => e
|
108
|
+
raise OutlineError, <<~END_MSG
|
109
|
+
Invalid YAML within {% outline %} tag. The offending content was:
|
110
|
+
|
111
|
+
<pre>#{content}</pre>
|
112
|
+
END_MSG
|
113
|
+
rescue Psych::SyntaxError => e
|
114
|
+
msg = <<~END_MSG
|
115
|
+
Invalid YAML found within {% outline %} tag:<br>
|
116
|
+
<pre>#{e.message}</pre>
|
117
|
+
END_MSG
|
118
|
+
@logger.error { e.message }
|
119
|
+
raise OutlineError, msg
|
95
120
|
end
|
96
121
|
|
97
122
|
# @section_state can have values: :head, :in_body
|
98
|
-
# @param collection Array of Jekyll::Document and
|
123
|
+
# @param collection Array of Jekyll::Document and JekyllSupport::Header
|
99
124
|
# @return Array of String
|
100
125
|
def make_entries(collection)
|
101
126
|
sorted = if @sort_by == 'order'
|
@@ -210,6 +235,14 @@ module OutlineTag
|
|
210
235
|
array
|
211
236
|
end
|
212
237
|
|
238
|
+
def remove_leading_spaces(multiline)
|
239
|
+
multiline
|
240
|
+
.strip
|
241
|
+
.split("\n")
|
242
|
+
.map { |x| x.gsub(/\A\s+/, '') }
|
243
|
+
.join("\n")
|
244
|
+
end
|
245
|
+
|
213
246
|
def remove_leading_zeros(multiline)
|
214
247
|
multiline
|
215
248
|
.strip
|
@@ -218,6 +251,6 @@ module OutlineTag
|
|
218
251
|
.join("\n")
|
219
252
|
end
|
220
253
|
|
221
|
-
|
254
|
+
JekyllPluginHelper.register(self, PLUGIN_NAME)
|
222
255
|
end
|
223
256
|
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.5
|
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-
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -30,28 +30,28 @@ 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
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0.
|
47
|
+
version: 1.0.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0.
|
54
|
+
version: 1.0.2
|
55
55
|
description: 'Jekyll tag plugin that creates a clickable table of contents.
|
56
56
|
|
57
57
|
'
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.5.
|
105
|
+
rubygems_version: 3.5.17
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Jekyll tag plugin that creates a clickable table of contents.
|