Fix for parsing spaces in fragments

This commit is contained in:
Tobias Lütke
2009-04-06 08:37:39 -06:00
parent 981831bc49
commit 075341d01c
2 changed files with 4 additions and 2 deletions

View File

@@ -33,7 +33,8 @@ module Liquid
VariableStart = /\{\{/
VariableEnd = /\}\}/
VariableIncompleteEnd = /\}\}?/
QuotedFragment = /"[^"]+"|'[^']+'|[^\s,|]+/
QuotedString = /"[^"]+"|'[^']+'/
QuotedFragment = /#{QuotedString}|(?:[^\s,\|'"]|#{QuotedString})+/
TagAttributes = /(\w+)\s*\:\s*(#{QuotedFragment})/
AnyStartingTag = /\{\{|\{\%/
PartialTemplateParser = /#{TagStart}.*?#{TagEnd}|#{VariableStart}.*?#{VariableIncompleteEnd}/

View File

@@ -4,7 +4,8 @@ class AssignTest < Test::Unit::TestCase
include Liquid
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