jekyll-toc 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 550d71ff0726c66bf79b2055447cd73ad9c69937
4
- data.tar.gz: c178210e74ae1baa792df21e9cbecdd029b48730
3
+ metadata.gz: 8aa511b3cbd44f2e2e91f67187fef6d76a6357dc
4
+ data.tar.gz: 3321ca103d225ae9b3d6818a40e19177f0e677b4
5
5
  SHA512:
6
- metadata.gz: 50ac825bc691c394b110167aa9600a41ad633f08e2b9bb3d617608ace9782da0f5d4c68f26fa5c319a54060fba7618afdba63f4cdeb84ca96a20ab10ea01da38
7
- data.tar.gz: 016084fe682cc1a117f5315b90432352a4ec6789d71deeb0a46c7e1af4af480d71761cb1bf97fdabc391a9e839fc0ed5642cf84b0c7dfd6bee8dee4ad35e1547
6
+ metadata.gz: a4b44bae9cc02828af5aa4032d3fcb6916bf7a9507e229bd57a01703efc43a34c643211a3fdd31da2eda224ba28379521657b90b694a860b08f97fb2c189ab97
7
+ data.tar.gz: def0f70994dcba5d8904d2bd02cfbf36334f7bfa71a1b9c266b4666b665c14a0c0bcc325450d1cfc50eea098373acb1ec23f3390abca5dec7884cfc9c19ef22c
data/README.md CHANGED
@@ -1,6 +1,44 @@
1
- # WIP
1
+ # This plugin is still WIP.
2
2
 
3
- * Gem badge
4
- * Travis CI
5
- * (Coverall)
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll-toc.svg)](http://badge.fury.io/rb/jekyll-toc)
4
+ [![Dependency Status](https://gemnasium.com/toshimaru/jekyll-toc.svg)](https://gemnasium.com/toshimaru/jekyll-toc)
5
+ [![Code Climate](https://codeclimate.com/github/toshimaru/jekyll-toc/badges/gpa.svg)](https://codeclimate.com/github/toshimaru/jekyll-toc)
6
+
7
+ # Usage
8
+
9
+ Add jekyll-toc plugin in your site's `Gemfile`.
10
+
11
+ ```ruby
12
+ gem 'jekyll-toc'
13
+ ```
14
+
15
+ And add the jekyll-toc to your site's `_config.yml`.
16
+
17
+ ```yml
18
+ gems:
19
+ - jekyll-toc
20
+ ```
21
+
22
+ Finally, add `toc` filter to your site's `{{ content }}`.
23
+
24
+ ```
25
+ {{ content | toc }}
26
+ ```
27
+
28
+ ## Generated Tablle of Contents
29
+
30
+ ```html
31
+ <ul>
32
+ <li>foo</li>
33
+ <li>bar</li>
34
+ </ul>
35
+ ```
36
+
37
+ ## CSS Styling
38
+
39
+ ## TODO
40
+ * more README
41
+ * Close toc JavaScript
6
42
  * Test
43
+ * Travis CI
44
+ * Coverage & Coverall
data/jekyll-toc.gemspec CHANGED
@@ -1,7 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'jekyll-toc'
3
- spec.version = '0.0.1'
4
- spec.date = '2015-01-04'
3
+ spec.version = '0.0.3'
5
4
  spec.summary = "Jekyll Table of Contents plugin"
6
5
  spec.description = "Jekyll plugin which generates a table of contents at the top of the content"
7
6
  spec.authors = ["Toshimaru"]
data/lib/jekyll-toc.rb CHANGED
@@ -7,6 +7,9 @@ module Jekyll
7
7
  PUNCTUATION_REGEXP = RUBY_VERSION > "1.9" ? /[^\p{Word}\- ]/u : /[^\w\- ]/
8
8
 
9
9
  def toc(html)
10
+ page = @context.registers[:page]
11
+ return html unless page["toc"]
12
+
10
13
  toc = ""
11
14
  doc = Nokogiri::HTML::DocumentFragment.parse(html)
12
15
  headers = Hash.new(0)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-toc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshimaru
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-04 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri