octopress-ink 1.0.0.alpha.27 → 1.0.0.alpha.28
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.rb +0 -2
- data/lib/octopress-ink/tags/wrap.rb +17 -4
- data/lib/octopress-ink/version.rb +1 -1
- data/test/source/test_tags/wrap.html +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc46c805b9c9408a12e59be45bce38d1e60a9b98
|
4
|
+
data.tar.gz: f3235034540210c39d801bfc0afb6cd2d7b7d3a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5448ac1ba45a66b2a692f1ffb1acc3e7955ac1639bb6df01d5f8c92c128edc7dedb8b7e00a47fefd0f6bc790bad94a57bf0c749b3af4ee62eb47ae44fdc991d0
|
7
|
+
data.tar.gz: 060ba433677737ad6fddc84b15b41016784c0c6a5c6138d10e987900b6590391729929c03eaae5d3dccd935b10b201067b45639d4de90fbab07a6ef6c5b0ca40
|
data/lib/octopress-ink.rb
CHANGED
@@ -40,8 +40,6 @@ Liquid::Template.register_tag('head', Octopress::Tags::HeadBlock)
|
|
40
40
|
Liquid::Template.register_tag('footer', Octopress::Tags::FooterBlock)
|
41
41
|
Liquid::Template.register_tag('scripts', Octopress::Tags::ScriptsBlock)
|
42
42
|
Liquid::Template.register_tag('yield', Octopress::Tags::YieldTag)
|
43
|
-
Liquid::Template.register_tag('wrap_yield', Octopress::Tags::WrapTag)
|
44
|
-
Liquid::Template.register_tag('wrap_render', Octopress::Tags::WrapTag)
|
45
43
|
Liquid::Template.register_tag('wrap', Octopress::Tags::WrapTag)
|
46
44
|
Liquid::Template.register_tag('_', Octopress::Tags::LineCommentTag)
|
47
45
|
|
@@ -15,16 +15,29 @@ module Octopress
|
|
15
15
|
markup = Helpers::Conditional.parse(@markup, context)
|
16
16
|
return unless markup
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
type = if markup =~ /^\s*yield\s(.+)/
|
19
|
+
markup = $1
|
20
|
+
'yield'
|
21
|
+
elsif markup =~ /^\s*render\s(.+)/
|
22
|
+
markup = $1
|
23
|
+
'render'
|
24
|
+
elsif markup =~ /^\s*include\s(.+)/
|
25
|
+
markup = $1
|
26
|
+
'include'
|
27
|
+
else
|
28
|
+
raise IOError.new "Wrap Failed: {% wrap #{@og_markup}%} - Which type of wrap: inlcude, yield, render? - Correct syntax: {% wrap type path or var [filters] [conditions] %}"
|
29
|
+
end
|
30
|
+
|
31
|
+
case type
|
32
|
+
when 'yield'
|
20
33
|
content = Tags::YieldTag.new('yield', markup, []).render(context)
|
21
|
-
when '
|
34
|
+
when 'render'
|
22
35
|
begin
|
23
36
|
content = Tags::RenderTag.new('render', markup, []).render(context)
|
24
37
|
rescue => error
|
25
38
|
error_msg error
|
26
39
|
end
|
27
|
-
when '
|
40
|
+
when 'include'
|
28
41
|
begin
|
29
42
|
content = Tags::IncludeTag.new('include', markup, []).render(context)
|
30
43
|
rescue => error
|
@@ -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 %}[- {{ yield }} -]{% endwrap %}
|
7
|
+
[- Testing Include -] → {% wrap include foo.html %}[- {{ yield }} -]{% endwrap %}
|
8
8
|
|
9
9
|
## Local var passing
|
10
|
-
[- Testing Include var_test -] → {% wrap foo.html some_var="var_test" %}[- {{ yield }} -]{% endwrap %}
|
10
|
+
[- Testing Include var_test -] → {% wrap include foo.html some_var="var_test" %}[- {{ yield }} -]{% endwrap %}
|
11
11
|
|
12
12
|
## Filter testing
|
13
|
-
[- TESTING INCLUDE -] → {% wrap foo.html | upcase %}[- {% assign foo = 'bar' %}{{ yield }} -]{% endwrap %}
|
14
|
-
[- TESTING FILTERS -] → {% wrap foo.html | replace:"Include","Filters"
|
13
|
+
[- TESTING INCLUDE -] → {% wrap include foo.html | upcase %}[- {% assign foo = 'bar' %}{{ yield }} -]{% endwrap %}
|
14
|
+
[- TESTING FILTERS -] → {% wrap include foo.html | replace:"Include","Filters" %}[- {{ yield | upcase }} -]{% endwrap %}
|
15
15
|
|
16
16
|
## Conditional wrap
|
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 %}
|
17
|
+
'' → '{% wrap include foo.html unless true %}[- {{ yield }} -]{% endwrap %}'
|
18
|
+
'' → '{% wrap include foo.html unless some_bool %}[- {{ yield }} -]{% endwrap %}'
|
19
|
+
[- Testing Include -] → {% wrap include foo.html if true %}[- {{ yield }} -]{% endwrap %}
|
20
|
+
[- Testing Include -] → {% wrap include foo.html if some_bool %}[- {{ yield }} -]{% endwrap %}
|
21
21
|
|
22
22
|
## Plugin wraps
|
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 %}
|
23
|
+
[- include from plugin -] → {% wrap include awesome-sauce:some-include.html %}[- {{ yield }} -]{% endwrap %}
|
24
|
+
[- Yo Dawg, I heard you like includes. -] → {% wrap include theme:greet.html greeting="Yo Dawg" %}[- {{ yield }} -]{% endwrap %}
|
25
25
|
|
26
26
|
## Wrap render
|
27
|
-
[- Testing Render -] → {%
|
27
|
+
[- Testing Render -] → {% wrap render test_render/_f.html %}[- {{ yield }} -]{% endwrap %}
|
28
28
|
|
29
29
|
## Wrap yield
|
30
30
|
{% content_for test %}Testing wrap yield{% endcontent_for %}
|
31
|
-
[- Testing wrap yield -] → {%
|
31
|
+
[- Testing wrap yield -] → {% wrap yield test %}[- {{ yield }} -]{% endwrap %}
|