jekyll-toc 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +29 -0
- data/.github/workflows/coverage.yml +21 -0
- data/.github/workflows/rubocop.yml +18 -0
- data/.rubocop.yml +6 -6
- data/Appraisals +4 -4
- data/README.md +16 -7
- data/gemfiles/{jekyll_3.6.gemfile → jekyll_4.0.gemfile} +1 -1
- data/jekyll-toc.gemspec +2 -2
- data/lib/table_of_contents/parser.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +10 -8
- data/.travis.yml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2634b2c2267c315c21ce1e48750b524e1a808cd2574fc14f2c0a7387e3410e5
|
4
|
+
data.tar.gz: 30b711f5048f7f2691cfbdaa5853a81395bca2c2fe190a565ed9aa1a3630f248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bac3e436af71a4c85218b636e10de246f3db62997a3b6094944cdf3040c2cb3bf388746fb9a0b1f452ea78fe73d3fc75d6a950dbcbf8bac5f9dc9de89522735
|
7
|
+
data.tar.gz: 91c2af932a9925d4b624b1d16ae9b2118b4b02e6dd787158535028e08a3bea72242a90d52bb0279db4c5465ba61c3765dda4619e1d34c04890340bf649f65c7c
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
build:
|
5
|
+
strategy:
|
6
|
+
matrix:
|
7
|
+
ruby: [2.4, 2.5, 2.6, 2.7]
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/jekyll_4.0.gemfile
|
10
|
+
- gemfiles/jekyll_3.8.gemfile
|
11
|
+
- gemfiles/jekyll_3.7.gemfile
|
12
|
+
exclude:
|
13
|
+
- ruby: 2.4
|
14
|
+
gemfile: gemfiles/jekyll_4.0.gemfile
|
15
|
+
env:
|
16
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
21
|
+
uses: eregon/use-ruby-action@master
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
- name: bundle install
|
25
|
+
run: |
|
26
|
+
gem install bundler
|
27
|
+
bundle install --jobs 4 --retry 3
|
28
|
+
- name: Run Test
|
29
|
+
run: bundle exec rake
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Coverage
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
build:
|
5
|
+
strategy:
|
6
|
+
matrix:
|
7
|
+
ruby: [2.6]
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
12
|
+
uses: eregon/use-ruby-action@master
|
13
|
+
with:
|
14
|
+
ruby-version: ${{ matrix.ruby }}
|
15
|
+
- name: bundle install
|
16
|
+
run: bundle install --jobs 4 --retry 3
|
17
|
+
- uses: paambaati/codeclimate-action@v2.4.0
|
18
|
+
env:
|
19
|
+
CC_TEST_REPORTER_ID: 6b81e393ea6ad38560386f650ea2fb0e57a7beb5e20f8c8364fabee30d5bff07
|
20
|
+
with:
|
21
|
+
coverageCommand: bundle exec rake
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: RuboCop
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
build:
|
5
|
+
strategy:
|
6
|
+
matrix:
|
7
|
+
ruby: [2.6]
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
12
|
+
uses: eregon/use-ruby-action@master
|
13
|
+
with:
|
14
|
+
ruby-version: ${{ matrix.ruby }}
|
15
|
+
- name: bundle install
|
16
|
+
run: bundle install --jobs 4 --retry 3
|
17
|
+
- name: Run RuboCop
|
18
|
+
run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
@@ -6,9 +6,6 @@ AllCops:
|
|
6
6
|
- Rakefile
|
7
7
|
- Gemfile
|
8
8
|
|
9
|
-
Metrics/LineLength:
|
10
|
-
Enabled: false
|
11
|
-
|
12
9
|
Metrics/MethodLength:
|
13
10
|
Enabled: false
|
14
11
|
|
@@ -18,11 +15,14 @@ Metrics/AbcSize:
|
|
18
15
|
Metrics/ClassLength:
|
19
16
|
Enabled: false
|
20
17
|
|
21
|
-
Style/FileName:
|
22
|
-
Enabled: false
|
23
|
-
|
24
18
|
Style/BracesAroundHashParameters:
|
25
19
|
Enabled: false
|
26
20
|
|
27
21
|
Style/WordArray:
|
28
22
|
Enabled: false
|
23
|
+
|
24
|
+
Naming/FileName:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Layout/LineLength:
|
28
|
+
Enabled: false
|
data/Appraisals
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
appraise 'jekyll-4.0' do
|
4
|
+
gem 'jekyll', '4.0'
|
5
|
+
end
|
6
|
+
|
3
7
|
appraise 'jekyll-3.8' do
|
4
8
|
gem 'jekyll', '3.8'
|
5
9
|
end
|
@@ -7,7 +11,3 @@ end
|
|
7
11
|
appraise 'jekyll-3.7' do
|
8
12
|
gem 'jekyll', '3.7'
|
9
13
|
end
|
10
|
-
|
11
|
-
appraise 'jekyll-3.6' do
|
12
|
-
gem 'jekyll', '3.6'
|
13
|
-
end
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# jekyll-toc
|
2
2
|
|
3
|
-
|
3
|
+
![CI](https://github.com/toshimaru/jekyll-toc/workflows/CI/badge.svg)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/jekyll-toc.svg)](http://badge.fury.io/rb/jekyll-toc)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/toshimaru/jekyll-toc/badges/gpa.svg)](https://codeclimate.com/github/toshimaru/jekyll-toc)
|
6
6
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/cd56b207f327603662a1/test_coverage)](https://codeclimate.com/github/toshimaru/jekyll-toc/test_coverage)
|
@@ -64,11 +64,9 @@ This filter places the TOC directly above the content.
|
|
64
64
|
|
65
65
|
### 2. Advanced Usage
|
66
66
|
|
67
|
-
If you'd like separated TOC and content, you can use `toc_only` and `inject_anchors`
|
67
|
+
If you'd like separated TOC and content, you can use `{% toc %}` tag (or `toc_only` filter) and `inject_anchors` filter.
|
68
68
|
|
69
|
-
#### `
|
70
|
-
|
71
|
-
⚠️ ~~Please use `{% toc %}` instead of `{{ content | toc_only }}`.~~
|
69
|
+
#### `{% toc %}` tag
|
72
70
|
|
73
71
|
Generates the TOC itself as described [below](#generated-html).
|
74
72
|
Mostly useful in cases where the TOC should _not_ be placed immediately
|
@@ -85,9 +83,20 @@ above the content but at some other place of the page, i.e. an aside.
|
|
85
83
|
</div>
|
86
84
|
```
|
87
85
|
|
88
|
-
|
86
|
+
:warning: **`{% toc %}` Tag Limitation**
|
87
|
+
|
88
|
+
`{% toc %}` can be available only in [Jekyll Posts](https://jekyllrb.com/docs/step-by-step/08-blogging/) and [Jekyll Collections](https://jekyllrb.com/docs/collections/). If you'd like to use `{% toc %}` except posts or collections, please use `toc_only` filter as described below.
|
89
89
|
|
90
|
-
|
90
|
+
```html
|
91
|
+
<div>
|
92
|
+
<div id="table-of-contents">
|
93
|
+
{{ content | toc_only }}
|
94
|
+
</div>
|
95
|
+
<div id="markdown-content">
|
96
|
+
{{ content | inject_anchors }}
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
```
|
91
100
|
|
92
101
|
#### `inject_anchors` filter
|
93
102
|
|
data/jekyll-toc.gemspec
CHANGED
@@ -15,12 +15,12 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.required_ruby_version = '>= 2.
|
18
|
+
spec.required_ruby_version = '>= 2.4'
|
19
19
|
|
20
20
|
spec.add_runtime_dependency 'nokogiri', '~> 1.9'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'appraisal'
|
23
|
-
spec.add_development_dependency 'jekyll', '>= 3.
|
23
|
+
spec.add_development_dependency 'jekyll', '>= 3.7'
|
24
24
|
spec.add_development_dependency 'minitest', '~> 5.11'
|
25
25
|
spec.add_development_dependency 'minitest-reporters'
|
26
26
|
spec.add_development_dependency 'pry'
|
@@ -4,7 +4,7 @@ module Jekyll
|
|
4
4
|
module TableOfContents
|
5
5
|
# Parse html contents and generate table of contents
|
6
6
|
class Parser
|
7
|
-
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u
|
7
|
+
PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u.freeze
|
8
8
|
|
9
9
|
def initialize(html, options = {})
|
10
10
|
@doc = Nokogiri::HTML::DocumentFragment.parse(html)
|
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.
|
4
|
+
version: 0.13.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:
|
12
|
+
date: 2020-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '3.
|
48
|
+
version: '3.7'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '3.
|
55
|
+
version: '3.7'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: minitest
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,18 +143,20 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
+
- ".github/workflows/ci.yml"
|
147
|
+
- ".github/workflows/coverage.yml"
|
148
|
+
- ".github/workflows/rubocop.yml"
|
146
149
|
- ".gitignore"
|
147
150
|
- ".rubocop.yml"
|
148
|
-
- ".travis.yml"
|
149
151
|
- Appraisals
|
150
152
|
- CHANGELOG.md
|
151
153
|
- Gemfile
|
152
154
|
- LICENSE.md
|
153
155
|
- README.md
|
154
156
|
- Rakefile
|
155
|
-
- gemfiles/jekyll_3.6.gemfile
|
156
157
|
- gemfiles/jekyll_3.7.gemfile
|
157
158
|
- gemfiles/jekyll_3.8.gemfile
|
159
|
+
- gemfiles/jekyll_4.0.gemfile
|
158
160
|
- jekyll-toc.gemspec
|
159
161
|
- lib/jekyll-toc.rb
|
160
162
|
- lib/table_of_contents/configuration.rb
|
@@ -182,14 +184,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
184
|
requirements:
|
183
185
|
- - ">="
|
184
186
|
- !ruby/object:Gem::Version
|
185
|
-
version: '2.
|
187
|
+
version: '2.4'
|
186
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
189
|
requirements:
|
188
190
|
- - ">="
|
189
191
|
- !ruby/object:Gem::Version
|
190
192
|
version: '0'
|
191
193
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
194
|
+
rubygems_version: 3.1.2
|
193
195
|
signing_key:
|
194
196
|
specification_version: 4
|
195
197
|
summary: Jekyll Table of Contents plugin
|
data/.travis.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
env:
|
4
|
-
global:
|
5
|
-
- CC_TEST_REPORTER_ID=6b81e393ea6ad38560386f650ea2fb0e57a7beb5e20f8c8364fabee30d5bff07
|
6
|
-
rvm:
|
7
|
-
- 2.4.6
|
8
|
-
- 2.5.5
|
9
|
-
- 2.6.3
|
10
|
-
# gemfile is generated by appraisal
|
11
|
-
gemfile:
|
12
|
-
- gemfiles/jekyll_3.8.gemfile
|
13
|
-
- gemfiles/jekyll_3.7.gemfile
|
14
|
-
- gemfiles/jekyll_3.6.gemfile
|
15
|
-
before_script:
|
16
|
-
# Download cc-test-reporter
|
17
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
18
|
-
- chmod +x ./cc-test-reporter
|
19
|
-
- ./cc-test-reporter before-build
|
20
|
-
after_success:
|
21
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
22
|
-
- bundle exec codeclimate-test-reporter
|