jekyll-toc 0.9.0.beta2 → 0.9.0
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 +5 -5
- data/.rubocop.yml +11 -0
- data/jekyll-toc.gemspec +1 -0
- data/lib/table_of_contents/parser.rb +12 -9
- data/lib/version.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f60a37f7ac53d9e2d667fa4f7cb5f36c875915ae9f7dbda6dad5e104d78fad0
|
4
|
+
data.tar.gz: 29139c36b99215e07b27297436b16e6aa8eee0f6689b79c967d62fbde4739c5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a0a06408311b21cd36b37bd80f6aafe87b8883b3e93d4450a28882d49ed68f8a50c6fea04229520c5eb0795f31f46856ddae1461297a9e39da7d8a8c9285fae
|
7
|
+
data.tar.gz: 61e0704b9cbe398b4671e4b41a15562586bfedaacbf5dbb01e42695109d91244ac5325514b115f3a1ef54b7299d9b7d8bdb11d9b414dd1ea4cd2b568bcbf5979
|
data/.rubocop.yml
CHANGED
data/jekyll-toc.gemspec
CHANGED
@@ -39,7 +39,9 @@ module Jekyll
|
|
39
39
|
|
40
40
|
def inject_anchors_into_html
|
41
41
|
@entries.each do |entry|
|
42
|
-
entry[:content_node].add_previous_sibling(
|
42
|
+
entry[:content_node].add_previous_sibling(
|
43
|
+
%(<a id="#{entry[:id]}#{entry[:uniq]}" class="anchor" href="##{entry[:id]}#{entry[:uniq]}" aria-hidden="true"><span class="octicon octicon-link"></span></a>)
|
44
|
+
)
|
43
45
|
end
|
44
46
|
|
45
47
|
@doc.inner_html
|
@@ -85,18 +87,15 @@ module Jekyll
|
|
85
87
|
|
86
88
|
while i < entries.count
|
87
89
|
entry = entries[i]
|
88
|
-
ul_attributes = @sublist_class.empty? ? '' : %( class="#{@sublist_class}")
|
89
90
|
if entry[:h_num] == min_h_num
|
90
91
|
# If the current entry should not be indented in the list, add the entry to the list
|
91
92
|
toc_list << %(<li class="#{@item_class} #{@item_prefix}#{entry[:node_name]}"><a href="##{entry[:id]}#{entry[:uniq]}">#{entry[:text]}</a>)
|
92
93
|
# If the next entry should be indented in the list, generate a sublist
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
i += nest_entries.count
|
99
|
-
end
|
94
|
+
next_i = i + 1
|
95
|
+
if next_i < entries.count && entries[next_i][:h_num] > min_h_num
|
96
|
+
nest_entries = get_nest_entries(entries[next_i, entries.count], min_h_num)
|
97
|
+
toc_list << %(\n<ul#{ul_attributes}>\n#{build_toc_list(nest_entries)}</ul>\n)
|
98
|
+
i += nest_entries.count
|
100
99
|
end
|
101
100
|
# Add the closing tag for the current entry in the list
|
102
101
|
toc_list << %(</li>\n)
|
@@ -136,6 +135,10 @@ module Jekyll
|
|
136
135
|
rescue TypeError
|
137
136
|
DEFAULT_CONFIG
|
138
137
|
end
|
138
|
+
|
139
|
+
def ul_attributes
|
140
|
+
@ul_attributes ||= @sublist_class.empty? ? '' : %( class="#{@sublist_class}")
|
141
|
+
end
|
139
142
|
end
|
140
143
|
end
|
141
144
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-toc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.0
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toshimaru
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-10-
|
12
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
112
126
|
description: A liquid filter plugin for Jekyll which generates a table of contents.
|
113
127
|
email: me@toshimaru.net
|
114
128
|
executables: []
|
@@ -154,12 +168,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
168
|
version: '2.3'
|
155
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - "
|
171
|
+
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: '0'
|
160
174
|
requirements: []
|
161
175
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.7.6
|
163
177
|
signing_key:
|
164
178
|
specification_version: 4
|
165
179
|
summary: Jekyll Table of Contents plugin
|