locomotivecms-liquid 4.0.0.alpha → 4.0.0.alpha1

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: 390ba2f8603e9d8dd6a70219c727e7912f5a0af6
4
- data.tar.gz: 3dab20ea5da6160a906c8946b6b8d6e3f96554de
3
+ metadata.gz: 9146b6c0f563f43a00efbd5656d8642c0cc356b0
4
+ data.tar.gz: 5f181a813cd6c5df89507c7d5e0c2dd31c4e378b
5
5
  SHA512:
6
- metadata.gz: d64a2bcf781c84c400d6b17d56e047bfc3c4347d67a86bcc5f15ffdbea84b6f0665acaf18b1009ea5aaad6bad71c724f397a329ee8f04bc7d3d48c3dcce2cfad
7
- data.tar.gz: 3851c097575f9c31845cb8b396fd795a3a10b8037377b19463516225415a259b7c16d4bc970bbc28e4bf2b6c3e7f47d16b2b8f1bd42a360ec0a73d4781f19d88
6
+ metadata.gz: 062c89b8f9c5b313705384a2cb16886d87ce8a483546099c0b78fb0da0a339b4de6997a0fbab2f234b62c057451cc7114bacb01b9b2ab6fc3592d704ff1a8300
7
+ data.tar.gz: 2ade61abd56b055a10feb20de21f58a1cc2152c94c10408f024cb3d2879b2a9ccf9ab70e666dad3708396ca046a68265c345d973d28ef909f4fb9d5480bd7444
@@ -29,33 +29,33 @@ module Liquid
29
29
 
30
30
  def prepare_for_inheritance
31
31
  # give a different name if this is a nested block
32
- if block = options[:inherited_blocks][:nested].last
32
+ if block = inherited_blocks[:nested].last
33
33
  @name = "#{block.name}/#{@name}"
34
34
  end
35
35
 
36
36
  # append this block to the stack in order to
37
37
  # get a name for the other nested inherited blocks
38
- options[:inherited_blocks][:nested].push(self)
38
+ inherited_blocks[:nested].push(self)
39
39
 
40
40
  # build the linked chain of inherited blocks
41
41
  # make a link with the descendant and the parent (chained list)
42
- if descendant = options[:inherited_blocks][:all][@name]
42
+ if descendant = inherited_blocks[:all][@name]
43
43
  self.descendant = descendant
44
44
  descendant.parent = self
45
45
 
46
46
  # get the value of the blank property from the descendant
47
- @blank = descendant.blank? #false
47
+ @blank = descendant.blank?
48
48
  end
49
49
 
50
50
  # become the descendant of the inherited block from the parent template
51
- options[:inherited_blocks][:all][@name] = self
51
+ inherited_blocks[:all][@name] = self
52
52
  end
53
53
 
54
54
  def parse(tokens)
55
55
  super
56
56
 
57
57
  # when the parsing of the block is done, we can then remove it from the stack
58
- options[:inherited_blocks][:nested].pop
58
+ inherited_blocks[:nested].pop
59
59
  end
60
60
 
61
61
  alias_method :render_without_inheritance, :render
@@ -93,6 +93,13 @@ module Liquid
93
93
  end
94
94
  end
95
95
 
96
+ def inherited_blocks
97
+ options[:inherited_blocks] || {
98
+ all: {},
99
+ nested: []
100
+ }
101
+ end
102
+
96
103
  end
97
104
 
98
105
  Template.register_tag('block', InheritedBlock)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Liquid
3
- VERSION = "4.0.0.alpha"
3
+ VERSION = "4.0.0.alpha1"
4
4
  end
@@ -34,6 +34,11 @@ class ExtendsTagTest < Minitest::Test
34
34
  Liquid::Template.file_system = LayoutFileSystem.new
35
35
  end
36
36
 
37
+ def test_template_with_a_block
38
+ assert_template_result "<body><h1>Hello</h1><p>Lorem ipsum</p></body>",
39
+ Liquid::Template.file_system.read_template_file('page_with_title', nil)
40
+ end
41
+
37
42
  def test_template_extends_another_template
38
43
  assert_template_result "<body>base</body>",
39
44
  "{% extends base %}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms-liquid
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha
4
+ version: 4.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-26 00:00:00.000000000 Z
13
+ date: 2015-02-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake