octopress-wrap-tag 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5e469df46d5b7be7e0ae98a34c26a4e2fee1c83
4
- data.tar.gz: 71ac2161026cce8a610c20f7b493dfcc52e5d918
3
+ metadata.gz: b7d225366ce2656cef612efaf6a3153338f3d202
4
+ data.tar.gz: 997d4da4c4cf383657a0d29dfa3d2363a8a8caa8
5
5
  SHA512:
6
- metadata.gz: da4ef0afe18da337821b8787ed2fb900d54adf967f92f3b0f1b807a6d97be87265555c4743794ab35d06902b759cd3ae79de8f2053c12417d390d19be0e5f44f
7
- data.tar.gz: aefc65f66d34746e53e6af5740e8be1b7ba89183996f9b1ef854c8892be8164bb21005eecd5ad9ea5650274e476c6b0d43cc01bd1aa3baf59c81e52540779796
6
+ metadata.gz: 173a2e9a6779e361e9c48a81e2c763ee732c248ef8d600d7ed09805a1a757fa8330fc18901036288bf94d1b8c2384bed9626347fed696b07fc9fb8e8de910472
7
+ data.tar.gz: 5cc827b55d7953117cf460f2b52e009a5c2f8dc53b8e4abc85b16b12fd9a06eb3c4b6e1e80dd00ddeeb6ae8317bd124d0dcf87187e9d7021f5a9cca810cd12a3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.1.0 - 2015-04-01
4
+
5
+ - New: `wrap return` wraps return tag output.
6
+
3
7
  ### 1.0.3 - 2015-01-11
4
8
 
5
9
  - Readme fix
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
- the wrap tag is basically just wrapping Octopress's [include](https://github.com/octopress/include-tag),
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. So all the features are the same.
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 yeild post_footer %}
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 example
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
- is basically just wrapping Octopress's [include](https://github.com/octopress/include-tag),
94
- [render](https://github.com/octopress/render-tag) and [yield](https://github.com/octopress/content-for)
95
- tags with HTML in a liquid block tag. So all the features are the same.
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
@@ -1,7 +1,7 @@
1
1
  module Octopress
2
2
  module Tags
3
3
  module Wrap
4
- VERSION = "1.0.3"
4
+ VERSION = "1.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -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)
@@ -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
@@ -28,3 +28,6 @@
28
28
 
29
29
  [- Testing wrap yield -] → [- Testing wrap yield -]
30
30
 
31
+ ## Wrap return
32
+ partial: foo.html
33
+ ''
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.3
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-01-12 00:00:00.000000000 Z
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/Gemfile
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/Gemfile
242
+ - test/_clash.yml
216
243
  - test/_config.yml
217
244
  - test/_expected/ink-wrap.html
218
245
  - test/_expected/wrap.html
data/test/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'octopress-wrap-tag', path: '../'
4
- gem 'octopress'
5
- gem 'octopress-ink'
6
- gem 'pry-debugger'
7
- gem 'clash'