jekyll-toc 0.13.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,25 +3,29 @@
3
3
  require 'test_helper'
4
4
 
5
5
  class TestConfiguration < Minitest::Test
6
- def test_default_conf1guration
6
+ def test_default_configuration
7
7
  configuration = Jekyll::TableOfContents::Configuration.new({})
8
8
 
9
- assert_equal configuration.toc_levels, 1..6
10
- assert_equal configuration.no_toc_section_class, 'no_toc_section'
11
- assert_equal configuration.list_class, 'section-nav'
12
- assert_equal configuration.sublist_class, ''
13
- assert_equal configuration.item_class, 'toc-entry'
14
- assert_equal configuration.item_prefix, 'toc-'
9
+ assert_equal(1..6, configuration.toc_levels)
10
+ refute(configuration.ordered_list)
11
+ assert_equal('no_toc_section', configuration.no_toc_section_class)
12
+ assert_equal('toc', configuration.list_id)
13
+ assert_equal('section-nav', configuration.list_class)
14
+ assert_equal('', configuration.sublist_class)
15
+ assert_equal('toc-entry', configuration.item_class)
16
+ assert_equal('toc-', configuration.item_prefix)
15
17
  end
16
18
 
17
19
  def test_type_error
18
20
  configuration = Jekyll::TableOfContents::Configuration.new('TypeError!')
19
21
 
20
- assert_equal configuration.toc_levels, 1..6
21
- assert_equal configuration.no_toc_section_class, 'no_toc_section'
22
- assert_equal configuration.list_class, 'section-nav'
23
- assert_equal configuration.sublist_class, ''
24
- assert_equal configuration.item_class, 'toc-entry'
25
- assert_equal configuration.item_prefix, 'toc-'
22
+ assert_equal(1..6, configuration.toc_levels)
23
+ refute(configuration.ordered_list)
24
+ assert_equal('no_toc_section', configuration.no_toc_section_class)
25
+ assert_equal('toc', configuration.list_id)
26
+ assert_equal('section-nav', configuration.list_class)
27
+ assert_equal('', configuration.sublist_class)
28
+ assert_equal('toc-entry', configuration.item_class)
29
+ assert_equal('toc-', configuration.item_prefix)
26
30
  end
27
31
  end
@@ -20,7 +20,7 @@ SIMPLE_HTML = <<~HTML
20
20
  HTML
21
21
 
22
22
  module TestHelpers
23
- def read_html_and_create_parser
24
- @parser = Jekyll::TableOfContents::Parser.new(SIMPLE_HTML)
23
+ def read_html_and_create_parser(options = {})
24
+ @parser = Jekyll::TableOfContents::Parser.new(SIMPLE_HTML, options)
25
25
  end
26
26
  end
@@ -24,7 +24,7 @@ class TestTableOfContentsFilter < Minitest::Test
24
24
 
25
25
  def test_toc_only2
26
26
  @context = enable_toc_context
27
- assert_equal "<ul class=\"section-nav\">\n</ul>", toc_only(DUMMY_HTML)
27
+ assert_equal %(<ul id="toc" class="section-nav">\n</ul>), toc_only(DUMMY_HTML)
28
28
  end
29
29
 
30
30
  def test_inject_anchors2
@@ -34,7 +34,7 @@ class TestTableOfContentsFilter < Minitest::Test
34
34
 
35
35
  def test_toc2
36
36
  @context = enable_toc_context
37
- assert_equal "<ul class=\"section-nav\">\n</ul>#{DUMMY_HTML}", toc(DUMMY_HTML)
37
+ assert_equal %(<ul id="toc" class="section-nav">\n</ul>#{DUMMY_HTML}), toc(DUMMY_HTML)
38
38
  end
39
39
 
40
40
  private
@@ -36,7 +36,7 @@ class TestKramdownList < Minitest::Test
36
36
  assert_equal(expected, actual)
37
37
  end
38
38
 
39
- def test_kramdown_list_1
39
+ def test_kramdown_list_l1_l5
40
40
  text = <<~MARKDOWN
41
41
  * level-1
42
42
  * level-2
@@ -70,7 +70,7 @@ class TestKramdownList < Minitest::Test
70
70
  assert_equal(expected, actual)
71
71
  end
72
72
 
73
- def test_kramdown_list_2
73
+ def test_kramdown_list_l1_l3_l2_l4
74
74
  text = <<~MARKDOWN
75
75
  * level-1
76
76
  * level-3
@@ -101,7 +101,7 @@ class TestKramdownList < Minitest::Test
101
101
  assert_equal(expected, actual)
102
102
  end
103
103
 
104
- def test_kramdown_list_3
104
+ def test_kramdown_list_l4_l1
105
105
  text = <<~MARKDOWN
106
106
  * level-4
107
107
  * level-3
@@ -118,7 +118,7 @@ class TestKramdownList < Minitest::Test
118
118
  assert_equal(expected, actual)
119
119
  end
120
120
 
121
- def test_kramdown_list_4
121
+ def test_kramdown_list_l1_l4_l1
122
122
  text = <<~MARKDOWN
123
123
  * level-1
124
124
  * level-4
@@ -143,7 +143,7 @@ class TestKramdownList < Minitest::Test
143
143
  assert_equal(expected, actual)
144
144
  end
145
145
 
146
- def test_kramdown_list_5
146
+ def test_kramdown_list_l1_l3_l1
147
147
  text = <<~MARKDOWN
148
148
  * level-1
149
149
  * level-3
@@ -17,7 +17,7 @@ class TestTableOfContentsTag < Minitest::Test
17
17
  site: @stubbed_context1.new({ 'toc' => nil })
18
18
  )
19
19
  tag = Jekyll::TocTag.parse('toc_tag', '', Tokenizer.new(''), ParseContext.new)
20
- assert_equal tag.render(context), "<ul class=\"section-nav\">\n<li class=\"toc-entry toc-h1\"><a href=\"#test\">test</a></li>\n</ul>"
20
+ assert_equal(%(<ul id="toc" class="section-nav">\n<li class="toc-entry toc-h1"><a href="#test">test</a></li>\n</ul>), tag.render(context))
21
21
  end
22
22
 
23
23
  def test_toc_tag_returns_empty_string
metadata CHANGED
@@ -1,148 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-toc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toshimaru
8
8
  - torbjoernk
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-25 00:00:00.000000000 Z
12
+ date: 2020-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: nokogiri
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.9'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '1.9'
28
- - !ruby/object:Gem::Dependency
29
- name: appraisal
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
14
  - !ruby/object:Gem::Dependency
43
15
  name: jekyll
44
16
  requirement: !ruby/object:Gem::Requirement
45
17
  requirements:
46
18
  - - ">="
47
19
  - !ruby/object:Gem::Version
48
- version: '3.7'
49
- type: :development
20
+ version: '3.8'
21
+ type: :runtime
50
22
  prerelease: false
51
23
  version_requirements: !ruby/object:Gem::Requirement
52
24
  requirements:
53
25
  - - ">="
54
26
  - !ruby/object:Gem::Version
55
- version: '3.7'
27
+ version: '3.8'
56
28
  - !ruby/object:Gem::Dependency
57
- name: minitest
29
+ name: nokogiri
58
30
  requirement: !ruby/object:Gem::Requirement
59
31
  requirements:
60
32
  - - "~>"
61
33
  - !ruby/object:Gem::Version
62
- version: '5.11'
63
- type: :development
34
+ version: '1.10'
35
+ type: :runtime
64
36
  prerelease: false
65
37
  version_requirements: !ruby/object:Gem::Requirement
66
38
  requirements:
67
39
  - - "~>"
68
40
  - !ruby/object:Gem::Version
69
- version: '5.11'
70
- - !ruby/object:Gem::Dependency
71
- name: minitest-reporters
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: pry
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- - !ruby/object:Gem::Dependency
99
- name: rake
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
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'
126
- - !ruby/object:Gem::Dependency
127
- name: simplecov
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '0'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
- description: A liquid filter plugin for Jekyll which generates a table of contents.
41
+ version: '1.10'
42
+ description: Jekyll (Ruby static website generator) plugin which generates a Table
43
+ of Contents for the page.
141
44
  email: me@toshimaru.net
142
45
  executables: []
143
46
  extensions: []
144
47
  extra_rdoc_files: []
145
48
  files:
49
+ - ".github/dependabot.yml"
146
50
  - ".github/workflows/ci.yml"
147
51
  - ".github/workflows/coverage.yml"
148
52
  - ".github/workflows/rubocop.yml"
@@ -154,16 +58,19 @@ files:
154
58
  - LICENSE.md
155
59
  - README.md
156
60
  - Rakefile
157
- - gemfiles/jekyll_3.7.gemfile
158
61
  - gemfiles/jekyll_3.8.gemfile
62
+ - gemfiles/jekyll_3.9.gemfile
159
63
  - gemfiles/jekyll_4.0.gemfile
64
+ - gemfiles/jekyll_4.1.gemfile
160
65
  - jekyll-toc.gemspec
161
66
  - lib/jekyll-toc.rb
162
67
  - lib/table_of_contents/configuration.rb
68
+ - lib/table_of_contents/helper.rb
163
69
  - lib/table_of_contents/parser.rb
164
- - lib/version.rb
70
+ - lib/table_of_contents/version.rb
165
71
  - test/parser/test_inject_anchors_filter.rb
166
- - test/parser/test_option_error.rb
72
+ - test/parser/test_invalid_options.rb
73
+ - test/parser/test_ordered_list.rb
167
74
  - test/parser/test_toc_filter.rb
168
75
  - test/parser/test_toc_only_filter.rb
169
76
  - test/parser/test_various_toc_html.rb
@@ -176,7 +83,7 @@ homepage: https://github.com/toshimaru/jekyll-toc
176
83
  licenses:
177
84
  - MIT
178
85
  metadata: {}
179
- post_install_message:
86
+ post_install_message:
180
87
  rdoc_options: []
181
88
  require_paths:
182
89
  - lib
@@ -191,13 +98,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
98
  - !ruby/object:Gem::Version
192
99
  version: '0'
193
100
  requirements: []
194
- rubygems_version: 3.1.2
195
- signing_key:
101
+ rubygems_version: 3.1.4
102
+ signing_key:
196
103
  specification_version: 4
197
104
  summary: Jekyll Table of Contents plugin
198
105
  test_files:
199
106
  - test/parser/test_inject_anchors_filter.rb
200
- - test/parser/test_option_error.rb
107
+ - test/parser/test_invalid_options.rb
108
+ - test/parser/test_ordered_list.rb
201
109
  - test/parser/test_toc_filter.rb
202
110
  - test/parser/test_toc_only_filter.rb
203
111
  - test/parser/test_various_toc_html.rb
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.7"
6
-
7
- gemspec path: "../"
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module JekyllToc
4
- VERSION = '0.13.0'
5
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class TestOptionError < Minitest::Test
6
- BASE_HTML = '<h1>h1</h1>'
7
- EXPECTED_HTML = <<~HTML
8
- <ul class="section-nav">
9
- <li class="toc-entry toc-h1"><a href="#h1">h1</a></li>
10
- </ul>
11
- HTML
12
-
13
- def test_option_is_nil
14
- parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, nil)
15
- doc = Nokogiri::HTML(parser.toc)
16
- expected = EXPECTED_HTML
17
- assert_equal(expected, doc.css('ul.section-nav').to_s)
18
- end
19
-
20
- def test_option_is_epmty_string
21
- parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, '')
22
- doc = Nokogiri::HTML(parser.toc)
23
- expected = EXPECTED_HTML
24
- assert_equal(expected, doc.css('ul.section-nav').to_s)
25
- end
26
-
27
- def test_option_is_string
28
- parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, 'string')
29
- doc = Nokogiri::HTML(parser.toc)
30
- expected = EXPECTED_HTML
31
- assert_equal(expected, doc.css('ul.section-nav').to_s)
32
- end
33
-
34
- def test_option_is_array
35
- parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, [])
36
- doc = Nokogiri::HTML(parser.toc)
37
- expected = EXPECTED_HTML
38
- assert_equal(expected, doc.css('ul.section-nav').to_s)
39
- end
40
- end