octopress-wrap-tag 1.0.3 → 1.1.0
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 +14 -10
- data/lib/octopress-wrap-tag/version.rb +1 -1
- data/lib/octopress-wrap-tag.rb +8 -0
- data/octopress-wrap-tag.gemspec +5 -0
- data/{.clash.yml → test/_clash.yml} +0 -0
- data/test/_expected/wrap.html +3 -0
- data/test/wrap.html +3 -0
- metadata +32 -5
- data/test/Gemfile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7d225366ce2656cef612efaf6a3153338f3d202
|
4
|
+
data.tar.gz: 997d4da4c4cf383657a0d29dfa3d2363a8a8caa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 173a2e9a6779e361e9c48a81e2c763ee732c248ef8d600d7ed09805a1a757fa8330fc18901036288bf94d1b8c2384bed9626347fed696b07fc9fb8e8de910472
|
7
|
+
data.tar.gz: 5cc827b55d7953117cf460f2b52e009a5c2f8dc53b8e4abc85b16b12fd9a06eb3c4b6e1e80dd00ddeeb6ae8317bd124d0dcf87187e9d7021f5a9cca810cd12a3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -30,12 +30,10 @@ Next add it to your gems list in Jekyll's `_config.yml`
|
|
30
30
|
|
31
31
|
### Basic usage
|
32
32
|
|
33
|
-
|
33
|
+
The wrap tag is basically just wrapping Octopress's [include](https://github.com/octopress/include-tag),
|
34
|
+
[return](https://github.com/octopress/return-tag),
|
34
35
|
[render](https://github.com/octopress/render-tag) and [yield](https://github.com/octopress/content-for)
|
35
|
-
tags with HTML in a liquid block tag.
|
36
|
-
|
37
|
-
The wrap tag supports all the same features that Octopress's [include](https://github.com/octopress/include-tag),
|
38
|
-
[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.
|
36
|
+
tags with HTML in a liquid block tag. This means that the wrap tag,supports conditional output, filters and all the other features these tags offer. This also means that `wrap yield` and `wrap return` won't output anything if there isn't any content.
|
39
37
|
|
40
38
|
```html
|
41
39
|
{% wrap include post.html %}
|
@@ -46,12 +44,16 @@ The wrap tag supports all the same features that Octopress's [include](https://g
|
|
46
44
|
<div class="licence-text">{{ yield }}</div>
|
47
45
|
{% endwrap %}
|
48
46
|
|
49
|
-
{% wrap
|
47
|
+
{% wrap yield post_footer %}
|
50
48
|
<div class="post-footer">{{ yield }}</div>
|
51
49
|
{% endwrap %}
|
50
|
+
|
51
|
+
{% wrap return site.author %}
|
52
|
+
Post by {{ yield }}
|
53
|
+
{% endrwap %}
|
52
54
|
```
|
53
55
|
|
54
|
-
### Yield
|
56
|
+
### Wrap Yield
|
55
57
|
|
56
58
|
A great use case for `wrap yield` is to add content sections to a
|
57
59
|
template which can be easily and optionally filled from a post or page by using the
|
@@ -90,9 +92,11 @@ rendered since it wasn't set in this post.
|
|
90
92
|
### Advanced features
|
91
93
|
|
92
94
|
The examples below only demonstrate wrapping the include tag for brevity, but as stated earlier, the wrap tag
|
93
|
-
|
94
|
-
[render](https://github.com/octopress/render-tag)
|
95
|
-
|
95
|
+
supports all the features of the [include](https://github.com/octopress/include-tag),
|
96
|
+
[render](https://github.com/octopress/render-tag),
|
97
|
+
[return](https://github.com/octopress/return-tag) and
|
98
|
+
[yield](https://github.com/octopress/content-for)
|
99
|
+
tags.
|
96
100
|
|
97
101
|
<!-- title:"If a page has this yaml front-matter" -->
|
98
102
|
```html
|
data/lib/octopress-wrap-tag.rb
CHANGED
@@ -4,6 +4,7 @@ require "octopress-tag-helpers"
|
|
4
4
|
require "octopress-include-tag"
|
5
5
|
require "octopress-render-tag"
|
6
6
|
require "octopress-content-for"
|
7
|
+
require "octopress-return-tag"
|
7
8
|
require "jekyll"
|
8
9
|
|
9
10
|
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
@@ -36,6 +37,9 @@ module Octopress
|
|
36
37
|
elsif markup =~ /^\s*include\s(.+)/
|
37
38
|
markup = $1
|
38
39
|
'include'
|
40
|
+
elsif markup =~ /^\s*return\s(.+)/
|
41
|
+
markup = $1
|
42
|
+
'return'
|
39
43
|
else
|
40
44
|
raise IOError.new "Wrap Failed: {% wrap #{@og_markup}%} - Which type of wrap: inlcude, yield, render? - Correct syntax: {% wrap type path or var [filters] [conditions] %}"
|
41
45
|
end
|
@@ -43,6 +47,10 @@ module Octopress
|
|
43
47
|
case type
|
44
48
|
when 'yield'
|
45
49
|
content = Octopress::Tags::Yield::Tag.new('yield', markup, []).render(context)
|
50
|
+
return '' if content.nil?
|
51
|
+
when 'return'
|
52
|
+
content = Octopress::Tags::ReturnTag::Tag.new('return', markup, []).render(context)
|
53
|
+
return '' if content.nil?
|
46
54
|
when 'render'
|
47
55
|
begin
|
48
56
|
content = Octopress::Tags::Render::Tag.new('render', markup, []).render(context)
|
data/octopress-wrap-tag.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_runtime_dependency "octopress-include-tag", "~> 1.0"
|
23
23
|
spec.add_runtime_dependency "octopress-render-tag", "~> 1.0"
|
24
24
|
spec.add_runtime_dependency "octopress-content-for", "~> 1.0"
|
25
|
+
spec.add_runtime_dependency "octopress-return-tag", "~> 1.0"
|
25
26
|
spec.add_runtime_dependency "jekyll", "~> 2.0"
|
26
27
|
|
27
28
|
spec.add_development_dependency "bundler", "~> 1.6"
|
@@ -29,4 +30,8 @@ Gem::Specification.new do |spec|
|
|
29
30
|
spec.add_development_dependency "clash"
|
30
31
|
spec.add_development_dependency "octopress-ink"
|
31
32
|
spec.add_development_dependency "octopress"
|
33
|
+
|
34
|
+
if RUBY_VERSION >= "2"
|
35
|
+
spec.add_development_dependency "octopress-debugger"
|
36
|
+
end
|
32
37
|
end
|
File without changes
|
data/test/_expected/wrap.html
CHANGED
data/test/wrap.html
CHANGED
@@ -31,3 +31,6 @@ partial: foo.html
|
|
31
31
|
{% content_for test %}Testing wrap yield{% endcontent_for %}
|
32
32
|
[- Testing wrap yield -] → {% wrap yield test %}[- {{ yield }} -]{% endwrap %}
|
33
33
|
|
34
|
+
## Wrap return
|
35
|
+
{% wrap return page.partial %}partial: {{ yield }}{% endwrap %}
|
36
|
+
'{% wrap return nuthin %}should be blank: {{ yield }}{% endwrap %}'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1.0
|
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-
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-tag-helpers
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: octopress-return-tag
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: jekyll
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +164,20 @@ dependencies:
|
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: octopress-debugger
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
153
181
|
description: A Liquid block tag which makes it easy to wrap an include, render or
|
154
182
|
yield tag with html
|
155
183
|
email:
|
@@ -158,7 +186,6 @@ executables: []
|
|
158
186
|
extensions: []
|
159
187
|
extra_rdoc_files: []
|
160
188
|
files:
|
161
|
-
- ".clash.yml"
|
162
189
|
- ".gitignore"
|
163
190
|
- ".travis.yml"
|
164
191
|
- CHANGELOG.md
|
@@ -170,7 +197,7 @@ files:
|
|
170
197
|
- lib/octopress-wrap-tag/version.rb
|
171
198
|
- octopress-wrap-tag.gemspec
|
172
199
|
- test/.gitignore
|
173
|
-
- test/
|
200
|
+
- test/_clash.yml
|
174
201
|
- test/_config.yml
|
175
202
|
- test/_expected/ink-wrap.html
|
176
203
|
- test/_expected/wrap.html
|
@@ -212,7 +239,7 @@ summary: A Liquid block tag which makes it easy to wrap an include, render or yi
|
|
212
239
|
tag with html
|
213
240
|
test_files:
|
214
241
|
- test/.gitignore
|
215
|
-
- test/
|
242
|
+
- test/_clash.yml
|
216
243
|
- test/_config.yml
|
217
244
|
- test/_expected/ink-wrap.html
|
218
245
|
- test/_expected/wrap.html
|