mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
render_all should internally always return strings. This eases some 1.9 compatability issues.
This commit is contained in:
+1
-1
@@ -95,7 +95,7 @@ module Liquid
|
||||
rescue ::StandardError => e
|
||||
context.handle_error(e)
|
||||
end
|
||||
end
|
||||
end.join
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module Liquid
|
||||
row = 1
|
||||
col = 0
|
||||
|
||||
result = ["<tr class=\"row1\">\n"]
|
||||
result = "<tr class=\"row1\">\n"
|
||||
context.stack do
|
||||
|
||||
collection.each_with_index do |item, index|
|
||||
@@ -56,17 +56,18 @@ module Liquid
|
||||
|
||||
col += 1
|
||||
|
||||
result << ["<td class=\"col#{col}\">"] + render_all(@nodelist, context) + ['</td>']
|
||||
result << "<td class=\"col#{col}\">" << render_all(@nodelist, context) << '</td>'
|
||||
|
||||
if col == cols and not (index == length - 1)
|
||||
col = 0
|
||||
row += 1
|
||||
result << ["</tr>\n<tr class=\"row#{row}\">"]
|
||||
result << "</tr>\n<tr class=\"row#{row}\">"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
result + ["</tr>\n"]
|
||||
result << "</tr>\n"
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ module Liquid
|
||||
|
||||
def render(context)
|
||||
output = super
|
||||
context.scopes.last[@to] = output.join
|
||||
context.scopes.last[@to] = output
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,22 +31,18 @@ module Liquid
|
||||
context.stack do
|
||||
execute_else_block = true
|
||||
|
||||
@blocks.inject([]) do |output, block|
|
||||
|
||||
output = ''
|
||||
@blocks.each do |block|
|
||||
if block.else?
|
||||
|
||||
return render_all(block.attachment, context) if execute_else_block
|
||||
|
||||
elsif block.evaluate(context)
|
||||
|
||||
execute_else_block = false
|
||||
output += render_all(block.attachment, context)
|
||||
output << render_all(block.attachment, context)
|
||||
end
|
||||
end
|
||||
|
||||
output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ module Liquid
|
||||
|
||||
segment.reverse! if @reversed
|
||||
|
||||
result = []
|
||||
result = ''
|
||||
|
||||
length = segment.length
|
||||
|
||||
|
||||
@@ -34,17 +34,13 @@ module Liquid
|
||||
end
|
||||
|
||||
if variable.is_a?(Array)
|
||||
|
||||
variable.collect do |variable|
|
||||
context[@template_name[1..-2]] = variable
|
||||
partial.render(context)
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
context[@template_name[1..-2]] = variable
|
||||
partial.render(context)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,7 +121,8 @@ module Liquid
|
||||
begin
|
||||
# render the nodelist.
|
||||
# for performance reasons we get a array back here. join will make a string out of it
|
||||
@root.render(context).join
|
||||
result = @root.render(context)
|
||||
result.respond_to?(:join) ? result.join : result
|
||||
ensure
|
||||
@errors = context.errors
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user