Raise error on invalid snippet name

This commit is contained in:
Julia Boutin
2025-10-30 12:00:44 +01:00
committed by Guilherme Carreiro
parent 98fbd985d8
commit 5ceb0e9cec
2 changed files with 22 additions and 5 deletions
+2 -1
View File
@@ -10,7 +10,7 @@ module Liquid
# @liquid_description
# You can create inline snippets to make your Liquid code more modular.
# @liquid_syntax
# {% snippet input %}
# {% snippet snippet_name %}
# value
# {% endsnippet %}
class Snippet < Block
@@ -19,6 +19,7 @@ module Liquid
p = @parse_context.new_parser(markup)
if p.look(:id)
@to = p.consume(:id)
p.consume(:end_of_string)
else
raise SyntaxError, options[:locale].t("errors.syntax.snippet")
end