octopress-ink 1.0.0.alpha.25 → 1.0.0.alpha.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/octopress-ink/tags/wrap.rb +4 -8
- data/lib/octopress-ink/tags/yield.rb +4 -0
- data/lib/octopress-ink/version.rb +1 -1
- data/test/source/test_tags/wrap.html +12 -12
- 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: 4041475a8dfd1d7a88ed97361bcff4f2afa13a70
|
4
|
+
data.tar.gz: 8b31fd6fdfc677127555bbec33d09474cb61699d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e596f3368053dd56fc975e28f9956c488f6d4f58a681843cfbe266812031cf50c9aaf1dea6efeb18310411d546c49abe87942b7070ba4afc9ddba92c764bfe72
|
7
|
+
data.tar.gz: f05b1701b00b5737e7dc9003bd2c78f56ffca5916ed0f14d94444f1f6bb3a5f9d64a0117ac587770dac098b97ce837847c2b878fc9ec5cd3aecd78f59ae88a7c
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Octopress
|
4
4
|
module Tags
|
5
5
|
class WrapTag < Liquid::Block
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(tag_name, markup, tokens)
|
8
8
|
super
|
9
9
|
@og_markup = @markup = markup
|
@@ -11,6 +11,7 @@ module Octopress
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def render(context)
|
14
|
+
require 'pry-debugger'
|
14
15
|
markup = Helpers::Conditional.parse(@markup, context)
|
15
16
|
return unless markup
|
16
17
|
|
@@ -31,13 +32,8 @@ module Octopress
|
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
if wrap =~ HAS_YIELD && content != ''
|
37
|
-
$1 + content + $3
|
38
|
-
else
|
39
|
-
''
|
40
|
-
end
|
35
|
+
context.scopes.first['yield'] = content
|
36
|
+
super.strip
|
41
37
|
end
|
42
38
|
|
43
39
|
def error_msg(error)
|
@@ -5,6 +5,10 @@ module Octopress
|
|
5
5
|
class YieldTag < Liquid::Tag
|
6
6
|
|
7
7
|
def initialize(tag_name, markup, tokens)
|
8
|
+
if markup.strip == ''
|
9
|
+
raise IOError.new "Yield failed: {% #{tag_name} #{markup}%}. Please provide a block name to yield. - Syntax: {% yield block_name %}"
|
10
|
+
end
|
11
|
+
|
8
12
|
super
|
9
13
|
@markup = markup
|
10
14
|
if markup =~ Helpers::Var::HAS_FILTERS
|
@@ -4,28 +4,28 @@ layout: nil
|
|
4
4
|
{% assign some_bool = true %}
|
5
5
|
|
6
6
|
## Testing a simple wrap
|
7
|
-
[- Testing Include -] → {% wrap foo.html %}[- {
|
7
|
+
[- Testing Include -] → {% wrap foo.html %}[- {{ yield }} -]{% endwrap %}
|
8
8
|
|
9
9
|
## Local var passing
|
10
|
-
[- Testing Include var_test -] → {% wrap foo.html some_var="var_test" %}[- {
|
10
|
+
[- Testing Include var_test -] → {% wrap foo.html some_var="var_test" %}[- {{ yield }} -]{% endwrap %}
|
11
11
|
|
12
12
|
## Filter testing
|
13
|
-
[- TESTING INCLUDE -] → {% wrap foo.html | upcase %}[- {=yield} -]{% endwrap %}
|
14
|
-
[- TESTING FILTERS -] → {% wrap foo.html | replace:"Include","Filters" | upcase | %}[- {
|
13
|
+
[- TESTING INCLUDE -] → {% wrap foo.html | upcase %}[- {% assign foo = 'bar' %}{{ yield }} -]{% endwrap %}
|
14
|
+
[- TESTING FILTERS -] → {% wrap foo.html | replace:"Include","Filters" | upcase | %}[- {{ yield }} -]{% endwrap %}
|
15
15
|
|
16
16
|
## Conditional wrap
|
17
|
-
'' → '{% wrap foo.html unless true %}[- {
|
18
|
-
'' → '{% wrap foo.html unless some_bool %}[- {
|
19
|
-
[- Testing Include -] → {% wrap foo.html if true %}[- {
|
20
|
-
[- Testing Include -] → {% wrap foo.html if some_bool %}[- {
|
17
|
+
'' → '{% wrap foo.html unless true %}[- {{ yield }} -]{% endwrap %}'
|
18
|
+
'' → '{% wrap foo.html unless some_bool %}[- {{ yield }} -]{% endwrap %}'
|
19
|
+
[- Testing Include -] → {% wrap foo.html if true %}[- {{ yield }} -]{% endwrap %}
|
20
|
+
[- Testing Include -] → {% wrap foo.html if some_bool %}[- {{ yield }} -]{% endwrap %}
|
21
21
|
|
22
22
|
## Plugin wraps
|
23
|
-
[- include from plugin -] → {% wrap awesome-sauce:some-include.html %}[- {
|
24
|
-
[- Yo Dawg, I heard you like includes. -] → {% wrap theme:greet.html greeting="Yo Dawg" %}[- {
|
23
|
+
[- include from plugin -] → {% wrap awesome-sauce:some-include.html %}[- {{ yield }} -]{% endwrap %}
|
24
|
+
[- Yo Dawg, I heard you like includes. -] → {% wrap theme:greet.html greeting="Yo Dawg" %}[- {{ yield }} -]{% endwrap %}
|
25
25
|
|
26
26
|
## Wrap render
|
27
|
-
[- Testing Render -] → {% wrap_render test_render/_f.html %}[- {
|
27
|
+
[- Testing Render -] → {% wrap_render test_render/_f.html %}[- {{ yield }} -]{% endwrap_render %}
|
28
28
|
|
29
29
|
## Wrap yield
|
30
30
|
{% content_for test %}Testing wrap yield{% endcontent_for %}
|
31
|
-
[- Testing wrap yield -] → {% wrap_yield test %}[- {
|
31
|
+
[- Testing wrap yield -] → {% wrap_yield test %}[- {{ yield }} -]{% endwrap_yield %}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-ink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|