mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
fix rubocop offenses: autocorrect style/layout violations
This commit is contained in:
+57
-30
@@ -41,11 +41,15 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
# ── Position ────────────────────────────────────────────────────
|
# ── Position ────────────────────────────────────────────────────
|
||||||
def pos; @ss.pos; end
|
def pos = @ss.pos
|
||||||
def pos=(n); @ss.pos = n; end
|
|
||||||
def eos?; @ss.eos?; end
|
def pos=(n)
|
||||||
def peek_byte; @ss.peek_byte; end
|
@ss.pos = n
|
||||||
def scan_byte; @ss.scan_byte; end
|
end
|
||||||
|
|
||||||
|
def eos? = @ss.eos?
|
||||||
|
def peek_byte = @ss.peek_byte
|
||||||
|
def scan_byte = @ss.scan_byte
|
||||||
|
|
||||||
# Reset scanner to a new string (for reuse on sub-markup)
|
# Reset scanner to a new string (for reuse on sub-markup)
|
||||||
def reset(source)
|
def reset(source)
|
||||||
@@ -65,7 +69,8 @@ module Liquid
|
|||||||
while (b = @ss.peek_byte)
|
while (b = @ss.peek_byte)
|
||||||
case b
|
case b
|
||||||
when SPACE, TAB, CR, FF then @ss.scan_byte
|
when SPACE, TAB, CR, FF then @ss.scan_byte
|
||||||
when NL then @ss.scan_byte; nl += 1
|
when NL then @ss.scan_byte
|
||||||
|
nl += 1
|
||||||
else break
|
else break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -79,6 +84,7 @@ module Liquid
|
|||||||
while p < len
|
while p < len
|
||||||
b = @source.getbyte(p)
|
b = @source.getbyte(p)
|
||||||
return false unless b == SPACE || b == TAB || b == NL || b == CR || b == FF
|
return false unless b == SPACE || b == TAB || b == NL || b == CR || b == FF
|
||||||
|
|
||||||
p += 1
|
p += 1
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
@@ -90,10 +96,12 @@ module Liquid
|
|||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return 0 unless b && ((b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == USCORE)
|
return 0 unless b && ((b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == USCORE)
|
||||||
|
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
while (b = @ss.peek_byte)
|
while (b = @ss.peek_byte)
|
||||||
break unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) ||
|
break unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) ||
|
||||||
(b >= 48 && b <= 57) || b == USCORE || b == DASH
|
(b >= 48 && b <= 57) || b == USCORE || b == DASH
|
||||||
|
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
end
|
end
|
||||||
@ss.scan_byte if @ss.peek_byte == QMARK
|
@ss.scan_byte if @ss.peek_byte == QMARK
|
||||||
@@ -123,11 +131,13 @@ module Liquid
|
|||||||
def scan_id
|
def scan_id
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return nil unless b && ((b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == USCORE)
|
return unless b && ((b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == USCORE)
|
||||||
|
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
while (b = @ss.peek_byte)
|
while (b = @ss.peek_byte)
|
||||||
break unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) ||
|
break unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) ||
|
||||||
(b >= 48 && b <= 57) || b == USCORE || b == DASH
|
(b >= 48 && b <= 57) || b == USCORE || b == DASH
|
||||||
|
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
end
|
end
|
||||||
@ss.scan_byte if @ss.peek_byte == QMARK
|
@ss.scan_byte if @ss.peek_byte == QMARK
|
||||||
@@ -149,19 +159,19 @@ module Liquid
|
|||||||
def scan_number
|
def scan_number
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return nil unless b
|
return unless b
|
||||||
|
|
||||||
if b == DASH
|
if b == DASH
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
unless b && b >= ZERO && b <= NINE
|
unless b && b >= ZERO && b <= NINE
|
||||||
@ss.pos = start
|
@ss.pos = start
|
||||||
return nil
|
return
|
||||||
end
|
end
|
||||||
elsif b >= ZERO && b <= NINE
|
elsif b >= ZERO && b <= NINE
|
||||||
# ok
|
# ok
|
||||||
else
|
else
|
||||||
return nil
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
# Scan digits
|
# Scan digits
|
||||||
@@ -188,7 +198,8 @@ module Liquid
|
|||||||
# Scan a quoted string ('...' or "..."). Returns the content without quotes, or nil.
|
# Scan a quoted string ('...' or "..."). Returns the content without quotes, or nil.
|
||||||
def scan_quoted_string
|
def scan_quoted_string
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return nil unless b == QUOTE_S || b == QUOTE_D
|
return unless b == QUOTE_S || b == QUOTE_D
|
||||||
|
|
||||||
quote = b
|
quote = b
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
@@ -201,7 +212,8 @@ module Liquid
|
|||||||
# Scan a quoted string including quotes. Returns the full "..." or '...' string, or nil.
|
# Scan a quoted string including quotes. Returns the full "..." or '...' string, or nil.
|
||||||
def scan_quoted_string_raw
|
def scan_quoted_string_raw
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return nil unless b == QUOTE_S || b == QUOTE_D
|
return unless b == QUOTE_S || b == QUOTE_D
|
||||||
|
|
||||||
quote = b
|
quote = b
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
@@ -215,7 +227,8 @@ module Liquid
|
|||||||
# Returns the string or nil
|
# Returns the string or nil
|
||||||
def scan_dotted_id
|
def scan_dotted_id
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
return nil unless scan_id
|
return unless scan_id
|
||||||
|
|
||||||
while @ss.peek_byte == DOT
|
while @ss.peek_byte == DOT
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
unless scan_id
|
unless scan_id
|
||||||
@@ -230,6 +243,7 @@ module Liquid
|
|||||||
def skip_fragment
|
def skip_fragment
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return 0 unless b
|
return 0 unless b
|
||||||
|
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
if b == QUOTE_S || b == QUOTE_D
|
if b == QUOTE_S || b == QUOTE_D
|
||||||
quote = b
|
quote = b
|
||||||
@@ -239,6 +253,7 @@ module Liquid
|
|||||||
else
|
else
|
||||||
while (b = @ss.peek_byte)
|
while (b = @ss.peek_byte)
|
||||||
break if b == SPACE || b == TAB || b == NL || b == CR || b == COMMA || b == PIPE
|
break if b == SPACE || b == TAB || b == NL || b == CR || b == COMMA || b == PIPE
|
||||||
|
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -248,13 +263,15 @@ module Liquid
|
|||||||
# Scan a "QuotedFragment" — a quoted string or non-whitespace/comma/pipe run
|
# Scan a "QuotedFragment" — a quoted string or non-whitespace/comma/pipe run
|
||||||
def scan_fragment
|
def scan_fragment
|
||||||
b = @ss.peek_byte
|
b = @ss.peek_byte
|
||||||
return nil unless b
|
return unless b
|
||||||
|
|
||||||
if b == QUOTE_S || b == QUOTE_D
|
if b == QUOTE_S || b == QUOTE_D
|
||||||
scan_quoted_string_raw
|
scan_quoted_string_raw
|
||||||
else
|
else
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
while (b = @ss.peek_byte)
|
while (b = @ss.peek_byte)
|
||||||
break if b == SPACE || b == TAB || b == NL || b == CR || b == COMMA || b == PIPE
|
break if b == SPACE || b == TAB || b == NL || b == CR || b == COMMA || b == PIPE
|
||||||
|
|
||||||
@ss.scan_byte
|
@ss.scan_byte
|
||||||
end
|
end
|
||||||
len = @ss.pos - start
|
len = @ss.pos - start
|
||||||
@@ -264,8 +281,13 @@ module Liquid
|
|||||||
|
|
||||||
# ── Comparison operators ────────────────────────────────────────
|
# ── Comparison operators ────────────────────────────────────────
|
||||||
COMPARISON_OPS = {
|
COMPARISON_OPS = {
|
||||||
'==' => '==', '!=' => '!=', '<>' => '<>',
|
'==' => '==',
|
||||||
'<=' => '<=', '>=' => '>=', '<' => '<', '>' => '>',
|
'!=' => '!=',
|
||||||
|
'<>' => '<>',
|
||||||
|
'<=' => '<=',
|
||||||
|
'>=' => '>=',
|
||||||
|
'<' => '<',
|
||||||
|
'>' => '>',
|
||||||
'contains' => 'contains',
|
'contains' => 'contains',
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
@@ -282,13 +304,15 @@ module Liquid
|
|||||||
end
|
end
|
||||||
when 99 # 'c' for contains
|
when 99 # 'c' for contains
|
||||||
id = scan_id
|
id = scan_id
|
||||||
return nil unless id == "contains"
|
return unless id == "contains"
|
||||||
|
|
||||||
return COMPARISON_OPS['contains']
|
return COMPARISON_OPS['contains']
|
||||||
else
|
else
|
||||||
return nil
|
return
|
||||||
end
|
end
|
||||||
op_str = @source.byteslice(start, @ss.pos - start)
|
op_str = @source.byteslice(start, @ss.pos - start)
|
||||||
COMPARISON_OPS[op_str] || (@ss.pos = start; nil)
|
COMPARISON_OPS[op_str] || (@ss.pos = start
|
||||||
|
nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
# ── Tag parsing helpers ─────────────────────────────────────────
|
# ── Tag parsing helpers ─────────────────────────────────────────
|
||||||
@@ -304,7 +328,8 @@ module Liquid
|
|||||||
@ss.scan_byte if peek_byte == DASH # skip whitespace control '-'
|
@ss.scan_byte if peek_byte == DASH # skip whitespace control '-'
|
||||||
nl = skip_ws
|
nl = skip_ws
|
||||||
tag_name = scan_tag_name
|
tag_name = scan_tag_name
|
||||||
return nil unless tag_name
|
return unless tag_name
|
||||||
|
|
||||||
nl += skip_ws
|
nl += skip_ws
|
||||||
|
|
||||||
# markup is everything up to optional '-' before '%}'
|
# markup is everything up to optional '-' before '%}'
|
||||||
@@ -319,7 +344,8 @@ module Liquid
|
|||||||
# Parse variable token interior: extract markup from "{{[-] ... [-]}}"
|
# Parse variable token interior: extract markup from "{{[-] ... [-]}}"
|
||||||
def parse_variable_token(token)
|
def parse_variable_token(token)
|
||||||
len = token.bytesize
|
len = token.bytesize
|
||||||
return nil if len < 4
|
return if len < 4
|
||||||
|
|
||||||
i = 2
|
i = 2
|
||||||
i = 3 if token.getbyte(i) == DASH
|
i = 3 if token.getbyte(i) == DASH
|
||||||
parse_end = len - 3
|
parse_end = len - 3
|
||||||
@@ -337,7 +363,7 @@ module Liquid
|
|||||||
def parse_simple_condition
|
def parse_simple_condition
|
||||||
skip_ws
|
skip_ws
|
||||||
@cond_left = scan_fragment
|
@cond_left = scan_fragment
|
||||||
return nil unless @cond_left
|
return unless @cond_left
|
||||||
|
|
||||||
skip_ws
|
skip_ws
|
||||||
if eos?
|
if eos?
|
||||||
@@ -347,14 +373,15 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
@cond_op = scan_comparison_op
|
@cond_op = scan_comparison_op
|
||||||
return nil unless @cond_op
|
return unless @cond_op
|
||||||
|
|
||||||
skip_ws
|
skip_ws
|
||||||
@cond_right = scan_fragment
|
@cond_right = scan_fragment
|
||||||
return nil unless @cond_right
|
return unless @cond_right
|
||||||
|
|
||||||
skip_ws
|
skip_ws
|
||||||
return nil unless eos? # trailing junk
|
return unless eos? # trailing junk
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
# ── For tag parser ────────────────────────────────────────────────
|
# ── For tag parser ────────────────────────────────────────────────
|
||||||
@@ -366,11 +393,11 @@ module Liquid
|
|||||||
def parse_for_markup
|
def parse_for_markup
|
||||||
skip_ws
|
skip_ws
|
||||||
@for_var = scan_id
|
@for_var = scan_id
|
||||||
return nil unless @for_var
|
return unless @for_var
|
||||||
|
|
||||||
skip_ws
|
skip_ws
|
||||||
# expect "in"
|
# expect "in"
|
||||||
return nil unless scan_id == "in"
|
return unless scan_id == "in"
|
||||||
|
|
||||||
skip_ws
|
skip_ws
|
||||||
# Collection: parenthesized range or fragment
|
# Collection: parenthesized range or fragment
|
||||||
@@ -386,7 +413,7 @@ module Liquid
|
|||||||
@for_collection = @source.byteslice(start, @ss.pos - start)
|
@for_collection = @source.byteslice(start, @ss.pos - start)
|
||||||
else
|
else
|
||||||
@for_collection = scan_fragment
|
@for_collection = scan_fragment
|
||||||
return nil unless @for_collection
|
return unless @for_collection
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_ws
|
skip_ws
|
||||||
|
|||||||
@@ -88,8 +88,10 @@ module Liquid
|
|||||||
if first == DASH
|
if first == DASH
|
||||||
pos += 1
|
pos += 1
|
||||||
return false if pos >= len
|
return false if pos >= len
|
||||||
|
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
return false if b < ZERO || b > NINE
|
return false if b < ZERO || b > NINE
|
||||||
|
|
||||||
pos += 1
|
pos += 1
|
||||||
elsif first >= ZERO && first <= NINE
|
elsif first >= ZERO && first <= NINE
|
||||||
pos += 1
|
pos += 1
|
||||||
@@ -100,7 +102,8 @@ module Liquid
|
|||||||
# Scan digits
|
# Scan digits
|
||||||
while pos < len
|
while pos < len
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
break unless b >= ZERO && b <= NINE
|
break if b < ZERO || b > NINE
|
||||||
|
|
||||||
pos += 1
|
pos += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -117,7 +120,8 @@ module Liquid
|
|||||||
digit_after_dot = pos
|
digit_after_dot = pos
|
||||||
while pos < len
|
while pos < len
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
break unless b >= ZERO && b <= NINE
|
break if b < ZERO || b > NINE
|
||||||
|
|
||||||
pos += 1
|
pos += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -127,7 +131,6 @@ module Liquid
|
|||||||
elsif pos > digit_after_dot
|
elsif pos > digit_after_dot
|
||||||
# Float followed by more dots or other chars: "1.2.3.4"
|
# Float followed by more dots or other chars: "1.2.3.4"
|
||||||
# Return the float portion up to second dot
|
# Return the float portion up to second dot
|
||||||
first_dot_pos = dot_pos + 1
|
|
||||||
while pos < len
|
while pos < len
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
if b == DOT
|
if b == DOT
|
||||||
@@ -135,6 +138,7 @@ module Liquid
|
|||||||
elsif b < ZERO || b > NINE
|
elsif b < ZERO || b > NINE
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
pos += 1
|
pos += 1
|
||||||
end
|
end
|
||||||
return markup.byteslice(0, pos).to_f
|
return markup.byteslice(0, pos).to_f
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ module Liquid
|
|||||||
Condition.parse_expression(parse_context, markup, safe: safe)
|
Condition.parse_expression(parse_context, markup, safe: safe)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def lax_parse(markup)
|
def lax_parse(markup)
|
||||||
# Fastest path: simple identifier truthiness like "product.available" or "forloop.first"
|
# Fastest path: simple identifier truthiness like "product.available" or "forloop.first"
|
||||||
if (simple = Variable.simple_variable_markup(markup))
|
if (simple = Variable.simple_variable_markup(markup))
|
||||||
|
|||||||
+16
-16
@@ -17,7 +17,7 @@ module Liquid
|
|||||||
# Avoids regex MatchData allocation.
|
# Avoids regex MatchData allocation.
|
||||||
def self.simple_variable_markup(markup)
|
def self.simple_variable_markup(markup)
|
||||||
len = markup.bytesize
|
len = markup.bytesize
|
||||||
return nil if len == 0
|
return if len == 0
|
||||||
|
|
||||||
# Skip leading whitespace
|
# Skip leading whitespace
|
||||||
pos = 0
|
pos = 0
|
||||||
@@ -26,13 +26,13 @@ module Liquid
|
|||||||
break unless b == 32 || b == 9 || b == 10 || b == 13
|
break unless b == 32 || b == 9 || b == 10 || b == 13
|
||||||
pos += 1
|
pos += 1
|
||||||
end
|
end
|
||||||
return nil if pos >= len
|
return if pos >= len
|
||||||
|
|
||||||
start = pos
|
start = pos
|
||||||
|
|
||||||
# First char must be [a-zA-Z_]
|
# First char must be [a-zA-Z_]
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
return nil unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == 95
|
return unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == 95
|
||||||
pos += 1
|
pos += 1
|
||||||
|
|
||||||
# Scan segments: [\w-]* (. [\w-]*)*
|
# Scan segments: [\w-]* (. [\w-]*)*
|
||||||
@@ -43,9 +43,9 @@ module Liquid
|
|||||||
elsif b == 46 # '.'
|
elsif b == 46 # '.'
|
||||||
pos += 1
|
pos += 1
|
||||||
# After dot, must have [a-zA-Z_]
|
# After dot, must have [a-zA-Z_]
|
||||||
return nil if pos >= len
|
return if pos >= len
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
return nil unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == 95
|
return unless (b >= 97 && b <= 122) || (b >= 65 && b <= 90) || b == 95
|
||||||
pos += 1
|
pos += 1
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
@@ -57,12 +57,12 @@ module Liquid
|
|||||||
# Skip trailing whitespace
|
# Skip trailing whitespace
|
||||||
while pos < len
|
while pos < len
|
||||||
b = markup.getbyte(pos)
|
b = markup.getbyte(pos)
|
||||||
return nil unless b == 32 || b == 9 || b == 10 || b == 13
|
return unless b == 32 || b == 9 || b == 10 || b == 13
|
||||||
pos += 1
|
pos += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must have consumed everything
|
# Must have consumed everything
|
||||||
return nil unless pos == len
|
return unless pos == len
|
||||||
|
|
||||||
if start == 0 && content_end == len
|
if start == 0 && content_end == len
|
||||||
markup
|
markup
|
||||||
@@ -157,15 +157,15 @@ module Liquid
|
|||||||
ss = parse_context.string_scanner
|
ss = parse_context.string_scanner
|
||||||
|
|
||||||
first_byte = expr_markup.getbyte(0)
|
first_byte = expr_markup.getbyte(0)
|
||||||
if first_byte == 39 || first_byte == 34 # quoted string
|
@name = if first_byte == 39 || first_byte == 34 # quoted string
|
||||||
# Strip quotes for string literal
|
# Strip quotes for string literal
|
||||||
@name = expr_markup.byteslice(1, expr_markup.bytesize - 2)
|
expr_markup.byteslice(1, expr_markup.bytesize - 2)
|
||||||
elsif Expression::LITERALS.key?(expr_markup)
|
elsif Expression::LITERALS.key?(expr_markup)
|
||||||
@name = Expression::LITERALS[expr_markup]
|
Expression::LITERALS[expr_markup]
|
||||||
elsif cache
|
elsif cache
|
||||||
@name = cache[expr_markup] || (cache[expr_markup] = VariableLookup.parse_simple(expr_markup, ss, cache).freeze)
|
cache[expr_markup] || (cache[expr_markup] = VariableLookup.parse_simple(expr_markup, ss, cache).freeze)
|
||||||
else
|
else
|
||||||
@name = VariableLookup.parse_simple(expr_markup, ss || StringScanner.new(""), nil).freeze
|
VariableLookup.parse_simple(expr_markup, ss || StringScanner.new(""), nil).freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# End of markup? No filters.
|
# End of markup? No filters.
|
||||||
@@ -225,7 +225,7 @@ module Liquid
|
|||||||
|
|
||||||
# Skip trailing whitespace
|
# Skip trailing whitespace
|
||||||
filter_pos += 1 while filter_pos < len && (b = markup.getbyte(filter_pos)) && (b == 32 || b == 9 || b == 10 || b == 13)
|
filter_pos += 1 while filter_pos < len && (b = markup.getbyte(filter_pos)) && (b == 32 || b == 9 || b == 10 || b == 13)
|
||||||
return false unless filter_pos >= len
|
return false if filter_pos < len
|
||||||
|
|
||||||
@filters = Const::EMPTY_ARRAY if @filters.empty?
|
@filters = Const::EMPTY_ARRAY if @filters.empty?
|
||||||
true
|
true
|
||||||
@@ -321,10 +321,10 @@ module Liquid
|
|||||||
|
|
||||||
def render_to_output_buffer(context, output)
|
def render_to_output_buffer(context, output)
|
||||||
# Fast path: no filters and no global filter
|
# Fast path: no filters and no global filter
|
||||||
if @filters.empty? && context.global_filter.nil?
|
obj = if @filters.empty? && context.global_filter.nil?
|
||||||
obj = context.evaluate(@name)
|
context.evaluate(@name)
|
||||||
else
|
else
|
||||||
obj = render(context)
|
render(context)
|
||||||
end
|
end
|
||||||
render_obj_to_output(obj, output)
|
render_obj_to_output(obj, output)
|
||||||
output
|
output
|
||||||
|
|||||||
Reference in New Issue
Block a user