Skip to content

Commit

Permalink
faster BlockBody variable matching
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmichaelgo committed Oct 25, 2024
1 parent b355378 commit cb16219
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/liquid/block_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,16 @@ 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 = token[i..parse_end]
return Variable.new(markup, parse_context)
end

BlockBody.raise_missing_variable_terminator(token, parse_context)
end

Expand Down

0 comments on commit cb16219

Please sign in to comment.