mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Convenience methods for raising terminator syntax errors
This commit is contained in:
@@ -34,7 +34,7 @@ module Liquid
|
|||||||
return yield tag_name, markup
|
return yield tag_name, markup
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_termination".freeze, :token => token, :tag_end => TagEnd.inspect))
|
raise_missing_tag_terminator(token, options)
|
||||||
end
|
end
|
||||||
when token.start_with?(VARSTART)
|
when token.start_with?(VARSTART)
|
||||||
new_var = create_variable(token, options)
|
new_var = create_variable(token, options)
|
||||||
@@ -117,6 +117,14 @@ module Liquid
|
|||||||
markup = token.is_a?(Token) ? token.child(content.first) : content.first
|
markup = token.is_a?(Token) ? token.child(content.first) : content.first
|
||||||
return Variable.new(markup, options)
|
return Variable.new(markup, options)
|
||||||
end
|
end
|
||||||
|
raise_missing_variable_terminator(token, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def raise_missing_tag_terminator(token, options)
|
||||||
|
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_termination".freeze, :token => token, :tag_end => TagEnd.inspect))
|
||||||
|
end
|
||||||
|
|
||||||
|
def raise_missing_variable_terminator(token, options)
|
||||||
raise SyntaxError.new(options[:locale].t("errors.syntax.variable_termination".freeze, :token => token, :tag_end => VariableEnd.inspect))
|
raise SyntaxError.new(options[:locale].t("errors.syntax.variable_termination".freeze, :token => token, :tag_end => VariableEnd.inspect))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user