mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Fixing regression from block delimiter enhancement
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user