octopress-wrap-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 +5 -1
- data/README.md +1 -0
- data/lib/octopress-wrap-tag/version.rb +1 -1
- metadata +1 -3
- data/assets/docs/changelog.markdown +0 -8
- data/assets/docs/index.markdown +0 -148
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9c43afc13d89025d96c3dd3ff14b55fdf79c877
|
4
|
+
data.tar.gz: 3e81dffbdc4d04ff82081664d94bd8dfd46d734f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23d7fbae8c1c2dca525368e7c6c38c22f01b0d259480627f50b619fcaa84d5cde01db36511d4c2e0fffe32faaafdfe2ee1d164fcb745f379695cf79c27532896
|
7
|
+
data.tar.gz: 3d99b20d46377d8ceaa3be29ffce68883826e73b852c3405f328aabe87350496dbe84841daa3c3e73dd29c7cdc1a57059e162371c8923c681c3de50cabc19ceb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-wrap-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
|
@@ -166,8 +166,6 @@ files:
|
|
166
166
|
- LICENSE.txt
|
167
167
|
- README.md
|
168
168
|
- Rakefile
|
169
|
-
- assets/docs/changelog.markdown
|
170
|
-
- assets/docs/index.markdown
|
171
169
|
- lib/octopress-wrap-tag.rb
|
172
170
|
- lib/octopress-wrap-tag/version.rb
|
173
171
|
- octopress-wrap-tag.gemspec
|
data/assets/docs/index.markdown
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: "Octopress Wrap Tag"
|
3
|
-
---
|
4
|
-
|
5
|
-
A Liquid block tag which makes it easy to wrap an include, render or yield tag with html.
|
6
|
-
|
7
|
-
[](https://travis-ci.org/octopress/wrap-tag)
|
8
|
-
[](https://rubygems.org/gems/octopress-wrap-tag)
|
9
|
-
[](http://octopress.mit-license.org)
|
10
|
-
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
Add this line to your application's Gemfile:
|
14
|
-
|
15
|
-
gem 'octopress-wrap-tag'
|
16
|
-
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
$ bundle
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
|
23
|
-
$ gem install octopress-wrap-tag
|
24
|
-
|
25
|
-
Next add it to your gems list in Jekyll's `_config.yml`
|
26
|
-
|
27
|
-
gems:
|
28
|
-
- octopress-wrap-tag
|
29
|
-
|
30
|
-
## Usage
|
31
|
-
|
32
|
-
|
33
|
-
### Basic usage
|
34
|
-
|
35
|
-
the wrap tag is basically just wrapping Octopress's [include](https://github.com/octopress/include-tag),
|
36
|
-
[render](https://github.com/octopress/render-tag) and [yield](https://github.com/octopress/content-for)
|
37
|
-
tags with HTML in a liquid block tag. So all the features are the same.
|
38
|
-
|
39
|
-
The wrap tag supports all the same features that Octopress's [include](https://github.com/octopress/include-tag),
|
40
|
-
[render](https://github.com/octopress/render-tag) and [yield](https://github.com/octopress/content-for) tags support. This also means that `wrap yield` won't output anything if there isn't any content.
|
41
|
-
|
42
|
-
{% wrap include post.html %}
|
43
|
-
<article>{{ yield }}</article>
|
44
|
-
{% endwrap %}
|
45
|
-
|
46
|
-
{% wrap render ../LICENCE.md %}
|
47
|
-
<div class="licence-text">{{ yield }}</div>
|
48
|
-
{% endwrap %}
|
49
|
-
|
50
|
-
{% wrap yeild post_footer %}
|
51
|
-
<div class="post-footer">{{ yield }}</div>
|
52
|
-
{% endwrap %}
|
53
|
-
|
54
|
-
### Yield example
|
55
|
-
|
56
|
-
A great use case for `wrap yield` is to add content sections to a
|
57
|
-
template which can be easily and optionally filled from a post or page by using the
|
58
|
-
[content_for](https://github.com/octopress/content-for) tag. Here's an example.
|
59
|
-
|
60
|
-
// In a page template
|
61
|
-
|
62
|
-
<aside class="sidebar">
|
63
|
-
{% wrap yield sidebar_before %}
|
64
|
-
<section>{{ yield }}</section>
|
65
|
-
{% endwrap %}
|
66
|
-
|
67
|
-
// Regular sidebar content goes here //
|
68
|
-
|
69
|
-
{% wrap yield sidebar_after %}
|
70
|
-
<section>{{ yield }}</section>
|
71
|
-
{% endwrap %}
|
72
|
-
</aside>
|
73
|
-
|
74
|
-
Now in any post or page you can add custom content to the sidebar with a content_for tag.
|
75
|
-
|
76
|
-
// In a post
|
77
|
-
|
78
|
-
{% content_for sidebar_before %}
|
79
|
-
<h4>About this post</h4>
|
80
|
-
...
|
81
|
-
{% endcontent_for %}
|
82
|
-
|
83
|
-
This content will appear at the top of the sidebar, wrapped in a `section` element. The `sidebar_after` section won't be
|
84
|
-
rendered since it wasn't set in this post.
|
85
|
-
|
86
|
-
### Advanced features
|
87
|
-
|
88
|
-
The examples below only demonstrate wrapping the include tag for brevity, but as stated earlier, the wrap tag
|
89
|
-
is basically just wrapping Octopress's [include](https://github.com/octopress/include-tag),
|
90
|
-
[render](https://github.com/octopress/render-tag) and [yield](https://github.com/octopress/content-for)
|
91
|
-
tags with HTML in a liquid block tag. So all the features are the same.
|
92
|
-
|
93
|
-
// If a page has the following YAML front-matter
|
94
|
-
// sidebar: post_sidebar.html
|
95
|
-
|
96
|
-
{% wrap include page.sidebar %}
|
97
|
-
<aside>{{ yield }}</aside>
|
98
|
-
{% endwrap %}
|
99
|
-
|
100
|
-
Include partials conditionally, using `if`, `unless` and ternary logic.
|
101
|
-
|
102
|
-
{% wrap include page.sidebar if page.sidebar %}
|
103
|
-
<aside>{{ yield }}</aside>
|
104
|
-
{% endwrap %}
|
105
|
-
|
106
|
-
{% wrap include comments.html unless page.comments == false %}
|
107
|
-
<div class="post-comments">{{ yield }}</div>
|
108
|
-
{% endwrap %}
|
109
|
-
|
110
|
-
{% wrap include (post ? post_sidebar : page_sidebar) %}
|
111
|
-
<aside>{{ yield }}</aside>
|
112
|
-
{% endwrap %}
|
113
|
-
|
114
|
-
Filter included partials.
|
115
|
-
|
116
|
-
{% wrap include greeting.html %} yo, {{ yield }}{% endwrap %} //=> yo, what's up?
|
117
|
-
{% wrap include greeting.html %} yo, {{ yield | upcase }}{% endwrap %} //=> yo, WHAT'S UP?
|
118
|
-
{% wrap include greeting.html | upcase %} Yo, {{ yield }}{% endwrap %} //=> YO, WHAT'S UP?
|
119
|
-
|
120
|
-
|
121
|
-
### Include partials with an Octopress Ink plugin.
|
122
|
-
|
123
|
-
It's easy to include a partial from an Ink theme or plugin.
|
124
|
-
|
125
|
-
Here's the syntax
|
126
|
-
|
127
|
-
{% wrap include [plugin-slug]:[partial-name] %}
|
128
|
-
{{ yield }}
|
129
|
-
{% endwrap %}
|
130
|
-
|
131
|
-
Some examples:
|
132
|
-
|
133
|
-
{% wrap include theme:sidebar.html %} // Include the sidebar from a theme plugin
|
134
|
-
<aside>{{ yield }}</aside>
|
135
|
-
{% endwrap %}
|
136
|
-
|
137
|
-
{% wrap include twitter:feed.html %} // Include the feed from a twitter plugin
|
138
|
-
<div class="twitter-feed">{{ yield }}</div>
|
139
|
-
{% endwrap %}
|
140
|
-
|
141
|
-
|
142
|
-
## Contributing
|
143
|
-
|
144
|
-
1. Fork it ( https://github.com/octopress/wrap-tag/fork )
|
145
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
146
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
147
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
148
|
-
5. Create a new Pull Request
|