mirror of
https://github.com/kemko/liquid.git
synced 2026-01-02 08:15:41 +03:00
Support for passing variables to snippets in subdirs
Now you can use "include 'some/snippet' with variable".
This commit is contained in:
@@ -51,13 +51,14 @@ module Liquid
|
||||
context[key] = context[value]
|
||||
end
|
||||
|
||||
context_variable_name = @template_name[1..-2].split('/').last # for a snippet in a subdir only use the filename
|
||||
if variable.is_a?(Array)
|
||||
variable.collect do |var|
|
||||
context[@template_name[1..-2]] = var
|
||||
context[context_variable_name] = var
|
||||
partial.render(context)
|
||||
end
|
||||
else
|
||||
context[@template_name[1..-2]] = variable
|
||||
context[context_variable_name] = variable
|
||||
partial.render(context)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user