Revert "Merge pull request #325 from Shopify/remove-variable-incomplete-end"

That pull request broke raw tags with open variable tags. E.g.

{% raw %}
{{
{% endraw %}
{{ 1 }}

This reverts commit fbaabf3b59, reversing
changes made to af24d2c2ab.
This commit is contained in:
Dylan Thacker-Smith
2014-03-24 09:59:07 -04:00
parent d1bfda15e3
commit fdf03076e0
5 changed files with 18 additions and 24 deletions
+10 -11
View File
@@ -3,6 +3,7 @@ module Liquid
IsTag = /\A#{TagStart}/o
IsVariable = /\A#{VariableStart}/o
FullToken = /\A#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}\z/om
ContentOfVariable = /\A#{VariableStart}(.*)#{VariableEnd}\z/om
def blank?
@blank || false
@@ -40,14 +41,10 @@ module Liquid
unknown_tag($1, $2, tokens)
end
else
raise_tag_termination_error("errors.syntax.tag_termination", token + tokens.shift.to_s, TagEnd)
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_termination", :token => token, :tag_end => TagEnd.inspect))
end
when IsVariable
if token.size < 4
raise_tag_termination_error("errors.syntax.variable_termination", token + tokens.shift.to_s, VariableEnd)
end
markup = token[2...-2]
new_var = Variable.new(markup, @options)
new_var = create_variable(token)
@nodelist << new_var
@children << new_var
@blank = false
@@ -102,6 +99,13 @@ module Liquid
@tag_name
end
def create_variable(token)
token.scan(ContentOfVariable) do |content|
return Variable.new(content.first, @options)
end
raise SyntaxError.new(options[:locale].t("errors.syntax.variable_termination", :token => token, :tag_end => VariableEnd.inspect))
end
def render(context)
render_all(@nodelist, context)
end
@@ -112,11 +116,6 @@ module Liquid
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_never_closed", :block_name => block_name))
end
def raise_tag_termination_error(error_name, token, tag_end)
token = token.size > 50 ? "'#{token[0...47]}'..." : "'#{token}'"
raise SyntaxError.new(options[:locale].t(error_name, :token => token, :tag_end => tag_end))
end
def render_all(list, context)
output = []
context.resource_limits[:render_length_current] = 0