jekyll-responsive_image 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1a977d6f85c94a62c44f642c1c5db654858934c
4
- data.tar.gz: ef3148da73fb5d20263355e5e11fe1b8b1b2c1de
3
+ metadata.gz: 8222a5289fe9566ef0395c25a7491215e9fd3f55
4
+ data.tar.gz: 2648869efed1723fb8b6b209e62b878dec1bb406
5
5
  SHA512:
6
- metadata.gz: 65376dfb2c03ddd25ca527dba6a222821fd4b2ec4b19877fa6b9c4cb3cb74e605c0bdeb951fbe6fd26dcea006d84992e6ab04a1b6e7456667bcc45751836735a
7
- data.tar.gz: c47166b22a9acc36d355f700c49cf42ba115284470ce3365cf914ce188cdcff8522a621fa6f91e9adeeb647d13fc865b59b46a17bd38fcd890330c8460aa321f
6
+ metadata.gz: 04aab057ea359cd2c98365acb89dbae99042d1a74c95cf0e992b201f426ecee00f33d33adb0d1bc4736aff81a716520de28a390b22182c201f525e7292768817
7
+ data.tar.gz: 36a5d066c75ef897cdb4ccbea51932211e37ef6dc379a612ac16584bdb2da08422b6eff7136ad2a5435a9e0ed58a09f95f003f9bcf1d211d35b4f6986d9c1cd9
@@ -0,0 +1 @@
1
+ <img src="{{ site.baseurl }}/{{ path }}">
@@ -19,6 +19,22 @@ Feature: Jekyll responsive_image_block tag
19
19
  When I run Jekyll
20
20
  Then I should see "<img alt=\"Lorem ipsum\" src=\"/assets/test.png\" title=\"Magic rainbow adventure!\"" in "_site/index.html"
21
21
 
22
+ Scenario: Global variables available in templates
23
+ Given I have a file "index.html" with:
24
+ """
25
+ {% responsive_image_block %}
26
+ path: assets/test.png
27
+ {% endresponsive_image_block %}
28
+ """
29
+ And I have a configuration with:
30
+ """
31
+ baseurl: https://wildlyinaccurate.com
32
+ responsive_image:
33
+ template: _includes/base-url.html
34
+ """
35
+ When I run Jekyll
36
+ Then I should see "<img src=\"https://wildlyinaccurate.com/assets/test.png\">" in "_site/index.html"
37
+
22
38
  Scenario: More complex logic in the block tag
23
39
  Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
24
40
  And I have a file "index.html" with:
@@ -9,6 +9,17 @@ Feature: Jekyll responsive_image tag
9
9
  When I run Jekyll
10
10
  Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\"" in "_site/index.html"
11
11
 
12
+ Scenario: Global variables available in templates
13
+ Given I have a file "index.html" with "{% responsive_image path: assets/test.png %}"
14
+ And I have a configuration with:
15
+ """
16
+ baseurl: https://wildlyinaccurate.com
17
+ responsive_image:
18
+ template: _includes/base-url.html
19
+ """
20
+ When I run Jekyll
21
+ Then I should see "<img src=\"https://wildlyinaccurate.com/assets/test.png\">" in "_site/index.html"
22
+
12
23
  Scenario: Adding custom attributes
13
24
  Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
14
25
  And I have a file "index.html" with:
@@ -8,6 +8,10 @@ Then /^Jekyll should throw a "(.+)"$/ do |error_class|
8
8
  assert_raise(Object.const_get(error_class)) { run_jekyll }
9
9
  end
10
10
 
11
+ Given /^I have a configuration with:$/ do |config|
12
+ write_file('_config.yml', config)
13
+ end
14
+
11
15
  Given /^I have a responsive_image configuration with:$/ do |config|
12
16
  write_file('_config.yml', "responsive_image:\n#{config}")
13
17
  end
@@ -4,7 +4,8 @@ module Jekyll
4
4
  include Jekyll::ResponsiveImage::Common
5
5
 
6
6
  def render(context)
7
- config = make_config(context.registers[:site])
7
+ site = context.registers[:site]
8
+ config = make_config(site)
8
9
 
9
10
  attributes = YAML.load(super)
10
11
  image_template = attributes['template'] || config['template']
@@ -16,7 +17,7 @@ module Jekyll
16
17
  partial = File.read(image_template)
17
18
  template = Liquid::Template.parse(partial)
18
19
 
19
- template.render!(attributes)
20
+ template.render!(attributes.merge(site.site_payload))
20
21
  end
21
22
  end
22
23
  end
@@ -15,7 +15,8 @@ module Jekyll
15
15
  end
16
16
 
17
17
  def render(context)
18
- config = make_config(context.registers[:site])
18
+ site = context.registers[:site]
19
+ config = make_config(site)
19
20
 
20
21
  image = ImageProcessor.process(@attributes['path'], config)
21
22
  @attributes['original'] = image[:original]
@@ -26,7 +27,7 @@ module Jekyll
26
27
  partial = File.read(image_template)
27
28
  template = Liquid::Template.parse(partial)
28
29
 
29
- template.render!(@attributes)
30
+ template.render!(@attributes.merge(site.site_payload))
30
31
  end
31
32
  end
32
33
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class ResponsiveImage
3
- VERSION = '0.12.0'.freeze
3
+ VERSION = '0.13.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-responsive_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Wynn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-04 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -60,6 +60,7 @@ files:
60
60
  - LICENSE
61
61
  - README.md
62
62
  - Rakefile
63
+ - features/fixtures/_includes/base-url.html
63
64
  - features/fixtures/_includes/custom-template.html
64
65
  - features/fixtures/_includes/responsive-image.html
65
66
  - features/fixtures/assets/test.png
@@ -103,6 +104,7 @@ signing_key:
103
104
  specification_version: 4
104
105
  summary: Responsive images for Jekyll via srcset
105
106
  test_files:
107
+ - features/fixtures/_includes/base-url.html
106
108
  - features/fixtures/_includes/custom-template.html
107
109
  - features/fixtures/_includes/responsive-image.html
108
110
  - features/fixtures/assets/test.png