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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd7a5a0373a967ef42103de10288c8da0db20f0b
4
- data.tar.gz: 84427b7348a6db378b8bc27b1b938797f2b6f84f
3
+ metadata.gz: 53c57e9121410deaeb8ae17baa0aba66d09884ff
4
+ data.tar.gz: 64fa560a6fb7008f52fad57889e0e5d00fbfe739
5
5
  SHA512:
6
- metadata.gz: d4d5644477eebaca659eed0cfcced2d07e4771a26f02d4ed2056c90dc2ff3d51314464671b9504ac35346f67bb238794fd6eb87f30599a1cdf7912b8d12114e8
7
- data.tar.gz: f68deeb9b77fb14381924694ca12da5003f85b95bd9e4f3debe43d03b9925e95506d75f58107fbb09f559f07142758203a7c8b5b5d26145bcd954235abdd19f6
6
+ metadata.gz: 13220d95cfcea4503fcbb1fee8b91395ed5b4623206f8f9a7258f0c888526484cef6a21131263526f7041a66ad826ac9165ae1c01f86b04cd6d490886f890eb8
7
+ data.tar.gz: d92865dc291732d1eded8cb67420488786d9b0385b2216a8e523c6a0cbac699d21cccfc1d8f395dc1f1f540ac9893c7065b5b435feaa5b52271870e9cb7b8401
@@ -3,20 +3,18 @@ cache: bundler
3
3
  rvm:
4
4
  - 2.1
5
5
  - 2.2
6
- - 2.3.1
7
- - 2.4.0
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
@@ -1,3 +1,7 @@
1
+ appraise "jekyll-3.5" do
2
+ gem "jekyll", "3.5.1"
3
+ end
4
+
1
5
  appraise "jekyll-3.4" do
2
6
  gem "jekyll", "3.4.3"
3
7
  end
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></li>
83
- <li class="toc-entry toc-h2"><a href="#heading2-1">Heading.2-1</a></li>
84
- <li class="toc-entry toc-h2"><a href="#heading2-2">Heading.2-2</a></li>
85
- <li class="toc-entry toc-h3"><a href="#heading3">Heading.3</a></li>
86
- <li class="toc-entry toc-h2"><a href="#heading2-3">Heading.2-3</a></li>
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://cloud.githubusercontent.com/assets/803398/5722561/7f59e8aa-9b80-11e4-9ee5-27a15192ee83.png)
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
- ![screenshot](https://cloud.githubusercontent.com/assets/803398/5723662/f0bc84c8-9b88-11e4-986c-90608ca88184.png)
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`.
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "jekyll", "3.5.1"
6
+
7
+ gemspec :path => "../"
@@ -1,27 +1,32 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "version"
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 = "Jekyll Table of Contents plugin"
9
- spec.description = "A liquid filter plugin for Jekyll which generates a table of contents."
10
- spec.authors = ["Toshimaru", 'torbjoernk']
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 = ["lib"]
16
+ spec.require_paths = ['lib']
17
17
 
18
- spec.required_ruby_version = ">= 2.1.0"
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
- spec.add_runtime_dependency "nokogiri", "~> 1.6"
20
+ For more info: https://github.com/toshimaru/jekyll-toc/wiki/0.3-Upgrade-Guide)
21
21
 
22
- spec.add_development_dependency 'minitest', "~> 5.0"
23
- spec.add_development_dependency "appraisal"
24
- spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0"
25
- spec.add_development_dependency "jekyll", ">= 2.0"
26
- spec.add_development_dependency "rake"
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
@@ -1,3 +1,3 @@
1
1
  module JekyllToc
2
- VERSION = '0.3.0.pre1'
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -1,10 +1,11 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start
3
3
 
4
- require 'jekyll'
5
4
  require 'minitest/autorun'
5
+ require 'jekyll'
6
+ require 'jekyll-toc'
6
7
 
7
- SIMPLE_HTML = <<HTML
8
+ SIMPLE_HTML = <<-HTML
8
9
  <h1>Simple H1</h1>
9
10
  <h2>Simple H2</h2>
10
11
  <h3>Simple H3</h3>
@@ -1,7 +1,6 @@
1
1
  require 'test_helper'
2
- require_relative '../lib/jekyll-toc'
3
2
 
4
- class TestTOCOnlyFilter < Minitest::Test
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(/<a id="simple\-h1" class="anchor" href="#simple\-h1" aria\-hidden="true"><span.*span><\/a>Simple H1/, html)
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
@@ -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(/<a id="simple\-h1" class="anchor" href="#simple\-h1" aria\-hidden="true"><span.*span><\/a>Simple H1/, html)
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(/<h1>Simple H1<\/h1>/ =~ html)
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.pre1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Toshimaru
7
+ - toshimaru
8
8
  - torbjoernk
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-11 00:00:00.000000000 Z
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: minitest
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: '5.0'
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: '5.0'
55
+ version: '1.0'
42
56
  - !ruby/object:Gem::Dependency
43
- name: appraisal
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: codeclimate-test-reporter
71
+ name: minitest
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
74
  - - "~>"
61
75
  - !ruby/object:Gem::Version
62
- version: '1.0'
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: '1.0'
83
+ version: '5.0'
70
84
  - !ruby/object:Gem::Dependency
71
- name: jekyll
85
+ name: pry
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
88
  - - ">="
75
89
  - !ruby/object:Gem::Version
76
- version: '2.0'
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: '2.0'
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: 1.3.1
161
+ version: '0'
144
162
  requirements: []
145
163
  rubyforge_project:
146
164
  rubygems_version: 2.5.2