diff --git a/lib/liquid/block_body.rb b/lib/liquid/block_body.rb index ec40e2129..816c2bc62 100644 --- a/lib/liquid/block_body.rb +++ b/lib/liquid/block_body.rb @@ -246,10 +246,17 @@ def render_node(context, output, node) end def create_variable(token, parse_context) - if token =~ ContentOfVariable - markup = Regexp.last_match(1) + if token.end_with?("}}") + i = 2 + i = 3 if token[i] == "-" + parse_end = token.length - 3 + parse_end -= 1 if token[parse_end] == "-" + markup_end = parse_end - i + 1 + markup = markup_end <= 0 ? "" : token.byteslice(i, markup_end) + return Variable.new(markup, parse_context) end + BlockBody.raise_missing_variable_terminator(token, parse_context) end