mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Catch easy cases
This commit is contained in:
@@ -12,6 +12,7 @@ module Liquid
|
|||||||
#
|
#
|
||||||
class Variable
|
class Variable
|
||||||
FilterParser = /(?:#{FilterSeparator}|(?:\s*(?:#{QuotedFragment}|#{ArgumentSeparator})\s*)+)/o
|
FilterParser = /(?:#{FilterSeparator}|(?:\s*(?:#{QuotedFragment}|#{ArgumentSeparator})\s*)+)/o
|
||||||
|
EasyParse = /^ *(\w+(?:\.\w+)*) *$/
|
||||||
attr_accessor :filters, :name
|
attr_accessor :filters, :name
|
||||||
|
|
||||||
def initialize(markup)
|
def initialize(markup)
|
||||||
@@ -51,6 +52,12 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def strict_parse(markup)
|
def strict_parse(markup)
|
||||||
|
# Very simple valid cases
|
||||||
|
if markup =~ EasyParse
|
||||||
|
@name = $1
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
@filters = []
|
@filters = []
|
||||||
p = Parser.new(markup)
|
p = Parser.new(markup)
|
||||||
# Could be just filters with no input
|
# Could be just filters with no input
|
||||||
|
|||||||
Reference in New Issue
Block a user