mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 18:30:40 -07:00
Strict parsing only on Liquid::Variable
This commit is contained in:
+7
-17
@@ -30,7 +30,7 @@ module Liquid
|
|||||||
@parse_context = parse_context
|
@parse_context = parse_context
|
||||||
@line_number = parse_context.line_number
|
@line_number = parse_context.line_number
|
||||||
|
|
||||||
strict_parse_with_error_mode_fallback(markup)
|
strict_parse_with_error_context(markup)
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw
|
def raw
|
||||||
@@ -41,22 +41,12 @@ module Liquid
|
|||||||
"in \"{{#{markup}}}\""
|
"in \"{{#{markup}}}\""
|
||||||
end
|
end
|
||||||
|
|
||||||
def lax_parse(markup)
|
def strict_parse_with_error_context(markup)
|
||||||
@filters = []
|
strict_parse(markup)
|
||||||
return unless markup =~ MarkupWithQuotedFragment
|
rescue SyntaxError => e
|
||||||
|
e.line_number = line_number
|
||||||
name_markup = Regexp.last_match(1)
|
e.markup_context = markup_context(markup)
|
||||||
filter_markup = Regexp.last_match(2)
|
raise e
|
||||||
@name = parse_context.parse_expression(name_markup)
|
|
||||||
if filter_markup =~ FilterMarkupRegex
|
|
||||||
filters = Regexp.last_match(1).scan(FilterParser)
|
|
||||||
filters.each do |f|
|
|
||||||
next unless f =~ /\w+/
|
|
||||||
filtername = Regexp.last_match(0)
|
|
||||||
filterargs = f.scan(FilterArgsRegex).flatten
|
|
||||||
@filters << parse_filter_expressions(filtername, filterargs)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def strict_parse(markup)
|
def strict_parse(markup)
|
||||||
|
|||||||
Reference in New Issue
Block a user