Remove trailing whitespace.

This commit is contained in:
Mark H. Wilkinson
2008-08-18 20:32:30 +01:00
parent 7acdac2a1c
commit 7eeb895192
4 changed files with 45 additions and 56 deletions
+10 -10
View File
@@ -1,5 +1,5 @@
module Liquid
# Holds variables. Variables are only loaded "just in time"
# and are not evaluated as part of the render stage
#
@@ -10,30 +10,30 @@ module Liquid
#
# {{ user | link }}
#
class Variable
class Variable
attr_accessor :filters, :name
def initialize(markup)
@markup = markup
@markup = markup
@name = nil
@filters = []
if match = markup.match(/\s*(#{QuotedFragment})/)
@name = match[1]
if markup.match(/#{FilterSperator}\s*(.*)/)
filters = Regexp.last_match(1).split(/#{FilterSperator}/)
filters.each do |f|
filters.each do |f|
if matches = f.match(/\s*(\w+)/)
filtername = matches[1]
filterargs = f.scan(/(?:#{FilterArgumentSeparator}|#{ArgumentSeparator})\s*(#{QuotedFragment})/).flatten
filterargs = f.scan(/(?:#{FilterArgumentSeparator}|#{ArgumentSeparator})\s*(#{QuotedFragment})/).flatten
@filters << [filtername.to_sym, filterargs]
end
end
end
end
end
end
def render(context)
def render(context)
return '' if @name.nil?
output = context[@name]
@filters.inject(output) do |output, filter|
@@ -45,7 +45,7 @@ module Liquid
rescue FilterNotFound
raise FilterNotFound, "Error - filter '#{filter[0]}' in '#{@markup.strip}' could not be found."
end
end
end
output
end
end