jekyll-toc-helpers 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +71 -0
- data/jekyll-toc-helpers.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9d50c00e9cc13823485adc7dbe4b73d690894d6
|
4
|
+
data.tar.gz: e085d1d938bf6e3978403742df36263480978e09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca8b82d9bae3f4107f5b25aaa3f58a41159b310a480b035dd179cac026a1910f8e822f9e543a51d7e4861207ab4ab14d814afba8a2617f19fc806c4db97260f
|
7
|
+
data.tar.gz: da46d2331877d457587d26347f79ccd73e1827df2571ee7fde170060566f2c514d0ed85e211ab06c650de9876a8a5275daab5b7f4e2201f13e165513b9c75061
|
data/README.md
CHANGED
@@ -0,0 +1,71 @@
|
|
1
|
+
jekyll-toc-variables
|
2
|
+
=======================
|
3
|
+
|
4
|
+
This gem lets adds two Liquid tags you can use in your Jekyll templates and files.
|
5
|
+
|
6
|
+
Both tags assume you have a single YAML file in your data folder that defines some kind of hierarchy for your pages. For the examples in this README, we'll be using the following YAML file:
|
7
|
+
|
8
|
+
``` yaml
|
9
|
+
- One File
|
10
|
+
- Two File:
|
11
|
+
- One Subfile
|
12
|
+
- Two Subfile
|
13
|
+
- Three File
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
## The `toc` tag
|
18
|
+
|
19
|
+
The TOC tag dumps out a flat listing of the YAML file, rendered as a Markdown list.
|
20
|
+
|
21
|
+
For the example file above, using the `toc` tag like this:
|
22
|
+
|
23
|
+
``` liquid
|
24
|
+
{% toc site.data.toc %}
|
25
|
+
```
|
26
|
+
|
27
|
+
results in some HTML that looks like this:
|
28
|
+
|
29
|
+
``` html
|
30
|
+
<ul>
|
31
|
+
<li><a href="one-file">One File</a></li>
|
32
|
+
<li><a href="two-file">Two File</a>
|
33
|
+
<ul>
|
34
|
+
<li><a href="one-subfile">One Subfile</a></li>
|
35
|
+
<li><a href="two-subfile">Two Subfile</a></li>
|
36
|
+
</ul>
|
37
|
+
</li>
|
38
|
+
<li><a href="three-file">Three File</a></li>
|
39
|
+
</ul>
|
40
|
+
```
|
41
|
+
|
42
|
+
## The `next_prev` tag
|
43
|
+
|
44
|
+
If you want to generate `Previous` and `Next` links, you can use the `next_prev` tag. It'll bring back a flat listing of the YAML file.
|
45
|
+
|
46
|
+
For the example file above, using the `next_prev` tag like this:
|
47
|
+
|
48
|
+
``` liquid
|
49
|
+
{% capture flat_links %}{% next_prev site.data.toc %}{% endcapture %}
|
50
|
+
{% assign flat_links = flat_links | split: '|' %}
|
51
|
+
<div class="pager">
|
52
|
+
<ul>
|
53
|
+
{% for title in flat_links %}
|
54
|
+
{% if title == page.title %}
|
55
|
+
{% unless forloop.first %}
|
56
|
+
<li class="left"><a href="source/{{ prev | slugify }}">< Previous</a></li>
|
57
|
+
{% endunless %}
|
58
|
+
|
59
|
+
{% unless forloop.last %}
|
60
|
+
<li class="right"><a href="source/{{ flat_links[forloop.index] | slugify }}">Next ></a></li>
|
61
|
+
{% endunless %}
|
62
|
+
|
63
|
+
{% break %}
|
64
|
+
{% endif %}
|
65
|
+
{% assign prev = title %}
|
66
|
+
{% endfor %}
|
67
|
+
</ul>
|
68
|
+
</div>
|
69
|
+
```
|
70
|
+
|
71
|
+
results in HTML that understands where the current page is, and what the next/previous links should look like. This includes nested subsections as the YAML file shows.
|
data/jekyll-toc-helpers.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'jekyll-toc-helpers'
|
6
|
-
spec.version = '0.1.
|
6
|
+
spec.version = '0.1.1'
|
7
7
|
spec.authors = ['Garen Torikian']
|
8
8
|
spec.email = ['gjtorikian@gmail.com']
|
9
9
|
spec.summary = 'Some helper tags for generating TOCs.'
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
-
spec.add_runtime_dependency 'jekyll', '
|
19
|
+
spec.add_runtime_dependency 'jekyll', '>= 2.0'
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
22
|
spec.add_development_dependency 'nokogiri', '~> 1.6'
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-toc-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -128,8 +128,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.2.
|
131
|
+
rubygems_version: 2.2.3
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Some helper tags for generating TOCs.
|
135
135
|
test_files: []
|
136
|
+
has_rdoc:
|