mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 10:20:43 -07:00
rigid set_attribute in for parsing
This commit is contained in:
committed by
Guilherme Carreiro
parent
b8958f626d
commit
b5fbad08c6
@@ -104,7 +104,7 @@ module Liquid
|
|||||||
raise SyntaxError, options[:locale].t("errors.syntax.for_invalid_attribute")
|
raise SyntaxError, options[:locale].t("errors.syntax.for_invalid_attribute")
|
||||||
end
|
end
|
||||||
p.consume(:colon)
|
p.consume(:colon)
|
||||||
set_attribute(attribute, p.expression)
|
set_attribute(attribute, p.expression, safe: true)
|
||||||
end
|
end
|
||||||
p.consume(:end_of_string)
|
p.consume(:end_of_string)
|
||||||
end
|
end
|
||||||
@@ -178,16 +178,16 @@ module Liquid
|
|||||||
output
|
output
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_attribute(key, expr)
|
def set_attribute(key, expr, safe: false)
|
||||||
case key
|
case key
|
||||||
when 'offset'
|
when 'offset'
|
||||||
@from = if expr == 'continue'
|
@from = if expr == 'continue'
|
||||||
:continue
|
:continue
|
||||||
else
|
else
|
||||||
parse_expression(expr)
|
parse_expression(expr, safe: safe)
|
||||||
end
|
end
|
||||||
when 'limit'
|
when 'limit'
|
||||||
@limit = parse_expression(expr)
|
@limit = parse_expression(expr, safe: safe)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user