mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 19:00:39 -07:00
Merge pull request #626 from Shopify/fix_bracket_thing
Fix bracket thing
This commit is contained in:
@@ -75,7 +75,7 @@ module Liquid
|
|||||||
|
|
||||||
def variable_signature
|
def variable_signature
|
||||||
str = consume(:id)
|
str = consume(:id)
|
||||||
if look(:open_square)
|
while look(:open_square)
|
||||||
str << consume
|
str << consume
|
||||||
str << expression
|
str << expression
|
||||||
str << consume(:close_square)
|
str << consume(:close_square)
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ class OutputTest < Minitest::Test
|
|||||||
assert_equal expected, Template.parse(text).render!(@assigns)
|
assert_equal expected, Template.parse(text).render!(@assigns)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_variable_traversing_with_two_brackets
|
||||||
|
text = %({{ site.data.menu[include.menu][include.locale] }})
|
||||||
|
assert_equal "it works!", Template.parse(text).render!(
|
||||||
|
"site" => { "data" => { "menu" => { "foo" => { "bar" => "it works!" } } } },
|
||||||
|
"include" => { "menu" => "foo", "locale" => "bar" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def test_variable_traversing
|
def test_variable_traversing
|
||||||
text = %( {{car.bmw}} {{car.gm}} {{car.bmw}} )
|
text = %( {{car.bmw}} {{car.gm}} {{car.bmw}} )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user