make markup validation a method on Liquid::Raw

This commit is contained in:
Drew Martin 2016-04-13 14:52:30 -04:00
parent 361c695264
commit a80ecb7678

View File

@ -6,9 +6,7 @@ module Liquid
def initialize(tag_name, markup, parse_context)
super
unless markup =~ Syntax
raise SyntaxError.new(parse_context.locale.t("errors.syntax.tag_unexpected_args".freeze, tag: tag_name))
end
ensure_valid_markup(tag_name, markup, parse_context)
end
def parse(tokens)
@ -35,6 +33,14 @@ module Liquid
def blank?
@body.empty?
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
Template.register_tag('raw'.freeze, Raw)