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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ca7dd03b5aa971d3b28ea66a4085fb8ed638d868
4
- data.tar.gz: 1e389ea8b3cc7eaf1e4439644448144acc7b3b69
2
+ SHA256:
3
+ metadata.gz: 3f60a37f7ac53d9e2d667fa4f7cb5f36c875915ae9f7dbda6dad5e104d78fad0
4
+ data.tar.gz: 29139c36b99215e07b27297436b16e6aa8eee0f6689b79c967d62fbde4739c5a
5
5
  SHA512:
6
- metadata.gz: 50517ee387e77ab7207828b89ac578b074ddbb4f9b0bb6d48741aefd2c5833492e0c8d006587c7640b70c3f48517ff237e3f170cc7d3af220964afff8d1a0ac6
7
- data.tar.gz: a3bd134c5850750fdab39aad27e6126d895ab0ca1358e592e39027b05e201439f968a608aa99a51208356f62916b75ff039c9291c44da26bc6df66c895858c79
6
+ metadata.gz: 9a0a06408311b21cd36b37bd80f6aafe87b8883b3e93d4450a28882d49ed68f8a50c6fea04229520c5eb0795f31f46856ddae1461297a9e39da7d8a8c9285fae
7
+ data.tar.gz: 61e0704b9cbe398b4671e4b41a15562586bfedaacbf5dbb01e42695109d91244ac5325514b115f3a1ef54b7299d9b7d8bdb11d9b414dd1ea4cd2b568bcbf5979
data/.rubocop.yml CHANGED
@@ -5,3 +5,14 @@ AllCops:
5
5
 
6
6
  Metrics/LineLength:
7
7
  Max: 100
8
+ Exclude:
9
+ - 'test/**/*'
10
+
11
+ Metrics/MethodLength:
12
+ Enabled: false
13
+
14
+ Metrics/AbcSize:
15
+ Enabled: false
16
+
17
+ Metrics/ClassLength:
18
+ Enabled: false
data/jekyll-toc.gemspec CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'minitest', '~> 5.0'
26
26
  spec.add_development_dependency 'pry'
27
27
  spec.add_development_dependency 'rake'
28
+ spec.add_development_dependency 'rubocop'
28
29
  end
@@ -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(%(<a id="#{entry[:id]}#{entry[:uniq]}" class="anchor" href="##{entry[:id]}#{entry[:uniq]}" aria-hidden="true"><span class="octicon octicon-link"></span></a>))
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
- if i + 1 < entries.count
94
- next_entry = entries[i + 1]
95
- if next_entry[:h_num] > min_h_num
96
- nest_entries = get_nest_entries(entries[i + 1, 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
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllToc
4
- VERSION = '0.9.0.beta2'
4
+ VERSION = '0.9.0'
5
5
  end
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.beta2
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-19 00:00:00.000000000 Z
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: 1.3.1
173
+ version: '0'
160
174
  requirements: []
161
175
  rubyforge_project:
162
- rubygems_version: 2.5.2.3
176
+ rubygems_version: 2.7.6
163
177
  signing_key:
164
178
  specification_version: 4
165
179
  summary: Jekyll Table of Contents plugin