mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Context is no longer lost when moving into a Liquid FileSystem.
This commit is contained in:
committed by
Tobias Lütke
parent
9926d86c91
commit
7bbb4ff84f
@@ -14,7 +14,7 @@ module Liquid
|
||||
# This will parse the template with a LocalFileSystem implementation rooted at 'template_path'.
|
||||
class BlankFileSystem
|
||||
# Called by Liquid to retrieve a template file
|
||||
def read_template_file(template_path)
|
||||
def read_template_file(context, template_name)
|
||||
raise FileSystemError, "This liquid context does not allow includes."
|
||||
end
|
||||
end
|
||||
@@ -38,7 +38,8 @@ module Liquid
|
||||
@root = root
|
||||
end
|
||||
|
||||
def read_template_file(template_path)
|
||||
def read_template_file(context, template_name)
|
||||
template_path = context[template_name]
|
||||
full_path = full_path(template_path)
|
||||
raise FileSystemError, "No such template '#{template_path}'" unless File.exists?(full_path)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ module Liquid
|
||||
|
||||
def render(context)
|
||||
file_system = context.registers[:file_system] || Liquid::Template.file_system
|
||||
source = file_system.read_template_file(context[@template_name])
|
||||
source = file_system.read_template_file(context, @template_name)
|
||||
partial = Liquid::Template.parse(source)
|
||||
|
||||
variable = context[@variable_name || @template_name[1..-2]]
|
||||
|
||||
Reference in New Issue
Block a user