diff --git a/lib/liquid/block.rb b/lib/liquid/block.rb
index b16de4c..c96b94c 100644
--- a/lib/liquid/block.rb
+++ b/lib/liquid/block.rb
@@ -95,7 +95,7 @@ module Liquid
rescue ::StandardError => e
context.handle_error(e)
end
- end
+ end.join
end
end
end
diff --git a/lib/liquid/htmltags.rb b/lib/liquid/htmltags.rb
index c6db036..f283b94 100644
--- a/lib/liquid/htmltags.rb
+++ b/lib/liquid/htmltags.rb
@@ -33,7 +33,7 @@ module Liquid
row = 1
col = 0
- result = ["
\n"]
+ result = "
\n"
context.stack do
collection.each_with_index do |item, index|
@@ -56,17 +56,18 @@ module Liquid
col += 1
- result << ["| "] + render_all(@nodelist, context) + [' | ']
+ result << "" << render_all(@nodelist, context) << ' | '
if col == cols and not (index == length - 1)
col = 0
row += 1
- result << ["
\n"]
+ result << "
\n"
end
end
end
- result + ["
\n"]
+ result << "\n"
+ result
end
end
diff --git a/lib/liquid/tags/capture.rb b/lib/liquid/tags/capture.rb
index 89591a4..2f67a0b 100644
--- a/lib/liquid/tags/capture.rb
+++ b/lib/liquid/tags/capture.rb
@@ -26,7 +26,7 @@ module Liquid
def render(context)
output = super
- context.scopes.last[@to] = output.join
+ context.scopes.last[@to] = output
''
end
end
diff --git a/lib/liquid/tags/case.rb b/lib/liquid/tags/case.rb
index 0733c51..9597059 100644
--- a/lib/liquid/tags/case.rb
+++ b/lib/liquid/tags/case.rb
@@ -31,20 +31,16 @@ 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
-
- output
end
+ output
end
end
diff --git a/lib/liquid/tags/for.rb b/lib/liquid/tags/for.rb
index b17a332..3028efa 100644
--- a/lib/liquid/tags/for.rb
+++ b/lib/liquid/tags/for.rb
@@ -85,7 +85,7 @@ module Liquid
segment.reverse! if @reversed
- result = []
+ result = ''
length = segment.length
diff --git a/lib/liquid/tags/include.rb b/lib/liquid/tags/include.rb
index 221e797..9ea7323 100644
--- a/lib/liquid/tags/include.rb
+++ b/lib/liquid/tags/include.rb
@@ -20,12 +20,12 @@ module Liquid
super
end
- def parse(tokens)
+ def parse(tokens)
end
- def render(context)
+ def render(context)
source = _read_template_from_file_system(context)
- partial = Liquid::Template.parse(source)
+ partial = Liquid::Template.parse(source)
variable = context[@variable_name || @template_name[1..-2]]
context.stack do
@@ -34,17 +34,13 @@ module Liquid
end
if variable.is_a?(Array)
-
- variable.collect do |variable|
+ 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
diff --git a/lib/liquid/tags/unless.rb b/lib/liquid/tags/unless.rb
index 74a76ab..a3d4d08 100644
--- a/lib/liquid/tags/unless.rb
+++ b/lib/liquid/tags/unless.rb
@@ -13,19 +13,19 @@ module Liquid
# First condition is interpreted backwards ( if not )
block = @blocks.first
unless block.evaluate(context)
- return render_all(block.attachment, context)
+ return render_all(block.attachment, context)
end
# After the first condition unless works just like if
@blocks[1..-1].each do |block|
- if block.evaluate(context)
- return render_all(block.attachment, context)
+ if block.evaluate(context)
+ return render_all(block.attachment, context)
end
- end
+ end
''
end
- end
+ end
end
diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb
index d346c44..7c3bba2 100644
--- a/lib/liquid/template.rb
+++ b/lib/liquid/template.rb
@@ -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
diff --git a/lib/liquid/variable.rb b/lib/liquid/variable.rb
index 1afaa13..e9ef63e 100644
--- a/lib/liquid/variable.rb
+++ b/lib/liquid/variable.rb
@@ -37,7 +37,7 @@ module Liquid
return '' if @name.nil?
@filters.inject(context[@name]) do |output, filter|
filterargs = filter[1].to_a.collect do |a|
- context[a]
+ context[a]
end
begin
output = context.invoke(filter[0], output, *filterargs)
diff --git a/performance/shopify/paginate.rb b/performance/shopify/paginate.rb
index 4dcc00d..b340623 100644
--- a/performance/shopify/paginate.rb
+++ b/performance/shopify/paginate.rb
@@ -52,17 +52,17 @@ class Paginate < Liquid::Block
hellip_break = false
if page_count > 2
- 1.upto(page_count-1) do |page|
+ 1.upto(page_count-1) do |page|
if current_page == page
- pagination['parts'] << no_link(page)
+ pagination['parts'] << no_link(page)
elsif page == 1
pagination['parts'] << link(page, page)
elsif page == page_count -1
pagination['parts'] << link(page, page)
elsif page <= current_page - @attributes['window_size'] or page >= current_page + @attributes['window_size']
next if hellip_break
- pagination['parts'] << no_link('…')
+ pagination['parts'] << no_link('…')
hellip_break = true
next
else
@@ -73,7 +73,7 @@ class Paginate < Liquid::Block
end
end
- render_all(@nodelist, context)
+ render_all(@nodelist, context)
end
end