octopress-wrap-tag 1.0.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 +7 -0
- data/.gitignore +22 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +131 -0
- data/Rakefile +9 -0
- data/assets/docs/changelog.markdown +8 -0
- data/assets/docs/index.markdown +133 -0
- data/lib/octopress-wrap-tag.rb +91 -0
- data/lib/octopress-wrap-tag/ink-plugin.rb +11 -0
- data/lib/octopress-wrap-tag/version.rb +7 -0
- data/octopress-wrap-tag.gemspec +32 -0
- data/test/.clash.yml +2 -0
- data/test/.gitignore +1 -0
- data/test/Gemfile +7 -0
- data/test/_config.yml +9 -0
- data/test/_expected/ink-wrap.html +6 -0
- data/test/_expected/wrap.html +30 -0
- data/test/_includes/bar.html +1 -0
- data/test/_includes/foo.html +1 -0
- data/test/_ink_plugins/test-plugin/includes/bar.html +1 -0
- data/test/_ink_plugins/test-plugin/includes/greet.html +1 -0
- data/test/_ink_plugins/test-plugin/includes/some-include.html +1 -0
- data/test/_ink_plugins/test-plugin/test.rb +8 -0
- data/test/_plugins/loader.rb +1 -0
- data/test/_plugins/test-plugin/includes/bar.html +1 -0
- data/test/ink-wrap.html +8 -0
- data/test/test_render/_f.html +1 -0
- data/test/wrap.html +33 -0
- metadata +233 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7e037650aa5dc1d0cab69c975cd5d990abbfe4fe
|
4
|
+
data.tar.gz: b75362d458cfc200894c9613635086674b960b3e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3482a23bc0a51ff0757c5d16f7c2ebea79605358db96ab4dcb23b8c59e8943503a9513768a299313acb445e39f883da3cd23012381efe63e50e5cd51fb56b265
|
7
|
+
data.tar.gz: 62c0c6c9f67389f8be9ad6d952e2585d7e361666c9eaecfcc4f05a9bf0254d9109ef079be8e1946ddd8d2c41f535ba15b9748387fe9fd267ac45fac4a43dc3b2
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Brandon Mathis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# Octopress Wrap Tag
|
2
|
+
|
3
|
+
A Liquid block tag which makes it easy to wrap an include, render or yield tag with html.
|
4
|
+
|
5
|
+
[](https://travis-ci.org/octopress/wrap-tag)
|
6
|
+
[](https://rubygems.org/gems/octopress-wrap-tag)
|
7
|
+
[](http://octopress.mit-license.org)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'octopress-wrap-tag'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install octopress-wrap-tag
|
22
|
+
|
23
|
+
Next add it to your gems list in Jekyll's `_config.yml`
|
24
|
+
|
25
|
+
gems:
|
26
|
+
- octopress-wrap-tag
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Use this just like the Octopress include, render or yield tags, but wrap the output.
|
31
|
+
|
32
|
+
{% wrap include post.html %}
|
33
|
+
<article>{{ yield }}</article>
|
34
|
+
{% endwrap %}
|
35
|
+
|
36
|
+
{% wrap render ../LICENCE.md %}
|
37
|
+
<div class="licence-text">{{ yield }}</div>
|
38
|
+
{% endwrap %}
|
39
|
+
|
40
|
+
{% wrap yeild post_footer %}
|
41
|
+
<div class="post-footer">{{ yield }}</div>
|
42
|
+
{% endwrap %}
|
43
|
+
|
44
|
+
These wrap tags support all the same features that include, render and yield tags support. This also means that `wrap
|
45
|
+
yield` won't output anything if there isn't any content. A great use case for `wrap yield` is to add content sections to a
|
46
|
+
template which can be easily and optionally filled in a post or page, simply by using the
|
47
|
+
[content_for](https://github.com/octopress/content-for) tag.
|
48
|
+
|
49
|
+
Include partials stored as a variable.
|
50
|
+
|
51
|
+
// If a page has the following YAML front-matter
|
52
|
+
// sidebar: post_sidebar.html
|
53
|
+
|
54
|
+
{% wrap include page.sidebar %}
|
55
|
+
<aside>{{ yield }}</aside>
|
56
|
+
{% endwrap %}
|
57
|
+
|
58
|
+
Include partials conditionally, using `if`, `unless` and ternary logic.
|
59
|
+
|
60
|
+
{% wrap include page.sidebar if page.sidebar %}
|
61
|
+
<aside>{{ yield }}</aside>
|
62
|
+
{% endwrap %}
|
63
|
+
|
64
|
+
{% wrap include comments.html unless page.comments == false %}
|
65
|
+
<div class="post-comments">{{ yield }}</div>
|
66
|
+
{% endwrap %}
|
67
|
+
|
68
|
+
{% wrap include (post ? post_sidebar : page_sidebar) %}
|
69
|
+
<aside>{{ yield }}</aside>
|
70
|
+
{% endwrap %}
|
71
|
+
|
72
|
+
Filter included partials.
|
73
|
+
|
74
|
+
{% include foo.html %} //=> Yo, what's up
|
75
|
+
{% include foo.html | upcase %} //=> YO, WHAT'S UP
|
76
|
+
|
77
|
+
Yes, it can handle a complex combination of features… but can you?
|
78
|
+
|
79
|
+
{% include (post ? post_sidebar : page_sidebar) | smart_quotes unless site.theme.sidebar == false %}
|
80
|
+
|
81
|
+
### Include partials with an Octopress Ink plugin.
|
82
|
+
|
83
|
+
It's easy to include a partial from an Ink theme or plugin.
|
84
|
+
|
85
|
+
Here's the syntax
|
86
|
+
|
87
|
+
{% include [plugin-slug]:[partial-name] %}
|
88
|
+
|
89
|
+
Some examples:
|
90
|
+
|
91
|
+
{% include theme:sidebar.html %} // Include the sidebar from a theme plugin
|
92
|
+
{% include twitter:feed.html %} // Include the feed from a twitter plugin
|
93
|
+
|
94
|
+
#### Overriding theme/plugin partials
|
95
|
+
|
96
|
+
Plugins and themes use this tag internally too. For example, the [octopress-feeds plugin](https://github.com/octopress/feeds/blob/master/assets/pages/article-feed.xml#L10) uses the include tag to
|
97
|
+
render partials for the RSS feed.
|
98
|
+
|
99
|
+
{% for post in site.articles %}
|
100
|
+
<entry>
|
101
|
+
{% include feeds:entry.xml %}
|
102
|
+
</entry>
|
103
|
+
{% endfor %}
|
104
|
+
|
105
|
+
|
106
|
+
If you want to make a change to the `entry.xml` partial, you could create your own version at `_plugins/feeds/includes/entry.xml`.
|
107
|
+
Now whenever `{% include feeds:entry.xml %}` is called, the include tag will use *your* local partial instead of the plugin's partial.
|
108
|
+
|
109
|
+
Note: To make overriding partials easier, you can copy all of a plugin's partials to your local override path with the Octopress Ink command:
|
110
|
+
|
111
|
+
octopress ink copy [plugin-slug] [options]
|
112
|
+
|
113
|
+
To copy all includes from the feeds plugin, you'd run:
|
114
|
+
|
115
|
+
octopress ink copy feeds --includes
|
116
|
+
|
117
|
+
This will copy all of the partials from octopress-feeds to `_plugins/feeds/includes/`. Modify any of the partials, and delete those that you want to be read from the plugin.
|
118
|
+
|
119
|
+
To list all partials from a plugin, run:
|
120
|
+
|
121
|
+
octopress ink list [plugin-slug] --includes
|
122
|
+
|
123
|
+
Note: When a plugin is updated, your local partials may be out of date, but will still override the plugin's partials. Be sure to watch changelogs and try to keep your modifications current.
|
124
|
+
|
125
|
+
## Contributing
|
126
|
+
|
127
|
+
1. Fork it ( https://github.com/octopress/wrap-tag/fork )
|
128
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
129
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
130
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
131
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "octopress-ink"
|
3
|
+
|
4
|
+
desc "Copy Readme and Changelog into docs"
|
5
|
+
task :update_docs do
|
6
|
+
Octopress::Ink.copy_doc 'README.md', 'assets/docs/index.markdown'
|
7
|
+
Octopress::Ink.copy_doc 'CHANGELOG.md', 'assets/docs/changelog.markdown', '/changelog/'
|
8
|
+
end
|
9
|
+
|
@@ -0,0 +1,133 @@
|
|
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
|
+
Use this just like the Octopress include, render or yield tags, but wrap the output.
|
33
|
+
|
34
|
+
{% wrap include post.html %}
|
35
|
+
<article>{{ yield }}</article>
|
36
|
+
{% endwrap %}
|
37
|
+
|
38
|
+
{% wrap render ../LICENCE.md %}
|
39
|
+
<div class="licence-text">{{ yield }}</div>
|
40
|
+
{% endwrap %}
|
41
|
+
|
42
|
+
{% wrap yeild post_footer %}
|
43
|
+
<div class="post-footer">{{ yield }}</div>
|
44
|
+
{% endwrap %}
|
45
|
+
|
46
|
+
These wrap tags support all the same features that include, render and yield tags support. This also means that `wrap
|
47
|
+
yield` won't output anything if there isn't any content. A great use case for `wrap yield` is to add content sections to a
|
48
|
+
template which can be easily and optionally filled in a post or page, simply by using the
|
49
|
+
[content_for](https://github.com/octopress/content-for) tag.
|
50
|
+
|
51
|
+
Include partials stored as a variable.
|
52
|
+
|
53
|
+
// If a page has the following YAML front-matter
|
54
|
+
// sidebar: post_sidebar.html
|
55
|
+
|
56
|
+
{% wrap include page.sidebar %}
|
57
|
+
<aside>{{ yield }}</aside>
|
58
|
+
{% endwrap %}
|
59
|
+
|
60
|
+
Include partials conditionally, using `if`, `unless` and ternary logic.
|
61
|
+
|
62
|
+
{% wrap include page.sidebar if page.sidebar %}
|
63
|
+
<aside>{{ yield }}</aside>
|
64
|
+
{% endwrap %}
|
65
|
+
|
66
|
+
{% wrap include comments.html unless page.comments == false %}
|
67
|
+
<div class="post-comments">{{ yield }}</div>
|
68
|
+
{% endwrap %}
|
69
|
+
|
70
|
+
{% wrap include (post ? post_sidebar : page_sidebar) %}
|
71
|
+
<aside>{{ yield }}</aside>
|
72
|
+
{% endwrap %}
|
73
|
+
|
74
|
+
Filter included partials.
|
75
|
+
|
76
|
+
{% include foo.html %} //=> Yo, what's up
|
77
|
+
{% include foo.html | upcase %} //=> YO, WHAT'S UP
|
78
|
+
|
79
|
+
Yes, it can handle a complex combination of features… but can you?
|
80
|
+
|
81
|
+
{% include (post ? post_sidebar : page_sidebar) | smart_quotes unless site.theme.sidebar == false %}
|
82
|
+
|
83
|
+
### Include partials with an Octopress Ink plugin.
|
84
|
+
|
85
|
+
It's easy to include a partial from an Ink theme or plugin.
|
86
|
+
|
87
|
+
Here's the syntax
|
88
|
+
|
89
|
+
{% include [plugin-slug]:[partial-name] %}
|
90
|
+
|
91
|
+
Some examples:
|
92
|
+
|
93
|
+
{% include theme:sidebar.html %} // Include the sidebar from a theme plugin
|
94
|
+
{% include twitter:feed.html %} // Include the feed from a twitter plugin
|
95
|
+
|
96
|
+
#### Overriding theme/plugin partials
|
97
|
+
|
98
|
+
Plugins and themes use this tag internally too. For example, the [octopress-feeds plugin](https://github.com/octopress/feeds/blob/master/assets/pages/article-feed.xml#L10) uses the include tag to
|
99
|
+
render partials for the RSS feed.
|
100
|
+
|
101
|
+
{% for post in site.articles %}
|
102
|
+
<entry>
|
103
|
+
{% include feeds:entry.xml %}
|
104
|
+
</entry>
|
105
|
+
{% endfor %}
|
106
|
+
|
107
|
+
|
108
|
+
If you want to make a change to the `entry.xml` partial, you could create your own version at `_plugins/feeds/includes/entry.xml`.
|
109
|
+
Now whenever `{% include feeds:entry.xml %}` is called, the include tag will use *your* local partial instead of the plugin's partial.
|
110
|
+
|
111
|
+
Note: To make overriding partials easier, you can copy all of a plugin's partials to your local override path with the Octopress Ink command:
|
112
|
+
|
113
|
+
octopress ink copy [plugin-slug] [options]
|
114
|
+
|
115
|
+
To copy all includes from the feeds plugin, you'd run:
|
116
|
+
|
117
|
+
octopress ink copy feeds --includes
|
118
|
+
|
119
|
+
This will copy all of the partials from octopress-feeds to `_plugins/feeds/includes/`. Modify any of the partials, and delete those that you want to be read from the plugin.
|
120
|
+
|
121
|
+
To list all partials from a plugin, run:
|
122
|
+
|
123
|
+
octopress ink list [plugin-slug] --includes
|
124
|
+
|
125
|
+
Note: When a plugin is updated, your local partials may be out of date, but will still override the plugin's partials. Be sure to watch changelogs and try to keep your modifications current.
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
1. Fork it ( https://github.com/octopress/wrap-tag/fork )
|
130
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
131
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
132
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
133
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require "octopress-wrap-tag/version"
|
2
|
+
require "octopress-wrap-tag/ink-plugin"
|
3
|
+
|
4
|
+
require "octopress-tag-helpers"
|
5
|
+
require "octopress-include-tag"
|
6
|
+
require "octopress-render-tag"
|
7
|
+
require "octopress-content-for"
|
8
|
+
require "jekyll"
|
9
|
+
|
10
|
+
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
11
|
+
#
|
12
|
+
module Octopress
|
13
|
+
module Tags
|
14
|
+
module WrapTag
|
15
|
+
class Tag < Liquid::Block
|
16
|
+
|
17
|
+
def initialize(tag_name, markup, tokens)
|
18
|
+
super
|
19
|
+
@og_markup = @markup = markup
|
20
|
+
@tag_name = tag_name
|
21
|
+
end
|
22
|
+
|
23
|
+
def render(context)
|
24
|
+
return unless markup = TagHelpers::Conditional.parse(@markup, context)
|
25
|
+
|
26
|
+
if markup =~ TagHelpers::Var::HAS_FILTERS
|
27
|
+
markup = $1
|
28
|
+
filters = $2
|
29
|
+
end
|
30
|
+
|
31
|
+
type = if markup =~ /^\s*yield\s(.+)/
|
32
|
+
markup = $1
|
33
|
+
'yield'
|
34
|
+
elsif markup =~ /^\s*render\s(.+)/
|
35
|
+
markup = $1
|
36
|
+
'render'
|
37
|
+
elsif markup =~ /^\s*include\s(.+)/
|
38
|
+
markup = $1
|
39
|
+
'include'
|
40
|
+
else
|
41
|
+
raise IOError.new "Wrap Failed: {% wrap #{@og_markup}%} - Which type of wrap: inlcude, yield, render? - Correct syntax: {% wrap type path or var [filters] [conditions] %}"
|
42
|
+
end
|
43
|
+
|
44
|
+
case type
|
45
|
+
when 'yield'
|
46
|
+
content = Octopress::Tags::Yield::Tag.new('yield', markup, []).render(context)
|
47
|
+
when 'render'
|
48
|
+
begin
|
49
|
+
content = Octopress::Tags::RenderTag::Tag.new('render', markup, []).render(context)
|
50
|
+
rescue => error
|
51
|
+
error_msg error
|
52
|
+
end
|
53
|
+
when 'include'
|
54
|
+
begin
|
55
|
+
content = Octopress::Tags::IncludeTag::Tag.new('include', markup, []).render(context)
|
56
|
+
rescue => error
|
57
|
+
error_msg error
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# just in case yield had a value
|
62
|
+
old_yield = context.scopes.first['yield']
|
63
|
+
context.scopes.first['yield'] = content
|
64
|
+
|
65
|
+
content = super.strip
|
66
|
+
context.scopes.first['yield'] = old_yield
|
67
|
+
|
68
|
+
unless content.nil? || filters.nil?
|
69
|
+
content = TagHelpers::Var.render_filters(content, filters, context)
|
70
|
+
end
|
71
|
+
|
72
|
+
content
|
73
|
+
end
|
74
|
+
|
75
|
+
def error_msg(error)
|
76
|
+
error.message
|
77
|
+
message = "Wrap failed: {% #{@tag_name} #{@og_markup}%}."
|
78
|
+
message << $1 if error.message =~ /%}\.(.+)/
|
79
|
+
raise IOError.new message
|
80
|
+
end
|
81
|
+
|
82
|
+
def content_for(markup, context)
|
83
|
+
@block_name = TagHelpers::ContentFor.get_block_name(@tag_name, markup)
|
84
|
+
TagHelpers::ContentFor.render(context, @block_name).strip
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
Liquid::Template.register_tag('wrap', Octopress::Tags::WrapTag::Tag)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
begin
|
2
|
+
require 'octopress-ink'
|
3
|
+
|
4
|
+
Octopress::Ink.add_plugin({
|
5
|
+
name: 'Wrap Tag',
|
6
|
+
assets_path: File.join(File.expand_path(File.dirname(__FILE__)), '../../assets' ),
|
7
|
+
description: "A Liquid block tag which makes it easy to wrap an include, render or yield tag with html"
|
8
|
+
})
|
9
|
+
rescue LoadError
|
10
|
+
end
|
11
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'octopress-wrap-tag/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "octopress-wrap-tag"
|
8
|
+
spec.version = Octopress::Tags::WrapTag::VERSION
|
9
|
+
spec.authors = ["Brandon Mathis"]
|
10
|
+
spec.email = ["brandon@imathis.com"]
|
11
|
+
spec.summary = %q{A Liquid block tag which makes it easy to wrap an include, render or yield tag with html}
|
12
|
+
spec.description = %q{A Liquid block tag which makes it easy to wrap an include, render or yield tag with html}
|
13
|
+
spec.homepage = "https://github.com/octopress/wrap-tag"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "octopress-tag-helpers", "~> 1.0"
|
22
|
+
spec.add_runtime_dependency "octopress-include-tag", "~> 1.0"
|
23
|
+
spec.add_runtime_dependency "octopress-render-tag", "~> 1.0"
|
24
|
+
spec.add_runtime_dependency "octopress-content-for", "~> 1.0"
|
25
|
+
spec.add_runtime_dependency "jekyll", "~> 2.0"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "clash"
|
30
|
+
spec.add_development_dependency "octopress-ink"
|
31
|
+
spec.add_development_dependency "octopress"
|
32
|
+
end
|
data/test/.clash.yml
ADDED
data/test/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
_site
|
data/test/Gemfile
ADDED
data/test/_config.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
## Testing a simple wrap
|
4
|
+
[- Testing Include -] → [- Testing Include -]
|
5
|
+
|
6
|
+
## Local var passing
|
7
|
+
[- Testing Include var_test -] → [- Testing Include var_test -]
|
8
|
+
|
9
|
+
## Filter testing
|
10
|
+
[- TESTING INCLUDE -] → [- TESTING INCLUDE -]
|
11
|
+
[= TESTING INCLUDE =] → [= TESTING INCLUDE =]
|
12
|
+
[- TESTING FILTERS -] → [- TESTING FILTERS -]
|
13
|
+
|
14
|
+
## Conditional wrap
|
15
|
+
'' → ''
|
16
|
+
'' → ''
|
17
|
+
[- Testing Include -] → [- Testing Include -]
|
18
|
+
[- Testing Include -] → [- Testing Include -]
|
19
|
+
|
20
|
+
## Plugin wraps
|
21
|
+
[- include from plugin -] → [- include from plugin -]
|
22
|
+
[- Yo Dawg, I heard you like includes. -] → [- Yo Dawg, I heard you like includes. -]
|
23
|
+
|
24
|
+
## Wrap render
|
25
|
+
[- Testing Render -] → [- Testing Render -]
|
26
|
+
|
27
|
+
## Wrap yield
|
28
|
+
|
29
|
+
[- Testing wrap yield -] → [- Testing wrap yield -]
|
30
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
This shouldn't be here.
|
@@ -0,0 +1 @@
|
|
1
|
+
Testing Include {{ include.some_var }}
|
@@ -0,0 +1 @@
|
|
1
|
+
Plugin include
|
@@ -0,0 +1 @@
|
|
1
|
+
{{ include.greeting }}, I heard you like includes.
|
@@ -0,0 +1 @@
|
|
1
|
+
include from plugin
|
@@ -0,0 +1 @@
|
|
1
|
+
require './_ink_plugins/test-plugin/test.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
Overrides plugin include
|
data/test/ink-wrap.html
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
{% assign some_bool = true %}
|
4
|
+
|
5
|
+
## Ink include wrapping
|
6
|
+
[- include from plugin -] → {% wrap include test-plugin:some-include.html %}[- {{ yield }} -]{% endwrap %}
|
7
|
+
[- Yo Dawg, I heard you like includes. -] → {% wrap include test-plugin:greet.html greeting="Yo Dawg" %}[- {{ yield }} -]{% endwrap %}
|
8
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Testing Render {{ include.var }}
|
data/test/wrap.html
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
partial: foo.html
|
3
|
+
---
|
4
|
+
{% assign some_bool = true %}
|
5
|
+
|
6
|
+
## Testing a simple wrap
|
7
|
+
[- Testing Include -] → {% wrap include foo.html %}[- {{ yield }} -]{% endwrap %}
|
8
|
+
|
9
|
+
## Local var passing
|
10
|
+
[- Testing Include var_test -] → {% wrap include foo.html some_var="var_test" %}[- {{ yield }} -]{% endwrap %}
|
11
|
+
|
12
|
+
## Filter testing
|
13
|
+
[- TESTING INCLUDE -] → {% wrap include foo.html | upcase %}[- {% assign foo = 'bar' %}{{ yield }} -]{% endwrap %}
|
14
|
+
[= TESTING INCLUDE =] → {% wrap include foo.html | replace:"-","=" %}[- {{ yield | upcase }} -]{% endwrap %}
|
15
|
+
[- TESTING FILTERS -] → {% wrap include foo.html | replace:"INCLUDE","FILTERS" %}[- {{ yield | upcase }} -]{% endwrap %}
|
16
|
+
|
17
|
+
## Conditional wrap
|
18
|
+
'' → '{% wrap include foo.html unless true %}[- {{ yield }} -]{% endwrap %}'
|
19
|
+
'' → '{% wrap include foo.html unless some_bool %}[- {{ yield }} -]{% endwrap %}'
|
20
|
+
[- Testing Include -] → {% wrap include foo.html if true %}[- {{ yield }} -]{% endwrap %}
|
21
|
+
[- Testing Include -] → {% wrap include foo.html if some_bool %}[- {{ yield }} -]{% endwrap %}
|
22
|
+
|
23
|
+
## Plugin wraps
|
24
|
+
[- include from plugin -] → {% wrap include test-plugin:some-include.html %}[- {{ yield }} -]{% endwrap %}
|
25
|
+
[- Yo Dawg, I heard you like includes. -] → {% wrap include test-plugin:greet.html greeting="Yo Dawg" %}[- {{ yield }} -]{% endwrap %}
|
26
|
+
|
27
|
+
## Wrap render
|
28
|
+
[- Testing Render -] → {% wrap render test_render/_f.html %}[- {{ yield }} -]{% endwrap %}
|
29
|
+
|
30
|
+
## Wrap yield
|
31
|
+
{% content_for test %}Testing wrap yield{% endcontent_for %}
|
32
|
+
[- Testing wrap yield -] → {% wrap yield test %}[- {{ yield }} -]{% endwrap %}
|
33
|
+
|
metadata
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: octopress-wrap-tag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Mathis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octopress-tag-helpers
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octopress-include-tag
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: octopress-render-tag
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: octopress-content-for
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jekyll
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: clash
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: octopress-ink
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: octopress
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: A Liquid block tag which makes it easy to wrap an include, render or
|
154
|
+
yield tag with html
|
155
|
+
email:
|
156
|
+
- brandon@imathis.com
|
157
|
+
executables: []
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".travis.yml"
|
163
|
+
- CHANGELOG.md
|
164
|
+
- Gemfile
|
165
|
+
- LICENSE.txt
|
166
|
+
- README.md
|
167
|
+
- Rakefile
|
168
|
+
- assets/docs/changelog.markdown
|
169
|
+
- assets/docs/index.markdown
|
170
|
+
- lib/octopress-wrap-tag.rb
|
171
|
+
- lib/octopress-wrap-tag/ink-plugin.rb
|
172
|
+
- lib/octopress-wrap-tag/version.rb
|
173
|
+
- octopress-wrap-tag.gemspec
|
174
|
+
- test/.clash.yml
|
175
|
+
- test/.gitignore
|
176
|
+
- test/Gemfile
|
177
|
+
- test/_config.yml
|
178
|
+
- test/_expected/ink-wrap.html
|
179
|
+
- test/_expected/wrap.html
|
180
|
+
- test/_includes/bar.html
|
181
|
+
- test/_includes/foo.html
|
182
|
+
- test/_ink_plugins/test-plugin/includes/bar.html
|
183
|
+
- test/_ink_plugins/test-plugin/includes/greet.html
|
184
|
+
- test/_ink_plugins/test-plugin/includes/some-include.html
|
185
|
+
- test/_ink_plugins/test-plugin/test.rb
|
186
|
+
- test/_plugins/loader.rb
|
187
|
+
- test/_plugins/test-plugin/includes/bar.html
|
188
|
+
- test/ink-wrap.html
|
189
|
+
- test/test_render/_f.html
|
190
|
+
- test/wrap.html
|
191
|
+
homepage: https://github.com/octopress/wrap-tag
|
192
|
+
licenses:
|
193
|
+
- MIT
|
194
|
+
metadata: {}
|
195
|
+
post_install_message:
|
196
|
+
rdoc_options: []
|
197
|
+
require_paths:
|
198
|
+
- lib
|
199
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
requirements: []
|
210
|
+
rubyforge_project:
|
211
|
+
rubygems_version: 2.2.2
|
212
|
+
signing_key:
|
213
|
+
specification_version: 4
|
214
|
+
summary: A Liquid block tag which makes it easy to wrap an include, render or yield
|
215
|
+
tag with html
|
216
|
+
test_files:
|
217
|
+
- test/.clash.yml
|
218
|
+
- test/.gitignore
|
219
|
+
- test/Gemfile
|
220
|
+
- test/_config.yml
|
221
|
+
- test/_expected/ink-wrap.html
|
222
|
+
- test/_expected/wrap.html
|
223
|
+
- test/_includes/bar.html
|
224
|
+
- test/_includes/foo.html
|
225
|
+
- test/_ink_plugins/test-plugin/includes/bar.html
|
226
|
+
- test/_ink_plugins/test-plugin/includes/greet.html
|
227
|
+
- test/_ink_plugins/test-plugin/includes/some-include.html
|
228
|
+
- test/_ink_plugins/test-plugin/test.rb
|
229
|
+
- test/_plugins/loader.rb
|
230
|
+
- test/_plugins/test-plugin/includes/bar.html
|
231
|
+
- test/ink-wrap.html
|
232
|
+
- test/test_render/_f.html
|
233
|
+
- test/wrap.html
|