Fixing regression from block delimiter enhancement

This commit is contained in:
Jason Hiltz-Laforge
2014-07-23 14:31:28 +00:00
parent c75522026b
commit 55597b8398
3 changed files with 13 additions and 7 deletions

View File

@@ -5,11 +5,6 @@ module Liquid
TAGSTART = "{%".freeze
VARSTART = "{{".freeze
def initialize(tag_name, markup, options)
super
@block_delimiter = "end#{tag_name}"
end
def blank?
@blank
end
@@ -30,7 +25,7 @@ module Liquid
# if we found the proper block delimiter just end parsing here and let the outer block
# proceed
if @block_delimiter == $1
if block_delimiter == $1
end_tag
return
end
@@ -100,6 +95,10 @@ module Liquid
@tag_name
end
def block_delimiter
@block_delimiter ||= "end#{block_name}"
end
def create_variable(token)
token.scan(ContentOfVariable) do |content|
return Variable.new(content.first, @options)

View File

@@ -8,7 +8,7 @@ module Liquid
while token = tokens.shift
if token =~ FullTokenPossiblyInvalid
@nodelist << $1 if $1 != "".freeze
if @block_delimiter == $2
if block_delimiter == $2
end_tag
return
end

View File

@@ -84,4 +84,11 @@ class ParsingQuirksTest < Test::Unit::TestCase
assert_template_result('',"{% if #{markup} %} YES {% endif %}")
end
end
def test_raise_on_invalid_tag_delimiter
assert_raise(Liquid::SyntaxError) do
Template.new.parse('{% end %}')
end
end
end # ParsingQuirksTest