mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-04 01:25:14 -07:00
Fix for parsing spaces in fragments
This commit is contained in:
+2
-1
@@ -33,7 +33,8 @@ module Liquid
|
|||||||
VariableStart = /\{\{/
|
VariableStart = /\{\{/
|
||||||
VariableEnd = /\}\}/
|
VariableEnd = /\}\}/
|
||||||
VariableIncompleteEnd = /\}\}?/
|
VariableIncompleteEnd = /\}\}?/
|
||||||
QuotedFragment = /"[^"]+"|'[^']+'|[^\s,|]+/
|
QuotedString = /"[^"]+"|'[^']+'/
|
||||||
|
QuotedFragment = /#{QuotedString}|(?:[^\s,\|'"]|#{QuotedString})+/
|
||||||
TagAttributes = /(\w+)\s*\:\s*(#{QuotedFragment})/
|
TagAttributes = /(\w+)\s*\:\s*(#{QuotedFragment})/
|
||||||
AnyStartingTag = /\{\{|\{\%/
|
AnyStartingTag = /\{\{|\{\%/
|
||||||
PartialTemplateParser = /#{TagStart}.*?#{TagEnd}|#{VariableStart}.*?#{VariableIncompleteEnd}/
|
PartialTemplateParser = /#{TagStart}.*?#{TagEnd}|#{VariableStart}.*?#{VariableIncompleteEnd}/
|
||||||
|
|||||||
+2
-1
@@ -4,7 +4,8 @@ class AssignTest < Test::Unit::TestCase
|
|||||||
include Liquid
|
include Liquid
|
||||||
|
|
||||||
def test_assigned_variable
|
def test_assigned_variable
|
||||||
assert_template_result('.foo.','{% assign foo = values %}.{{ foo }}.', 'values' => %w{foo bar baz})
|
assert_template_result('.foo.','{% assign foo = values %}.{{ foo[0] }}.', 'values' => %w{foo bar baz})
|
||||||
|
assert_template_result('.bar.','{% assign foo = values %}.{{ foo[1] }}.', 'values' => %w{foo bar baz})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user