Merge pull request #161 from Shopify/fix-filter-parser-regex

Fix filter parser regex for filter args without separating spaces.
This commit is contained in:
Dylan Smith
2012-12-18 10:13:21 -08:00
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ module Liquid
# {{ user | link }}
#
class Variable
FilterParser = /(?:#{FilterSeparator}|(?:\s*(?!(?:#{FilterSeparator}))(?:#{QuotedFragment}|\S+)\s*)+)/o
FilterParser = /(?:#{FilterSeparator}|(?:\s*(?:#{QuotedFragment}|#{ArgumentSeparator})\s*)+)/o
attr_accessor :filters, :name
def initialize(markup)
+4
View File
@@ -66,6 +66,10 @@ class VariableTest < Test::Unit::TestCase
var = Variable.new('hello|textileze|paragraph')
assert_equal 'hello', var.name
assert_equal [[:textileze,[]], [:paragraph,[]]], var.filters
var = Variable.new("hello|replace:'foo','bar'|textileze")
assert_equal 'hello', var.name
assert_equal [[:replace, ["'foo'", "'bar'"]], [:textileze, []]], var.filters
end
def test_symbol