jekyll-toc 0.12.0 → 0.12.1

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
  SHA256:
3
- metadata.gz: 9ba2f73587fb8e2eedc40f689c51c958efcd5a8a8812b5a3b8e913c1dce4b3bb
4
- data.tar.gz: 14faf0588ffb5c3ddb46282e7b5ea5cbaadbf0bb54470eab76cf4b9100ef4af9
3
+ metadata.gz: 79d1409209555ff59be7d83d30b1576ca4ae792835a934fa2618e9efb13c0a61
4
+ data.tar.gz: 1008538004cb196a363fca3748988f1156d21e6ff72b30505d4a4f20ad0c1600
5
5
  SHA512:
6
- metadata.gz: d1a496f1d646f2b2e27c327927441d0cdca40123e96205a4557bada80cb9abe9c556b36790f2bab03bd046bd02ea9c17521f1c1d5b7399e3f8ee4c37b3c90cc9
7
- data.tar.gz: 5a27d18a5527dbb7857cad7ed5382e4b9f49d7a0abe65f2d2b3f376c94cea706e2dc5fefd59d7f0e7588a4b0589e26e33bea5c12166b61cd28b479f3d8308123
6
+ metadata.gz: 4a4f68a3f04691f78bfe05f8a5b3e5e59f0b75b26e43cdb199ba8a5aa08192c397fd7bc2ffbbf458d5923b136369d986dac1f1a6556ef6c820faa95365873a8e
7
+ data.tar.gz: 83ad420d0a58ca60ef99635b1ed13b85e2f17f7a638c35724f22c0f6b628121cf73c25ae4a9d6e2c65d909dcae72355220c3465471bd3f14d858f9af5c143764
data/README.md CHANGED
@@ -66,7 +66,7 @@ This filter places the TOC directly above the content.
66
66
 
67
67
  If you'd like separated TOC and content, you can use `toc_only` and `inject_anchors` filters.
68
68
 
69
- #### ~~`toc_only` filter~~
69
+ #### ~~`toc_only` filter~~ `toc` tag
70
70
 
71
71
  ⚠️ Please use `{% toc %}` instead of `{{ content | toc_only }}`.
72
72
 
@@ -74,8 +74,6 @@ Generates the TOC itself as described [below](#generated-html).
74
74
  Mostly useful in cases where the TOC should _not_ be placed immediately
75
75
  above the content but at some other place of the page, i.e. an aside.
76
76
 
77
- #### toc tag
78
-
79
77
  ```html
80
78
  <div>
81
79
  <div id="table-of-contents">
@@ -87,6 +85,10 @@ above the content but at some other place of the page, i.e. an aside.
87
85
  </div>
88
86
  ```
89
87
 
88
+ #### Current Limitation
89
+
90
+ **`{% 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 any concern or issue, please report it on [issue](https://github.com/toshimaru/jekyll-toc/issues/new).**
91
+
90
92
  #### `inject_anchors` filter
91
93
 
92
94
  Injects HTML anchors into the content without actually outputting the TOC itself.
@@ -21,7 +21,7 @@ module Jekyll
21
21
  # Deprecated method. Removed in v1.0.
22
22
  def toc_only(html)
23
23
  Jekyll.logger.warn 'Deprecation: toc_only filter is deprecated and will be remove in jekyll-toc v1.0.',
24
- 'Use `{% toc %}` instead of `{{ contents | toc_only }}`.'
24
+ 'Use `{% toc %}` instead of `{{ content | toc_only }}`.'
25
25
  return '' unless toc_enabled?
26
26
 
27
27
  TableOfContents::Parser.new(html, toc_config).build_toc
@@ -4,7 +4,8 @@ module Jekyll
4
4
  module TableOfContents
5
5
  # jekyll-toc configuration class
6
6
  class Configuration
7
- attr_accessor :toc_levels, :no_toc_section_class, :list_class, :sublist_class, :item_class, :item_prefix
7
+ attr_accessor :toc_levels, :no_toc_class, :no_toc_section_class,
8
+ :list_class, :sublist_class, :item_class, :item_prefix
8
9
 
9
10
  DEFAULT_CONFIG = {
10
11
  'min_level' => 1,
@@ -20,6 +21,7 @@ module Jekyll
20
21
  options = generate_option_hash(options)
21
22
 
22
23
  @toc_levels = options['min_level']..options['max_level']
24
+ @no_toc_class = 'no_toc'
23
25
  @no_toc_section_class = options['no_toc_section_class']
24
26
  @list_class = options['list_class']
25
27
  @sublist_class = options['sublist_class']
@@ -4,7 +4,6 @@ module Jekyll
4
4
  module TableOfContents
5
5
  # Parse html contents and generate table of contents
6
6
  class Parser
7
- NO_TOC_CLASS_NAME = 'no_toc'
8
7
  PUNCTUATION_REGEXP = /[^\p{Word}\- ]/u
9
8
 
10
9
  def initialize(html, options = {})
@@ -39,7 +38,7 @@ module Jekyll
39
38
  headers = Hash.new(0)
40
39
 
41
40
  (@doc.css(toc_headings) - @doc.css(toc_headings_in_no_toc_section))
42
- .reject { |n| n.classes.include?(NO_TOC_CLASS_NAME) }
41
+ .reject { |n| n.classes.include?(@configuration.no_toc_class) }
43
42
  .inject([]) do |entries, node|
44
43
  text = node.text
45
44
  id = node.attribute('id') || text
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllToc
4
- VERSION = '0.12.0'
4
+ VERSION = '0.12.1'
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.12.0
4
+ version: 0.12.1
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: 2019-04-01 00:00:00.000000000 Z
12
+ date: 2019-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri