octopress-content-for 1.0.1 → 1.0.2
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/{test/.clash.yml → .clash.yml} +0 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +23 -15
- data/assets/docs/changelog.markdown +4 -0
- data/assets/docs/index.markdown +5 -0
- data/lib/octopress-content-for.rb +11 -1
- data/lib/octopress-content-for/version.rb +1 -1
- data/test/_site/content_for.html +20 -0
- metadata +5 -11
- data/lib/octopress-content-for/content-for.rb +0 -25
- data/lib/octopress-content-for/ink-plugin.rb +0 -11
- data/lib/octopress-content-for/yield.rb +0 -36
- data/test/.gitignore +0 -1
- data/test/Gemfile +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30eb3fa2dda34869a8f7f55a0091c690230d55df
|
4
|
+
data.tar.gz: d971ad2695c8633681a3b29efa8aeb7eaec1e6b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f001dacb982a5d94418d5ce991ea9937fa59f9930c2cea3fefe90660caa9854d8d5afe7f257da83940002fc5f9735d938e4e25b4e037b939fa05f34d5239a42
|
7
|
+
data.tar.gz: cb3b8d567b6518a9a562eee73231139e8b5897c610afae63170871a3b241aea57790c43e14ebe9c1fb9f8f33dfae4452202857554e0fb83b8e326b465212dd87
|
File without changes
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -8,44 +8,52 @@ Add content_for and yield tags to Jekyll with conditional rendering and in-line
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
|
11
|
+
If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
|
12
12
|
|
13
|
-
|
13
|
+
group :jekyll_plugins do
|
14
|
+
gem 'octopress-content-for'
|
15
|
+
end
|
14
16
|
|
15
|
-
|
17
|
+
Then install the gem with Bundler
|
16
18
|
|
17
19
|
$ bundle
|
18
20
|
|
19
|
-
|
21
|
+
To install manually without bundler:
|
20
22
|
|
21
23
|
$ gem install octopress-content-for
|
22
24
|
|
23
|
-
|
25
|
+
Then add the gem to your Jekyll configuration.
|
24
26
|
|
25
27
|
gems:
|
26
|
-
-
|
28
|
+
-octopress-content-for
|
27
29
|
|
28
30
|
## Usage
|
29
31
|
|
30
32
|
Use it like a typical `content_for` tag.
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
```
|
35
|
+
{% content_for awesome_content %}
|
36
|
+
some content
|
37
|
+
{% endcontent_for %}
|
35
38
|
|
36
|
-
|
39
|
+
{% yield awesome_content %} //=> some content
|
40
|
+
```
|
37
41
|
|
38
42
|
Use in-line filters.
|
39
43
|
|
40
|
-
|
44
|
+
```
|
45
|
+
{% yield awesome_content | upcase %} //=> SOME CONTENT
|
46
|
+
```
|
41
47
|
|
42
48
|
Use conditional rendering in both `content_for` and `yield` tags.
|
43
49
|
|
44
|
-
|
45
|
-
|
46
|
-
|
50
|
+
```
|
51
|
+
{% content_for footer unless page.footer == false %}
|
52
|
+
Footer!
|
53
|
+
{% endcontent_for %}
|
47
54
|
|
48
|
-
|
55
|
+
{% yield footer if page.footer %}
|
56
|
+
```
|
49
57
|
|
50
58
|
## Contributing
|
51
59
|
|
data/assets/docs/index.markdown
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "octopress-content-for/version"
|
2
|
-
require "octopress-content-for/ink-plugin"
|
3
2
|
require "octopress-tag-helpers"
|
4
3
|
|
5
4
|
module Octopress
|
@@ -57,3 +56,14 @@ end
|
|
57
56
|
|
58
57
|
Liquid::Template.register_tag('content_for', Octopress::Tags::ContentFor::Tag)
|
59
58
|
Liquid::Template.register_tag('yield', Octopress::Tags::Yield::Tag)
|
59
|
+
|
60
|
+
if defined? Octopress::Docs
|
61
|
+
Octopress::Docs.add({
|
62
|
+
name: "Octopress Content For",
|
63
|
+
gem: "octopress-content-for",
|
64
|
+
version: Octopress::Tags::ContentFor::VERSION,
|
65
|
+
description: "A framework for writing Jekyll sites ",
|
66
|
+
path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
|
67
|
+
source_url: "https://github.com/octopress/content-for"
|
68
|
+
})
|
69
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-content-for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-tag-helpers
|
@@ -102,6 +102,7 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".clash.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".travis.yml"
|
107
108
|
- CHANGELOG.md
|
@@ -112,17 +113,12 @@ files:
|
|
112
113
|
- assets/docs/changelog.markdown
|
113
114
|
- assets/docs/index.markdown
|
114
115
|
- lib/octopress-content-for.rb
|
115
|
-
- lib/octopress-content-for/content-for.rb
|
116
|
-
- lib/octopress-content-for/ink-plugin.rb
|
117
116
|
- lib/octopress-content-for/version.rb
|
118
|
-
- lib/octopress-content-for/yield.rb
|
119
117
|
- octopress-content-for.gemspec
|
120
|
-
- test/.clash.yml
|
121
|
-
- test/.gitignore
|
122
|
-
- test/Gemfile
|
123
118
|
- test/_config.yml
|
124
119
|
- test/_expected/content_for.html
|
125
120
|
- test/_layouts/default.html
|
121
|
+
- test/_site/content_for.html
|
126
122
|
- test/content_for.html
|
127
123
|
homepage: https://github.com/octopress/content-for
|
128
124
|
licenses:
|
@@ -150,10 +146,8 @@ specification_version: 4
|
|
150
146
|
summary: Jekyll content_for and yield tags with conditional rendering and in-line
|
151
147
|
filters
|
152
148
|
test_files:
|
153
|
-
- test/.clash.yml
|
154
|
-
- test/.gitignore
|
155
|
-
- test/Gemfile
|
156
149
|
- test/_config.yml
|
157
150
|
- test/_expected/content_for.html
|
158
151
|
- test/_layouts/default.html
|
152
|
+
- test/_site/content_for.html
|
159
153
|
- test/content_for.html
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
2
|
-
#
|
3
|
-
module Octopress
|
4
|
-
module Tags
|
5
|
-
module ContentFor
|
6
|
-
class Tag < Liquid::Block
|
7
|
-
|
8
|
-
def initialize(tag_name, markup, tokens)
|
9
|
-
super
|
10
|
-
@tag_name = tag_name
|
11
|
-
@markup = markup
|
12
|
-
end
|
13
|
-
|
14
|
-
def render(context)
|
15
|
-
return unless markup = TagHelpers::Conditional.parse(@markup, context)
|
16
|
-
|
17
|
-
@block_name ||= TagHelpers::ContentFor.get_block_name(@tag_name, markup)
|
18
|
-
TagHelpers::ContentFor.append_to_block(context, @block_name, super)
|
19
|
-
''
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'octopress-ink'
|
3
|
-
|
4
|
-
Octopress::Ink.add_plugin({
|
5
|
-
name: 'Content For',
|
6
|
-
assets_path: File.join(File.expand_path(File.dirname(__FILE__)), '../../assets' ),
|
7
|
-
description: "Add content_for and yield tags to Jekyll with conditional rendering and in-line filters."
|
8
|
-
})
|
9
|
-
rescue LoadError
|
10
|
-
end
|
11
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# Inspired by jekyll-contentblocks https://github.com/rustygeldmacher/jekyll-contentblocks
|
2
|
-
#
|
3
|
-
module Octopress
|
4
|
-
module Tags
|
5
|
-
module Yield
|
6
|
-
class Tag < Liquid::Tag
|
7
|
-
|
8
|
-
def initialize(tag_name, markup, tokens)
|
9
|
-
if markup.strip == ''
|
10
|
-
raise IOError.new "Yield failed: {% #{tag_name} #{markup}%}. Please provide a block name to yield. - Syntax: {% yield block_name %}"
|
11
|
-
end
|
12
|
-
|
13
|
-
super
|
14
|
-
@markup = markup
|
15
|
-
if markup =~ TagHelpers::Var::HAS_FILTERS
|
16
|
-
markup = $1
|
17
|
-
@filters = $2
|
18
|
-
end
|
19
|
-
@block_name = TagHelpers::ContentFor.get_block_name(tag_name, markup)
|
20
|
-
end
|
21
|
-
|
22
|
-
def render(context)
|
23
|
-
return unless markup = TagHelpers::Conditional.parse(@markup, context)
|
24
|
-
content = TagHelpers::ContentFor.render(context, @block_name)
|
25
|
-
|
26
|
-
unless content.nil? || @filters.nil?
|
27
|
-
content = TagHelpers::Var.render_filters(content, @filters, context)
|
28
|
-
end
|
29
|
-
|
30
|
-
content
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
data/test/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
_site
|