mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Fixing regression from block delimiter enhancement
This commit is contained in:
+5
-6
@@ -5,11 +5,6 @@ module Liquid
|
|||||||
TAGSTART = "{%".freeze
|
TAGSTART = "{%".freeze
|
||||||
VARSTART = "{{".freeze
|
VARSTART = "{{".freeze
|
||||||
|
|
||||||
def initialize(tag_name, markup, options)
|
|
||||||
super
|
|
||||||
@block_delimiter = "end#{tag_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def blank?
|
def blank?
|
||||||
@blank
|
@blank
|
||||||
end
|
end
|
||||||
@@ -30,7 +25,7 @@ module Liquid
|
|||||||
|
|
||||||
# if we found the proper block delimiter just end parsing here and let the outer block
|
# if we found the proper block delimiter just end parsing here and let the outer block
|
||||||
# proceed
|
# proceed
|
||||||
if @block_delimiter == $1
|
if block_delimiter == $1
|
||||||
end_tag
|
end_tag
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -100,6 +95,10 @@ module Liquid
|
|||||||
@tag_name
|
@tag_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def block_delimiter
|
||||||
|
@block_delimiter ||= "end#{block_name}"
|
||||||
|
end
|
||||||
|
|
||||||
def create_variable(token)
|
def create_variable(token)
|
||||||
token.scan(ContentOfVariable) do |content|
|
token.scan(ContentOfVariable) do |content|
|
||||||
return Variable.new(content.first, @options)
|
return Variable.new(content.first, @options)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ module Liquid
|
|||||||
while token = tokens.shift
|
while token = tokens.shift
|
||||||
if token =~ FullTokenPossiblyInvalid
|
if token =~ FullTokenPossiblyInvalid
|
||||||
@nodelist << $1 if $1 != "".freeze
|
@nodelist << $1 if $1 != "".freeze
|
||||||
if @block_delimiter == $2
|
if block_delimiter == $2
|
||||||
end_tag
|
end_tag
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -84,4 +84,11 @@ class ParsingQuirksTest < Test::Unit::TestCase
|
|||||||
assert_template_result('',"{% if #{markup} %} YES {% endif %}")
|
assert_template_result('',"{% if #{markup} %} YES {% endif %}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_raise_on_invalid_tag_delimiter
|
||||||
|
assert_raise(Liquid::SyntaxError) do
|
||||||
|
Template.new.parse('{% end %}')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end # ParsingQuirksTest
|
end # ParsingQuirksTest
|
||||||
|
|||||||
Reference in New Issue
Block a user