mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 10:20:43 -07:00
tests passing
This commit is contained in:
@@ -69,15 +69,16 @@ module Liquid
|
||||
# Inline snippets take precedence over external snippets
|
||||
if (inline_snippet = context.registers[:inline_snippet][template_name])
|
||||
inner_context = context.new_isolated_subcontext
|
||||
# binding.irb
|
||||
|
||||
snippet_body = inline_snippet[:body]
|
||||
snippet_args = inline_snippet[:args]
|
||||
|
||||
# Validate and set the arguments in the inner context
|
||||
@attributes.each do |key, value|
|
||||
if snippet_args.include?(key)
|
||||
inner_context[key] = context.evaluate(value)
|
||||
unless snippet_args.include?(key)
|
||||
raise Liquid::ArgumentError, "Invalid argument `#{key}` for snippet `#{template_name}`"
|
||||
end
|
||||
|
||||
inner_context[key] = context.evaluate(value)
|
||||
end
|
||||
|
||||
return output << snippet_body.render(inner_context)
|
||||
|
||||
Reference in New Issue
Block a user