mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Merge pull request #744 from Shopify/raw-syntax-method
Make markup validation a method on Liquid::Raw
This commit is contained in:
@@ -6,9 +6,7 @@ module Liquid
|
|||||||
def initialize(tag_name, markup, parse_context)
|
def initialize(tag_name, markup, parse_context)
|
||||||
super
|
super
|
||||||
|
|
||||||
unless markup =~ Syntax
|
ensure_valid_markup(tag_name, markup, parse_context)
|
||||||
raise SyntaxError.new(parse_context.locale.t("errors.syntax.tag_unexpected_args".freeze, tag: tag_name))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
@@ -35,6 +33,14 @@ module Liquid
|
|||||||
def blank?
|
def blank?
|
||||||
@body.empty?
|
@body.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def ensure_valid_markup(tag_name, markup, parse_context)
|
||||||
|
unless markup =~ Syntax
|
||||||
|
raise SyntaxError.new(parse_context.locale.t("errors.syntax.tag_unexpected_args".freeze, tag: tag_name))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Template.register_tag('raw'.freeze, Raw)
|
Template.register_tag('raw'.freeze, Raw)
|
||||||
|
|||||||
Reference in New Issue
Block a user