liquid 3.0.2 → 3.0.3

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: 0a34ea9118594ad84171322f5dbb0b07e5e7b148
4
- data.tar.gz: e4b170c02fd107b8fa6210554d5a3b647e65a4be
3
+ metadata.gz: 7b16a9ef0a4f67b44c9fca4d7ef63db9d254220e
4
+ data.tar.gz: d53a4e4ab6ba227b62684325c0c374c5e132c342
5
5
  SHA512:
6
- metadata.gz: b09f3628e0002d6193fa3c7e0629e0c0c075a50e9d96561dc5a40e8f461793b04c948e4a4aebf4885afe738d58ace2e5ec149b0956fd6f5be1448dbe9b3fa02d
7
- data.tar.gz: b9a76c51a795058d2b447b95c85a689b6e628b99ada9e0a4db97aebd3a2dda3cc29d790bcef72bb0b86c3fe49b45da9e8fba6eb63ac6e081178542f6dd79b63e
6
+ metadata.gz: e82a6fe4e69228e0e9beddbff8f9e138005f9cd6ea3dd478aedff2b3315c7fcb45428d2175eebd48e0060757b4e3e718242786ca0d7c066834c651697aa5d268
7
+ data.tar.gz: f62a4f5ff4b5482cf230b5ce74a362a4516eb4f65eaf2526adacb79ed5d8063e68ae22c6491e8464b719ca2fc1f64d2be7f652c68cb8b69bc5afd53fc4c8564a
data/History.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Liquid Version History
2
2
 
3
- ## 3.0.2 / 2015-04-24 / branch "3-0-stable"
3
+ ## 3.0.3 / 2015-05-28 / branch "3-0-stable"
4
+
5
+ * Fix condition parse order in strict mode (#569) [Justin Li, pushrax]
6
+
7
+ ## 3.0.2 / 2015-04-24
4
8
 
5
9
  * Expose VariableLookup private members (#551) [Justin Li, pushrax]
6
10
  * Documentation fixes
@@ -78,16 +78,16 @@ module Liquid
78
78
 
79
79
  def strict_parse(markup)
80
80
  p = Parser.new(markup)
81
+ condition = parse_binary_comparison(p)
82
+ p.consume(:end_of_string)
83
+ condition
84
+ end
81
85
 
86
+ def parse_binary_comparison(p)
82
87
  condition = parse_comparison(p)
83
-
84
- while op = (p.id?('and'.freeze) || p.id?('or'.freeze))
85
- new_cond = parse_comparison(p)
86
- new_cond.send(op, condition)
87
- condition = new_cond
88
+ if op = (p.id?('and'.freeze) || p.id?('or'.freeze))
89
+ condition.send(op, parse_binary_comparison(p))
88
90
  end
89
- p.consume(:end_of_string)
90
-
91
91
  condition
92
92
  end
93
93
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Liquid
3
- VERSION = "3.0.2"
3
+ VERSION = "3.0.3"
4
4
  end
@@ -166,4 +166,25 @@ class IfElseTagTest < Minitest::Test
166
166
  assert_template_result('', %({% if 1 or throw or or 1 %}yes{% endif %}))
167
167
  end
168
168
  end
169
+
170
+ def test_multiple_conditions
171
+ tpl = "{% if a or b and c %}true{% else %}false{% endif %}"
172
+
173
+ tests = {
174
+ [true, true, true] => true,
175
+ [true, true, false] => true,
176
+ [true, false, true] => true,
177
+ [true, false, false] => true,
178
+ [false, true, true] => true,
179
+ [false, true, false] => false,
180
+ [false, false, true] => false,
181
+ [false, false, false] => false,
182
+ }
183
+
184
+ tests.each do |vals, expected|
185
+ a, b, c = vals
186
+ assigns = { 'a' => a, 'b' => b, 'c' => c }
187
+ assert_template_result expected.to_s, tpl, assigns, assigns.to_s
188
+ end
189
+ end
169
190
  end
data/test/test_helper.rb CHANGED
@@ -32,13 +32,13 @@ module Minitest
32
32
  include Liquid
33
33
 
34
34
  def assert_template_result(expected, template, assigns = {}, message = nil)
35
- assert_equal expected, Template.parse(template).render!(assigns)
35
+ assert_equal expected, Template.parse(template).render!(assigns), message
36
36
  end
37
37
 
38
38
  def assert_template_result_matches(expected, template, assigns = {}, message = nil)
39
39
  return assert_template_result(expected, template, assigns, message) unless expected.is_a? Regexp
40
40
 
41
- assert_match expected, Template.parse(template).render!(assigns)
41
+ assert_match expected, Template.parse(template).render!(assigns), message
42
42
  end
43
43
 
44
44
  def assert_match_syntax_error(match, template, registers = {})
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description:
@@ -47,6 +47,10 @@ extra_rdoc_files:
47
47
  - History.md
48
48
  - README.md
49
49
  files:
50
+ - History.md
51
+ - MIT-LICENSE
52
+ - README.md
53
+ - lib/liquid.rb
50
54
  - lib/liquid/block.rb
51
55
  - lib/liquid/block_body.rb
52
56
  - lib/liquid/condition.rb
@@ -64,8 +68,8 @@ files:
64
68
  - lib/liquid/module_ex.rb
65
69
  - lib/liquid/parser.rb
66
70
  - lib/liquid/parser_switching.rb
67
- - lib/liquid/profiler/hooks.rb
68
71
  - lib/liquid/profiler.rb
72
+ - lib/liquid/profiler/hooks.rb
69
73
  - lib/liquid/range_lookup.rb
70
74
  - lib/liquid/standardfilters.rb
71
75
  - lib/liquid/strainer.rb
@@ -92,10 +96,6 @@ files:
92
96
  - lib/liquid/variable.rb
93
97
  - lib/liquid/variable_lookup.rb
94
98
  - lib/liquid/version.rb
95
- - lib/liquid.rb
96
- - MIT-LICENSE
97
- - README.md
98
- - History.md
99
99
  - test/fixtures/en_locale.yml
100
100
  - test/integration/assign_test.rb
101
101
  - test/integration/blank_test.rb
@@ -151,17 +151,17 @@ require_paths:
151
151
  - lib
152
152
  required_ruby_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - '>='
159
+ - - ">="
160
160
  - !ruby/object:Gem::Version
161
161
  version: 1.3.7
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.0.3
164
+ rubygems_version: 2.2.3
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: A secure, non-evaling end user template engine with aesthetic markup.
@@ -211,4 +211,3 @@ test_files:
211
211
  - test/unit/template_unit_test.rb
212
212
  - test/unit/tokenizer_unit_test.rb
213
213
  - test/unit/variable_unit_test.rb
214
- has_rdoc: