jekyll-toc 0.3.0.pre1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -7
- data/Appraisals +4 -0
- data/README.md +21 -7
- data/gemfiles/jekyll_3.5.gemfile +7 -0
- data/jekyll-toc.gemspec +18 -13
- data/lib/version.rb +1 -1
- data/test/test_helper.rb +3 -2
- data/test/test_inject_anchors_filter.rb +2 -3
- data/test/test_toc_filter.rb +14 -3
- data/test/test_toc_only_filter.rb +1 -2
- metadata +36 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c57e9121410deaeb8ae17baa0aba66d09884ff
|
4
|
+
data.tar.gz: 64fa560a6fb7008f52fad57889e0e5d00fbfe739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13220d95cfcea4503fcbb1fee8b91395ed5b4623206f8f9a7258f0c888526484cef6a21131263526f7041a66ad826ac9165ae1c01f86b04cd6d490886f890eb8
|
7
|
+
data.tar.gz: d92865dc291732d1eded8cb67420488786d9b0385b2216a8e523c6a0cbac699d21cccfc1d8f395dc1f1f540ac9893c7065b5b435feaa5b52271870e9cb7b8401
|
data/.travis.yml
CHANGED
@@ -3,20 +3,18 @@ cache: bundler
|
|
3
3
|
rvm:
|
4
4
|
- 2.1
|
5
5
|
- 2.2
|
6
|
-
- 2.3.
|
7
|
-
- 2.4.
|
6
|
+
- 2.3.4
|
7
|
+
- 2.4.1
|
8
8
|
# gemfile is generated by appraisal
|
9
9
|
gemfile:
|
10
|
+
- gemfiles/jekyll_3.5.gemfile
|
10
11
|
- gemfiles/jekyll_3.4.gemfile
|
11
12
|
- gemfiles/jekyll_3.3.gemfile
|
12
13
|
- gemfiles/jekyll_3.2.gemfile
|
13
14
|
- gemfiles/jekyll_3.1.gemfile
|
14
15
|
- gemfiles/jekyll_3.gemfile
|
15
|
-
- gemfiles/jekyll_2.gemfile
|
16
|
-
matrix:
|
17
|
-
exclude:
|
18
|
-
- rvm: 2.4.0
|
19
|
-
gemfile: gemfiles/jekyll_2.gemfile
|
20
16
|
addons:
|
21
17
|
code_climate:
|
22
18
|
repo_token: 6b81e393ea6ad38560386f650ea2fb0e57a7beb5e20f8c8364fabee30d5bff07
|
19
|
+
after_success:
|
20
|
+
- bundle exec codeclimate-test-reporter
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -77,19 +77,33 @@ location with the `toc_only` filter.
|
|
77
77
|
|
78
78
|
jekyll-toc generates Unordered List. The final output is as follows.
|
79
79
|
|
80
|
+
**Heads-up**: As of v0.3, nested toc has been supported. If you update jekyll-toc from 0.2 to 0.3, please check [upgrade guide](https://github.com/toshimaru/jekyll-toc/wiki/0.3-Upgrade-Guide)
|
81
|
+
|
80
82
|
```html
|
81
83
|
<ul class="section-nav">
|
82
|
-
<li class="toc-entry toc-h1"><a href="#heading1">Heading.1</a
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
<li class="toc-entry toc-h1"><a href="#heading1">Heading.1</a>
|
85
|
+
<ul>
|
86
|
+
<li class="toc-entry toc-h2"><a href="#heading1-1">Heading.1-1</a></li>
|
87
|
+
<li class="toc-entry toc-h2"><a href="#heading1-2">Heading.1-2</a></li>
|
88
|
+
</ul>
|
89
|
+
</li>
|
90
|
+
<li class="toc-entry toc-h1"><a href="#heading2">Heading.2</a>
|
91
|
+
<ul>
|
92
|
+
<li class="toc-entry toc-h2"><a href="#heading2-1">Heading.2-1</a>
|
93
|
+
<ul>
|
94
|
+
<li class="toc-entry toc-h3"><a href="#heading2-1-1">Heading.2-1-1</a></li>
|
95
|
+
<li class="toc-entry toc-h3"><a href="#heading2-1-2">Heading.2-1-2</a></li>
|
96
|
+
</ul>
|
97
|
+
</li>
|
98
|
+
<li class="toc-entry toc-h2"><a href="#heading2-2">Heading.2-2</a></li>
|
99
|
+
</ul>
|
100
|
+
</li>
|
87
101
|
</ul>
|
88
102
|
```
|
89
103
|
|
90
104
|
It looks like the image below.
|
91
105
|
|
92
|
-
![screenshot](https://
|
106
|
+
![screenshot](https://user-images.githubusercontent.com/803398/28401295-0dcfb7ca-6d54-11e7-892b-2f2e6ca755a7.png)
|
93
107
|
|
94
108
|
## CSS Styling
|
95
109
|
|
@@ -105,7 +119,7 @@ The toc can be modified with CSS. The sample CSS is the following.
|
|
105
119
|
}
|
106
120
|
```
|
107
121
|
|
108
|
-
![
|
122
|
+
![screen shot](https://user-images.githubusercontent.com/803398/28401455-0ba60868-6d55-11e7-8159-0ae7591aee66.png)
|
109
123
|
|
110
124
|
Each TOC `li` entry has two CSS classes for further styling.
|
111
125
|
The general `toc-entry` is applied to all `li` elements in the `ul.section-nav`.
|
data/jekyll-toc.gemspec
CHANGED
@@ -1,27 +1,32 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
3
|
+
require 'version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'jekyll-toc'
|
7
7
|
spec.version = JekyllToc::VERSION
|
8
|
-
spec.summary =
|
9
|
-
spec.description =
|
10
|
-
spec.authors =
|
8
|
+
spec.summary = 'Jekyll Table of Contents plugin'
|
9
|
+
spec.description = 'A liquid filter plugin for Jekyll which generates a table of contents.'
|
10
|
+
spec.authors = %w(toshimaru torbjoernk)
|
11
11
|
spec.email = 'me@toshimaru.net'
|
12
12
|
spec.files = `git ls-files -z`.split("\x0")
|
13
13
|
spec.homepage = 'https://github.com/toshimaru/jekyll-toc'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
-
spec.require_paths = [
|
16
|
+
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.
|
18
|
+
spec.post_install_message = %q(As of jekyll-toc 0.3, nested toc is supported! Please make sure your toc is not broken after update jekyll-toc.
|
19
19
|
|
20
|
-
|
20
|
+
For more info: https://github.com/toshimaru/jekyll-toc/wiki/0.3-Upgrade-Guide)
|
21
21
|
|
22
|
-
spec.
|
23
|
-
|
24
|
-
spec.
|
25
|
-
|
26
|
-
spec.add_development_dependency
|
22
|
+
spec.required_ruby_version = '>= 2.1.0'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'appraisal'
|
27
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
|
28
|
+
spec.add_development_dependency 'jekyll', '>= 3.0'
|
29
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
30
|
+
spec.add_development_dependency 'pry'
|
31
|
+
spec.add_development_dependency 'rake'
|
27
32
|
end
|
data/lib/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require_relative '../lib/jekyll-toc'
|
3
2
|
|
4
|
-
class
|
3
|
+
class TestInjectAnchorsFilter < Minitest::Test
|
5
4
|
include TestHelpers
|
6
5
|
|
7
6
|
def setup
|
@@ -11,7 +10,7 @@ class TestTOCOnlyFilter < Minitest::Test
|
|
11
10
|
def test_injects_anchors_into_content
|
12
11
|
html = @parser.inject_anchors_into_html
|
13
12
|
|
14
|
-
assert_match(
|
13
|
+
assert_match(%r{<a id="simple-h1" class="anchor" href="#simple-h1" aria-hidden="true"><span.*span></a>Simple H1}, html)
|
15
14
|
end
|
16
15
|
|
17
16
|
def test_does_not_inject_toc
|
data/test/test_toc_filter.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require_relative '../lib/jekyll-toc'
|
3
|
-
|
4
2
|
|
5
3
|
class TestTOCFilter < Minitest::Test
|
6
4
|
include TestHelpers
|
@@ -12,7 +10,20 @@ class TestTOCFilter < Minitest::Test
|
|
12
10
|
def test_injects_anchors
|
13
11
|
html = @parser.toc
|
14
12
|
|
15
|
-
assert_match(
|
13
|
+
assert_match(%r{<a id="simple-h1" class="anchor" href="#simple-h1" aria-hidden="true"><span.*span></a>Simple H1}, html)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_nested_toc
|
17
|
+
doc = Nokogiri::HTML(@parser.toc)
|
18
|
+
nested_h6_text = doc.css('ul.section-nav')
|
19
|
+
.css('li.toc-h1')
|
20
|
+
.css('li.toc-h2')
|
21
|
+
.css('li.toc-h3')
|
22
|
+
.css('li.toc-h4')
|
23
|
+
.css('li.toc-h5')
|
24
|
+
.css('li.toc-h6')
|
25
|
+
.text
|
26
|
+
assert_equal('Simple H6', nested_h6_text)
|
16
27
|
end
|
17
28
|
|
18
29
|
def test_injects_toc_container
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require_relative '../lib/jekyll-toc'
|
3
2
|
|
4
3
|
class TestTOCOnlyFilter < Minitest::Test
|
5
4
|
include TestHelpers
|
@@ -17,6 +16,6 @@ class TestTOCOnlyFilter < Minitest::Test
|
|
17
16
|
def test_does_not_return_content
|
18
17
|
html = @parser.build_toc
|
19
18
|
|
20
|
-
assert_nil(
|
19
|
+
assert_nil(%r{<h1>Simple H1</h1>} =~ html)
|
21
20
|
end
|
22
21
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-toc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- toshimaru
|
8
8
|
- torbjoernk
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -26,61 +26,75 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.6'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
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
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: codeclimate-test-reporter
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
31
45
|
requirements:
|
32
46
|
- - "~>"
|
33
47
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
48
|
+
version: '1.0'
|
35
49
|
type: :development
|
36
50
|
prerelease: false
|
37
51
|
version_requirements: !ruby/object:Gem::Requirement
|
38
52
|
requirements:
|
39
53
|
- - "~>"
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
55
|
+
version: '1.0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
57
|
+
name: jekyll
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - ">="
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
62
|
+
version: '3.0'
|
49
63
|
type: :development
|
50
64
|
prerelease: false
|
51
65
|
version_requirements: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
67
|
- - ">="
|
54
68
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
69
|
+
version: '3.0'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
71
|
+
name: minitest
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
76
|
+
version: '5.0'
|
63
77
|
type: :development
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
83
|
+
version: '5.0'
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
85
|
+
name: pry
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
88
|
- - ">="
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
90
|
+
version: '0'
|
77
91
|
type: :development
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
95
|
- - ">="
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
97
|
+
version: '0'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: rake
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +128,7 @@ files:
|
|
114
128
|
- gemfiles/jekyll_3.2.gemfile
|
115
129
|
- gemfiles/jekyll_3.3.gemfile
|
116
130
|
- gemfiles/jekyll_3.4.gemfile
|
131
|
+
- gemfiles/jekyll_3.5.gemfile
|
117
132
|
- gemfiles/jekyll_3.gemfile
|
118
133
|
- jekyll-toc.gemspec
|
119
134
|
- lib/jekyll-toc.rb
|
@@ -127,7 +142,10 @@ homepage: https://github.com/toshimaru/jekyll-toc
|
|
127
142
|
licenses:
|
128
143
|
- MIT
|
129
144
|
metadata: {}
|
130
|
-
post_install_message:
|
145
|
+
post_install_message: |-
|
146
|
+
As of jekyll-toc 0.3, nested toc is supported! Please make sure your toc is not broken after update jekyll-toc.
|
147
|
+
|
148
|
+
For more info: https://github.com/toshimaru/jekyll-toc/wiki/0.3-Upgrade-Guide
|
131
149
|
rdoc_options: []
|
132
150
|
require_paths:
|
133
151
|
- lib
|
@@ -138,9 +156,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
156
|
version: 2.1.0
|
139
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
158
|
requirements:
|
141
|
-
- - "
|
159
|
+
- - ">="
|
142
160
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
161
|
+
version: '0'
|
144
162
|
requirements: []
|
145
163
|
rubyforge_project:
|
146
164
|
rubygems_version: 2.5.2
|