octopress-content-for 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b00f491415f1574e62450ab2eea178f3d7f2cac1
4
+ data.tar.gz: 4dc94a7236c206aa188c59b5ecd236ac08d65601
5
+ SHA512:
6
+ metadata.gz: d1dc8a458041d8ac422b2dffb4e26faa84119d3bff1bcd22839b0ee3ed5ede3a12554bdddf106ea766d1deff2c2f2745bb441c084d967081f52f07a54d37c043
7
+ data.tar.gz: 889f37e7c3a0a19d98e974d03366793a095a61fae3e5a676fc8926b0da4841aeb5969d0a8744d48584314220bf590ff42d334dedb6c27273901ebcc52eb02087
@@ -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
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ script: cd test && bundle exec clash
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ### 1.0.0 - 2014-07-15
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in octopress_render_tag.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,51 @@
1
+ # Octopress Content For
2
+
3
+ Add content_for and yield tags to Jekyll with conditional rendering and in-line filters.
4
+
5
+ [![Build Status](https://travis-ci.org/octopress/content-for.svg)](https://travis-ci.org/octopress/content-for)
6
+ [![Gem Version](http://img.shields.io/gem/v/octopress-content-for.svg)](https://rubygems.org/gems/octopress-content-for)
7
+ [![License](http://img.shields.io/:license-mit-blue.svg)](http://octopress.mit-license.org)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'octopress-content-for'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install octopress-content-for
22
+
23
+ ## Usage
24
+
25
+ Use it like a typical `content_for` tag.
26
+
27
+ {% content_for awesome_content %}
28
+ some content
29
+ {% endcontent_for %}
30
+
31
+ {% yield awesome_content %} //=> some content
32
+
33
+ Use in-line filters.
34
+
35
+ {% yield awesome_content | upcase %} //=> SOME CONTENT
36
+
37
+ Use conditional rendering in both `content_for` and `yield` tags.
38
+
39
+ {% content_for footer unless page.footer == false %}
40
+ Footer!
41
+ {% endcontent_for %}
42
+
43
+ {% yield footer if page.footer %}
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it ( https://github.com/octopress/content-for/fork )
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create a new Pull Request
@@ -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,8 @@
1
+ ---
2
+ title: "Changelog"
3
+ permalink: /changelog/
4
+ ---
5
+
6
+ ### 1.0.0 - 2014-07-15
7
+
8
+ - Initial release
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: "Octopress Content For"
3
+ ---
4
+
5
+ Add content_for and yield tags to Jekyll with conditional rendering and in-line filters.
6
+
7
+ [![Build Status](https://travis-ci.org/octopress/content-for.svg)](https://travis-ci.org/octopress/content-for)
8
+ [![Gem Version](http://img.shields.io/gem/v/octopress-content-for.svg)](https://rubygems.org/gems/octopress-content-for)
9
+ [![License](http://img.shields.io/:license-mit-blue.svg)](http://octopress.mit-license.org)
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'octopress-content-for'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install octopress-content-for
24
+
25
+ ## Usage
26
+
27
+ Use it like a typical `content_for` tag.
28
+
29
+ {% content_for awesome_content %}
30
+ some content
31
+ {% endcontent_for %}
32
+
33
+ {% yield awesome_content %} //=> some content
34
+
35
+ Use in-line filters.
36
+
37
+ {% yield awesome_content | upcase %} //=> SOME CONTENT
38
+
39
+ Use conditional rendering in both `content_for` and `yield` tags.
40
+
41
+ {% content_for footer unless page.footer == false %}
42
+ Footer!
43
+ {% endcontent_for %}
44
+
45
+ {% yield footer if page.footer %}
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it ( https://github.com/octopress/content-for/fork )
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create a new Pull Request
@@ -0,0 +1,59 @@
1
+ require "octopress-content-for/version"
2
+ require "octopress-content-for/ink-plugin"
3
+ require "octopress-tag-helpers"
4
+
5
+ module Octopress
6
+ module Tags
7
+ module ContentFor
8
+ class Tag < Liquid::Block
9
+
10
+ def initialize(tag_name, markup, tokens)
11
+ super
12
+ @tag_name = tag_name
13
+ @markup = markup
14
+ end
15
+
16
+ def render(context)
17
+ return unless markup = TagHelpers::Conditional.parse(@markup, context)
18
+
19
+ @block_name ||= TagHelpers::ContentFor.get_block_name(@tag_name, markup)
20
+ TagHelpers::ContentFor.append_to_block(context, @block_name, super)
21
+ ''
22
+ end
23
+ end
24
+ end
25
+
26
+ module Yield
27
+ class Tag < Liquid::Tag
28
+
29
+ def initialize(tag_name, markup, tokens)
30
+ if markup.strip == ''
31
+ raise IOError.new "Yield failed: {% #{tag_name} #{markup}%}. Please provide a block name to yield. - Syntax: {% yield block_name %}"
32
+ end
33
+
34
+ super
35
+ @markup = markup
36
+ if markup =~ TagHelpers::Var::HAS_FILTERS
37
+ markup = $1
38
+ @filters = $2
39
+ end
40
+ @block_name = TagHelpers::ContentFor.get_block_name(tag_name, markup)
41
+ end
42
+
43
+ def render(context)
44
+ return unless markup = TagHelpers::Conditional.parse(@markup, context)
45
+ content = TagHelpers::ContentFor.render(context, @block_name)
46
+
47
+ unless content.nil? || @filters.nil?
48
+ content = TagHelpers::Var.render_filters(content, @filters, context)
49
+ end
50
+
51
+ content
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ Liquid::Template.register_tag('content_for', Octopress::Tags::ContentFor::Tag)
59
+ Liquid::Template.register_tag('yield', Octopress::Tags::Yield::Tag)
@@ -0,0 +1,25 @@
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
+
@@ -0,0 +1,11 @@
1
+ begin
2
+ require 'octopress-ink'
3
+
4
+ Octopress::Ink.add_plugin({
5
+ name: 'Include Tag',
6
+ assets_path: File.join(File.expand_path(File.dirname(__FILE__)), '../../assets' ),
7
+ description: "Test some plugins y'all"
8
+ })
9
+ rescue LoadError
10
+ end
11
+
@@ -0,0 +1,7 @@
1
+ module Octopress
2
+ module Tags
3
+ module ContentFor
4
+ VERSION = "1.0.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,36 @@
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
+
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'octopress-content-for/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "octopress-content-for"
8
+ spec.version = Octopress::Tags::ContentFor::VERSION
9
+ spec.authors = ["Brandon Mathis"]
10
+ spec.email = ["brandon@imathis.com"]
11
+ spec.summary = %q{Jekyll content_for and yield tags with conditional rendering and in-line filters}
12
+ spec.description = %q{Jekyll content_for and yield tags with conditional rendering and in-line filters}
13
+ spec.homepage = "https://github.com/octopress/content-for"
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 "jekyll", "~> 2.0"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "clash"
27
+ spec.add_development_dependency "octopress-ink"
28
+ end
@@ -0,0 +1,2 @@
1
+ build: true
2
+ compare: _expected _site
@@ -0,0 +1 @@
1
+ _site
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'octopress-content-for', path: '../'
4
+ gem 'pry-debugger'
5
+ gem 'clash'
@@ -0,0 +1,9 @@
1
+ # Site settings
2
+ name: Your New Jekyll Site
3
+ url: "http://yourdomain.com"
4
+
5
+ markdown: rdiscount
6
+ exclude:
7
+ - Gemfile*
8
+ gems:
9
+ - octopress-content-for
@@ -0,0 +1,20 @@
1
+ HEAD
2
+ Testing
3
+ content_for
4
+
5
+ Testing
6
+ content_for
7
+
8
+
9
+ GOOOOOOOAL! → GOOOOOOOAL!
10
+
11
+
12
+ '' → ''
13
+
14
+
15
+ '' → ''
16
+
17
+
18
+
19
+
20
+ FEET
@@ -0,0 +1,3 @@
1
+ {% yield head %}
2
+ {{ content }}
3
+ {% yield foot %}
@@ -0,0 +1,22 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+ Testing
5
+ content_for
6
+ → {% content_for test %}
7
+ Testing
8
+ {% endcontent_for %}{% content_for test %}
9
+ content_for
10
+ {% endcontent_for %}{% yield test %}
11
+
12
+ {% content_for test2 %}goooooooal!{% endcontent_for %}
13
+ GOOOOOOOAL! → {% yield test2 | upcase %}
14
+
15
+ {% content_for test3 if site.sidebar == true %}Nothing!{% endcontent_for %}
16
+ '' → '{% yield test3 %}'
17
+
18
+ {% content_for test4 %}Nothing!{% endcontent_for %}
19
+ '' → '{% yield test3 if site.sidebar == true %}'
20
+
21
+ {% content_for head %}HEAD{% endcontent_for %}
22
+ {% content_for foot %}FEET{% endcontent_for %}
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octopress-content-for
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-15 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: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: clash
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: octopress-ink
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Jekyll content_for and yield tags with conditional rendering and in-line
98
+ filters
99
+ email:
100
+ - brandon@imathis.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".travis.yml"
107
+ - CHANGELOG.md
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - assets/docs/changelog.markdown
113
+ - assets/docs/index.markdown
114
+ - lib/octopress-content-for.rb
115
+ - lib/octopress-content-for/content-for.rb
116
+ - lib/octopress-content-for/ink-plugin.rb
117
+ - lib/octopress-content-for/version.rb
118
+ - lib/octopress-content-for/yield.rb
119
+ - octopress-content-for.gemspec
120
+ - test/.clash.yml
121
+ - test/.gitignore
122
+ - test/Gemfile
123
+ - test/_config.yml
124
+ - test/_expected/content_for.html
125
+ - test/_layouts/default.html
126
+ - test/content_for.html
127
+ homepage: https://github.com/octopress/content-for
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.2.2
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Jekyll content_for and yield tags with conditional rendering and in-line
151
+ filters
152
+ test_files:
153
+ - test/.clash.yml
154
+ - test/.gitignore
155
+ - test/Gemfile
156
+ - test/_config.yml
157
+ - test/_expected/content_for.html
158
+ - test/_layouts/default.html
159
+ - test/content_for.html