mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Remove trailing whitespace
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
module Liquid
|
||||
class Include < Tag
|
||||
Syntax = /(#{QuotedFragment}+)(\s+(?:with|for)\s+(#{QuotedFragment}+))?/o
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
if markup =~ Syntax
|
||||
|
||||
@template_name = $1
|
||||
@template_name = $1
|
||||
@variable_name = $3
|
||||
@attributes = {}
|
||||
|
||||
@@ -19,15 +19,15 @@ module Liquid
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def parse(tokens)
|
||||
end
|
||||
|
||||
|
||||
def render(context)
|
||||
source = _read_template_from_file_system(context)
|
||||
partial = Liquid::Template.parse(source)
|
||||
variable = context[@variable_name || @template_name[1..-2]]
|
||||
|
||||
|
||||
context.stack do
|
||||
@attributes.each do |key, value|
|
||||
context[key] = context[value]
|
||||
@@ -44,11 +44,11 @@ module Liquid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def _read_template_from_file_system(context)
|
||||
file_system = context.registers[:file_system] || Liquid::Template.file_system
|
||||
|
||||
|
||||
# make read_template_file call backwards-compatible.
|
||||
case file_system.method(:read_template_file).arity
|
||||
when 1
|
||||
@@ -61,5 +61,5 @@ module Liquid
|
||||
end
|
||||
end
|
||||
|
||||
Template.register_tag('include', Include)
|
||||
Template.register_tag('include', Include)
|
||||
end
|
||||
|
||||
@@ -9,25 +9,25 @@ module Liquid
|
||||
class Unless < If
|
||||
def render(context)
|
||||
context.stack do
|
||||
|
||||
|
||||
# First condition is interpreted backwards ( if not )
|
||||
first_block = @blocks.first
|
||||
unless first_block.evaluate(context)
|
||||
return render_all(first_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)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Template.register_tag('unless', Unless)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user