mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
fix variable output with quoted strings containing pipe ("|") characters
This commit is contained in:
@@ -11,16 +11,17 @@ module Liquid
|
||||
# {{ user | link }}
|
||||
#
|
||||
class Variable
|
||||
FilterParser = /(?:#{FilterSeparator}|(?:\s*(?!(?:#{FilterSeparator}))(?:#{QuotedFragment}|\S+)\s*)+)/
|
||||
attr_accessor :filters, :name
|
||||
|
||||
def initialize(markup)
|
||||
@markup = markup
|
||||
@name = nil
|
||||
@filters = []
|
||||
if match = markup.match(/\s*(#{QuotedFragment})/)
|
||||
if match = markup.match(/\s*(#{QuotedFragment})(.*)/)
|
||||
@name = match[1]
|
||||
if markup.match(/#{FilterSeparator}\s*(.*)/)
|
||||
filters = Regexp.last_match(1).split(/#{FilterSeparator}/)
|
||||
if match[2].match(/#{FilterSeparator}\s*(.*)/)
|
||||
filters = Regexp.last_match(1).scan(FilterParser)
|
||||
filters.each do |f|
|
||||
if matches = f.match(/\s*(\w+)/)
|
||||
filtername = matches[1]
|
||||
|
||||
Reference in New Issue
Block a user