Remove trailing whitespace

This commit is contained in:
Marcus Stollsteimer
2012-11-18 10:29:22 +01:00
parent afc3944a4a
commit b48ad7da3a
2 changed files with 13 additions and 13 deletions
+9 -9
View File
@@ -1,11 +1,11 @@
module Liquid module Liquid
class Include < Tag class Include < Tag
Syntax = /(#{QuotedFragment}+)(\s+(?:with|for)\s+(#{QuotedFragment}+))?/o Syntax = /(#{QuotedFragment}+)(\s+(?:with|for)\s+(#{QuotedFragment}+))?/o
def initialize(tag_name, markup, tokens) def initialize(tag_name, markup, tokens)
if markup =~ Syntax if markup =~ Syntax
@template_name = $1 @template_name = $1
@variable_name = $3 @variable_name = $3
@attributes = {} @attributes = {}
@@ -19,15 +19,15 @@ module Liquid
super super
end end
def parse(tokens) def parse(tokens)
end end
def render(context) def render(context)
source = _read_template_from_file_system(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]] variable = context[@variable_name || @template_name[1..-2]]
context.stack do context.stack do
@attributes.each do |key, value| @attributes.each do |key, value|
context[key] = context[value] context[key] = context[value]
@@ -44,11 +44,11 @@ module Liquid
end end
end end
end end
private private
def _read_template_from_file_system(context) def _read_template_from_file_system(context)
file_system = context.registers[:file_system] || Liquid::Template.file_system file_system = context.registers[:file_system] || Liquid::Template.file_system
# make read_template_file call backwards-compatible. # make read_template_file call backwards-compatible.
case file_system.method(:read_template_file).arity case file_system.method(:read_template_file).arity
when 1 when 1
@@ -61,5 +61,5 @@ module Liquid
end end
end end
Template.register_tag('include', Include) Template.register_tag('include', Include)
end end
+4 -4
View File
@@ -9,25 +9,25 @@ module Liquid
class Unless < If class Unless < If
def render(context) def render(context)
context.stack do context.stack do
# First condition is interpreted backwards ( if not ) # First condition is interpreted backwards ( if not )
first_block = @blocks.first first_block = @blocks.first
unless first_block.evaluate(context) unless first_block.evaluate(context)
return render_all(first_block.attachment, context) return render_all(first_block.attachment, context)
end end
# After the first condition unless works just like if # After the first condition unless works just like if
@blocks[1..-1].each do |block| @blocks[1..-1].each do |block|
if block.evaluate(context) if block.evaluate(context)
return render_all(block.attachment, context) return render_all(block.attachment, context)
end end
end end
'' ''
end end
end end
end end
Template.register_tag('unless', Unless) Template.register_tag('unless', Unless)
end end