mirror of
https://github.com/Shopify/liquid.git
synced 2025-12-05 00:01:55 -05:00
Fixed some parse errors thanks to Daniel Sheppard [Closes #6]
This commit is contained in:
parent
7b9b5f31fb
commit
88309cf415
@ -33,7 +33,8 @@ module Liquid
|
||||
VariableStart = /\{\{/
|
||||
VariableEnd = /\}\}/
|
||||
VariableIncompleteEnd = /\}\}?/
|
||||
QuotedFragment = /"[^"]+"|'[^']+'|[^\s,\|]+/
|
||||
QuotedString = /"[^"]+"|'[^']+'/
|
||||
QuotedFragment = /#{QuotedString}|(?:[^\s,\|'"]|#{QuotedString})+/
|
||||
StrictQuotedFragment = /"[^"]+"|'[^']+'|[^\s,\|,\:,\,]+/
|
||||
FirstFilterArgument = /#{FilterArgumentSeparator}(?:#{StrictQuotedFragment})/
|
||||
OtherFilterArgument = /#{ArgumentSeparator}(?:#{StrictQuotedFragment})/
|
||||
|
||||
@ -13,8 +13,8 @@ module Liquid
|
||||
# <div class="green"> Item five</div>
|
||||
#
|
||||
class Cycle < Tag
|
||||
SimpleSyntax = /#{Expression}/
|
||||
NamedSyntax = /(#{Expression})\s*\:\s*(.*)/
|
||||
SimpleSyntax = /^#{Expression}/
|
||||
NamedSyntax = /^(#{Expression})\s*\:\s*(.*)/
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
case markup
|
||||
@ -27,7 +27,6 @@ module Liquid
|
||||
else
|
||||
raise SyntaxError.new("Syntax Error in 'cycle' - Valid syntax: cycle [name :] var [, var2, var3 ...]")
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
@ -212,6 +212,11 @@ HERE
|
||||
assert_template_result('a-b:1 a-b:2','a-b:{{a-b}} {%assign a-b = 2 %}a-b:{{a-b}}',assigns)
|
||||
|
||||
end
|
||||
|
||||
def test_assign_with_colon_and_spaces
|
||||
assigns = {'var' => {'a:b c' => {'paged' => '1' }}}
|
||||
assert_template_result('var2: 1','{%assign var2 = var["a:b c"].paged %}var2: {{var2}}',assigns)
|
||||
end
|
||||
|
||||
def test_capture
|
||||
assigns = {'var' => 'content' }
|
||||
@ -348,6 +353,9 @@ HERE
|
||||
assert_template_result('one two','{%cycle "one", "two"%} {%cycle "one", "two"%}')
|
||||
|
||||
assert_template_result('one two one','{%cycle "one", "two"%} {%cycle "one", "two"%} {%cycle "one", "two"%}')
|
||||
|
||||
assert_template_result('text-align: left text-align: right','{%cycle "text-align: left", "text-align: right" %} {%cycle "text-align: left", "text-align: right"%}')
|
||||
|
||||
end
|
||||
|
||||
def test_multiple_cycles
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user