octopress-include-tag 1.0.1 → 1.0.2
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/CHANGELOG.md +4 -0
- data/README.md +38 -20
- data/lib/octopress-include-tag/version.rb +2 -2
- data/lib/octopress-include-tag.rb +4 -2
- data/octopress-include-tag.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 633c2dc4ba2a2835fb054b66e518befc3eba5864
|
4
|
+
data.tar.gz: e765d981dd4e650b5a8732fc11433761cdac9279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d5b7598cdc4adad0880a782f8652b76d5b7f2bbcc547e56364cd445e2e0bb207db355a5c2bcb263eb1c297555056cbf6fa8c54c8609f1ad0f877d190ab656b7
|
7
|
+
data.tar.gz: d802e466a57468f4cb359407be4a0067a8f247906aeb4159bb6849465cf2295291d284b12a6378d98c7e7248756cf600456fb30c8a426279b8661cf09bbc24dd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,51 +6,64 @@ This replaces Jekyll's include tag and adds support for conditional rendering, i
|
|
6
6
|
[](https://rubygems.org/gems/octopress-include-tag)
|
7
7
|
[](http://octopress.mit-license.org)
|
8
8
|
|
9
|
+
|
9
10
|
## Installation
|
10
11
|
|
11
|
-
|
12
|
+
If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
|
12
13
|
|
13
|
-
|
14
|
+
group :jekyll_plugins do
|
15
|
+
gem 'octopress-include-tag'
|
16
|
+
end
|
14
17
|
|
15
|
-
|
18
|
+
Then install the gem with Bundler
|
16
19
|
|
17
20
|
$ bundle
|
18
21
|
|
19
|
-
|
22
|
+
To install manually without bundler:
|
20
23
|
|
21
24
|
$ gem install octopress-include-tag
|
22
25
|
|
23
|
-
|
26
|
+
Then add the gem to your Jekyll configuration.
|
24
27
|
|
25
28
|
gems:
|
26
|
-
-
|
29
|
+
-octopress-include-tag
|
27
30
|
|
28
31
|
## Usage
|
29
32
|
|
30
33
|
Use this just like the regular Jekyll include tag.
|
31
34
|
|
32
|
-
|
33
|
-
|
35
|
+
```
|
36
|
+
{% include foo.html %} // renders _includes/foo.html
|
37
|
+
{% include foo.html happy="yep" %} // samea as above but {{ include.happy }} == "yep"
|
38
|
+
```
|
34
39
|
|
35
40
|
Include partials stored as a variable.
|
36
41
|
|
37
|
-
|
38
|
-
|
42
|
+
```
|
43
|
+
{% assign post_sidebar = "post_sidebar.html" %}
|
44
|
+
{% include post_sidebar %} // renders _includes/post_sidebar.html
|
45
|
+
```
|
39
46
|
|
40
47
|
Include partials conditionally, using `if`, `unless` and ternary logic.
|
41
48
|
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
```
|
50
|
+
{% include sidebar.html if site.theme.sidebar %}
|
51
|
+
{% include comments.html unless page.comments == false %}
|
52
|
+
{% include (post ? post_sidebar : page_sidebar) %}
|
53
|
+
```
|
45
54
|
|
46
55
|
Filter included partials.
|
47
56
|
|
48
|
-
|
49
|
-
|
57
|
+
```
|
58
|
+
{% include foo.html %} //=> Yo, what's up
|
59
|
+
{% include foo.html | upcase %} //=> YO, WHAT'S UP
|
60
|
+
```
|
50
61
|
|
51
62
|
Yes, it can handle a complex combination of features… but can you?
|
52
63
|
|
53
|
-
|
64
|
+
```
|
65
|
+
{% include (post ? post_sidebar : page_sidebar) | smart_quotes unless site.theme.sidebar == false %}
|
66
|
+
```
|
54
67
|
|
55
68
|
### Include partials with an Octopress Ink plugin.
|
56
69
|
|
@@ -76,23 +89,28 @@ render partials for the RSS feed.
|
|
76
89
|
</entry>
|
77
90
|
{% endfor %}
|
78
91
|
|
79
|
-
|
80
92
|
If you want to make a change to the `entry.xml` partial, you could create your own version at `_plugins/feeds/includes/entry.xml`.
|
81
93
|
Now whenever `{% include feeds:entry.xml %}` is called, the include tag will use *your* local partial instead of the plugin's partial.
|
82
94
|
|
83
95
|
Note: To make overriding partials easier, you can copy all of a plugin's partials to your local override path with the Octopress Ink command:
|
84
96
|
|
85
|
-
|
97
|
+
```
|
98
|
+
$ octopress ink copy [plugin-slug] [options]
|
99
|
+
```
|
86
100
|
|
87
101
|
To copy all includes from the feeds plugin, you'd run:
|
88
102
|
|
89
|
-
|
103
|
+
```
|
104
|
+
$ octopress ink copy feeds --includes
|
105
|
+
```
|
90
106
|
|
91
107
|
This will copy all of the partials from octopress-feeds to `_plugins/feeds/includes/`. Modify any of the partials, and delete those that you want to be read from the plugin.
|
92
108
|
|
93
109
|
To list all partials from a plugin, run:
|
94
110
|
|
95
|
-
|
111
|
+
```
|
112
|
+
$ octopress ink list [plugin-slug] --includes
|
113
|
+
```
|
96
114
|
|
97
115
|
Note: When a plugin is updated, your local partials may be out of date, but will still override the plugin's partials. Be sure to watch changelogs and try to keep your modifications current.
|
98
116
|
|
@@ -4,7 +4,7 @@ require "jekyll"
|
|
4
4
|
|
5
5
|
module Octopress
|
6
6
|
module Tags
|
7
|
-
module
|
7
|
+
module Include
|
8
8
|
class Tag < Liquid::Tag
|
9
9
|
PLUGIN_SYNTAX = /(.+?):(\S+)/
|
10
10
|
|
@@ -61,11 +61,13 @@ module Octopress
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
Liquid::Template.register_tag('include', Octopress::Tags::
|
64
|
+
Liquid::Template.register_tag('include', Octopress::Tags::Include::Tag)
|
65
65
|
|
66
66
|
if defined? Octopress::Docs
|
67
67
|
Octopress::Docs.add({
|
68
68
|
name: "Octopress Include Tag",
|
69
|
+
gem: "octopress-include-tag",
|
70
|
+
version: Octopress::Tags::Include::VERSION,
|
69
71
|
description: "Replaces Jekyll's include tag and adds conditional rendering, in-line filters and Octopress Ink features.",
|
70
72
|
path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
|
71
73
|
type: "tag",
|
@@ -5,7 +5,7 @@ require 'octopress-include-tag/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "octopress-include-tag"
|
8
|
-
spec.version = Octopress::Tags::
|
8
|
+
spec.version = Octopress::Tags::Include::VERSION
|
9
9
|
spec.authors = ["Brandon Mathis"]
|
10
10
|
spec.email = ["brandon@imathis.com"]
|
11
11
|
spec.summary = %q{A powerful include tag with conditions, filters and more}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-include-tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-tag-helpers
|