mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
faster BlockBody variable matching
This commit is contained in:
@@ -246,10 +246,16 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_variable(token, parse_context)
|
def create_variable(token, parse_context)
|
||||||
if token =~ ContentOfVariable
|
if token.end_with?("}}")
|
||||||
markup = Regexp.last_match(1)
|
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)
|
return Variable.new(markup, parse_context)
|
||||||
end
|
end
|
||||||
|
|
||||||
BlockBody.raise_missing_variable_terminator(token, parse_context)
|
BlockBody.raise_missing_variable_terminator(token, parse_context)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user