jekyll-contentblocks 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5fa5ab18f418d6455911cf33dbb9ad6d8e08c52
4
- data.tar.gz: 8da924d203b87c0afb2767872386287b7ad9e4a8
3
+ metadata.gz: 40a997daa68a6ef8db0f0df0125d379c4a8fe962
4
+ data.tar.gz: ebafec9066fba596044477ede027e556c92de9b6
5
5
  SHA512:
6
- metadata.gz: 7247b7a4107c6d88be63576b06ea8dcd320c19e5b8a54509ebd3b2b1aef62bc3e5e756d1eb5269554e1e0c65d71d02bd4ff2238ad74b21a28256883808592112
7
- data.tar.gz: 977e960485aabbc1f811a34561e805ea8fb4cabccab90d70258967b3d73d17e66268a595846c9f1012e1bd8b40ec5418da7bc639365b96fff43d3fb8c8e4374a
6
+ metadata.gz: fb02de9135f264125157e2b0412ac3ab5b10234144f6c16e5300ee3e23adba036e9ca1ce20f90fb9ff37d966c044b6567317275757c16880aafa757a16ea2955
7
+ data.tar.gz: 39869c8dc1f4c427b17ce2fd1f4a128571ed8b00200d7c84ddeb6d32dd3f99e2aa070795e16ba9ff463f427295e78a37540ba2f947fbbc5c2651c8ff4a5e2a6a
@@ -0,0 +1 @@
1
+ 2.1.1
data/Appraisals CHANGED
@@ -45,3 +45,11 @@ end
45
45
  appraise "jekyll-2.5.3" do
46
46
  gem "jekyll", "2.5.3"
47
47
  end
48
+
49
+ appraise "jekyll-3.0.3" do
50
+ gem "jekyll", "3.0.3"
51
+ end
52
+
53
+ appraise "jekyll-3.1.2" do
54
+ gem "jekyll", "3.1.2"
55
+ end
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'jekyll', '> 1.0.0'
3
+ gem 'jekyll', '3.1.2'
4
4
  gem 'appraisal', '1.0.2'
5
5
 
6
6
  gem 'pry'
data/README.md CHANGED
@@ -9,7 +9,9 @@ layouts. It's kind of like having Rails' content_for available for Jekyll.
9
9
 
10
10
  Add this line to your Jekyll project's `Gemfile`:
11
11
  ```ruby
12
- gem 'jekyll-contentblocks'
12
+ group :jekyll_plugins do
13
+ gem 'jekyll-contentblocks'
14
+ end
13
15
  ```
14
16
 
15
17
  Then execute:
@@ -17,15 +19,8 @@ Then execute:
17
19
  $ bundle install
18
20
  ```
19
21
 
20
- Make sure your have a plugin that initializes Bundler:
21
- ```ruby
22
- # _plugins/bundler.rb
23
- require "rubygems"
24
- require "bundler/setup"
25
- Bundler.require(:default)
26
- ```
27
-
28
22
  ### Standalone
23
+
29
24
  Execute:
30
25
  ```bash
31
26
  $ gem install jekyll-contentblocks
@@ -101,7 +96,7 @@ it in our template. To do this, use the `ifhascontent` tag:
101
96
  ```liquid
102
97
  {% ifhascontent javascripts %}
103
98
  <script type="text/javascript>
104
- {% contentfor javascripts %}
99
+ {% contentblock javascripts %}
105
100
  </script>
106
101
  {% endifhascontent %}
107
102
  ```
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "jekyll", "3.0.3"
6
+ gem "appraisal", "1.0.2"
7
+ gem "pry"
8
+ gem "pry-byebug"
9
+ gem "rspec", "~> 3.3.0"
10
+ gem "nokogiri", "~> 1.6.6.0"
11
+
12
+ gemspec :path => "../"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "jekyll", "3.1.2"
6
+ gem "appraisal", "1.0.2"
7
+ gem "pry"
8
+ gem "pry-byebug"
9
+ gem "rspec", "~> 3.3.0"
10
+ gem "nokogiri", "~> 1.6.6.0"
11
+
12
+ gemspec :path => "../"
@@ -10,9 +10,18 @@ module Jekyll
10
10
  end
11
11
  end
12
12
 
13
- require 'jekyll/content_blocks/convertible'
14
- unless Jekyll.version_less_than?('2.0.0')
15
- require 'jekyll/content_blocks/renderer'
13
+ if Jekyll.version_less_than?('3.0.0')
14
+ require 'jekyll/content_blocks/convertible'
15
+ unless Jekyll.version_less_than?('2.0.0')
16
+ require 'jekyll/content_blocks/renderer'
17
+ end
18
+ else
19
+ require 'jekyll/content_blocks/pre_render_hook'
20
+ [:documents, :pages, :posts].each do |content_type|
21
+ Jekyll::Hooks.register content_type, :pre_render do |doc, payload|
22
+ Jekyll::ContentBlocks::PreRenderHook.call(doc, payload)
23
+ end
24
+ end
16
25
  end
17
26
 
18
27
  require 'jekyll/content_blocks/version'
@@ -0,0 +1,13 @@
1
+ module Jekyll
2
+ module ContentBlocks
3
+ class PreRenderHook
4
+ def self.call(document, payload)
5
+ payload['converters'] = document.site.converters.select do |converter|
6
+ file_extension = File.extname(document.path)
7
+ converter.matches(file_extension)
8
+ end
9
+ payload['contentblocks'] = {}
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,6 @@
1
1
  module Jekyll
2
2
  module ContentBlocks
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
6
6
 
@@ -40,7 +40,6 @@ describe Jekyll::ContentBlocks do
40
40
 
41
41
  describe 'page.html' do
42
42
  let(:page) { load_html('page.html') }
43
- let(:sidebar) { index.css('body > div > h2#sidebar').first }
44
43
 
45
44
  it 'renders the css block' do
46
45
  expect(page.css('style')).not_to be_empty
@@ -62,6 +61,16 @@ describe Jekyll::ContentBlocks do
62
61
  end
63
62
  end
64
63
 
64
+ describe 'page2.html' do
65
+ let(:page) { load_html('page2.html') }
66
+
67
+ it 'renders only the page2 sidebar' do
68
+ sidebar = page.css('div.custom-sidebar')
69
+ expect(sidebar).not_to be_empty
70
+ expect(sidebar.text.strip).to eq 'A pretty simple sidebar.'
71
+ end
72
+ end
73
+
65
74
  describe 'ifnothascontent' do
66
75
  it 'renders defaults when content is not supplied' do
67
76
  expect(index.css('div#footer')).not_to be_empty
@@ -0,0 +1,2 @@
1
+ require 'jekyll-contentblocks'
2
+
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Page Two
3
+ layout: default
4
+ ---
5
+
6
+ # CONTENT
7
+
8
+ This page also has a sidebar.
9
+
10
+ {% contentfor sidebar %}
11
+ A pretty simple sidebar.
12
+ {% endcontentfor %}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-contentblocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rusty Geldmacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -33,6 +33,7 @@ extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - ".gitignore"
36
+ - ".ruby-version"
36
37
  - Appraisals
37
38
  - Gemfile
38
39
  - LICENSE.txt
@@ -50,10 +51,13 @@ files:
50
51
  - gemfiles/jekyll_2.3.0.gemfile
51
52
  - gemfiles/jekyll_2.4.0.gemfile
52
53
  - gemfiles/jekyll_2.5.3.gemfile
54
+ - gemfiles/jekyll_3.0.3.gemfile
55
+ - gemfiles/jekyll_3.1.2.gemfile
53
56
  - jekyll-contentblocks.gemspec
54
57
  - lib/jekyll-contentblocks.rb
55
58
  - lib/jekyll/content_blocks/content_block_tag.rb
56
59
  - lib/jekyll/content_blocks/convertible.rb
60
+ - lib/jekyll/content_blocks/pre_render_hook.rb
57
61
  - lib/jekyll/content_blocks/renderer.rb
58
62
  - lib/jekyll/content_blocks/version.rb
59
63
  - lib/jekyll/tags/content_block.rb
@@ -66,9 +70,10 @@ files:
66
70
  - test/_items/one.md
67
71
  - test/_items/two.md
68
72
  - test/_layouts/default.html
69
- - test/_plugins/bundler.rb
73
+ - test/_plugins/require.rb
70
74
  - test/index.md
71
75
  - test/page.md
76
+ - test/page2.md
72
77
  homepage: https://github.com/rustygeldmacher/jekyll-contentblocks
73
78
  licenses: []
74
79
  metadata: {}
@@ -99,6 +104,7 @@ test_files:
99
104
  - test/_items/one.md
100
105
  - test/_items/two.md
101
106
  - test/_layouts/default.html
102
- - test/_plugins/bundler.rb
107
+ - test/_plugins/require.rb
103
108
  - test/index.md
104
109
  - test/page.md
110
+ - test/page2.md
@@ -1,4 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- Bundler.require(:default)
4
-