mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
Fix accessors
This commit is contained in:
@@ -10,7 +10,7 @@ module Liquid
|
|||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
@blocks = []
|
@blocks = []
|
||||||
|
|
||||||
if options =~ Syntax
|
if markup =~ Syntax
|
||||||
@left = Expression.parse(Regexp.last_match(1))
|
@left = Expression.parse(Regexp.last_match(1))
|
||||||
else
|
else
|
||||||
raise SyntaxError, options[:locale].t("errors.syntax.case")
|
raise SyntaxError, options[:locale].t("errors.syntax.case")
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module Liquid
|
|||||||
@variables = variables_from_string(Regexp.last_match(2))
|
@variables = variables_from_string(Regexp.last_match(2))
|
||||||
@name = Expression.parse(Regexp.last_match(1))
|
@name = Expression.parse(Regexp.last_match(1))
|
||||||
when SimpleSyntax
|
when SimpleSyntax
|
||||||
@variables = variables_from_string(@markup)
|
@variables = variables_from_string(markup)
|
||||||
@name = @variables.to_s
|
@name = @variables.to_s
|
||||||
else
|
else
|
||||||
raise SyntaxError, options[:locale].t("errors.syntax.cycle")
|
raise SyntaxError, options[:locale].t("errors.syntax.cycle")
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ module Liquid
|
|||||||
attr_reader :variable
|
attr_reader :variable
|
||||||
|
|
||||||
def parse(_tokens)
|
def parse(_tokens)
|
||||||
@variable = Variable.new(markup, options)
|
@variable = Variable.new(markup, parse_context)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
variable&.render_to_output_buffer(context, +'')
|
@variable.render_to_output_buffer(context, +'')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ module Liquid
|
|||||||
|
|
||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
@from = @limit = nil
|
@from = @limit = nil
|
||||||
|
parse_with_selected_parser(markup)
|
||||||
@for_block = BlockBody.new
|
@for_block = BlockBody.new
|
||||||
@else_block = nil
|
@else_block = nil
|
||||||
parse_with_selected_parser(markup)
|
|
||||||
return unless parse_body(@for_block, tokens)
|
return unless parse_body(@for_block, tokens)
|
||||||
parse_body(@else_block, tokens)
|
parse_body(@else_block, tokens)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module Liquid
|
|||||||
FullTokenPossiblyInvalid = /\A(.*)#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}\z/om
|
FullTokenPossiblyInvalid = /\A(.*)#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}\z/om
|
||||||
|
|
||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
ensure_valid_markup(tag_name, markup, options)
|
ensure_valid_markup(tag_name, markup, parse_context)
|
||||||
@body = +''
|
@body = +''
|
||||||
while (token = tokens.shift)
|
while (token = tokens.shift)
|
||||||
if token =~ FullTokenPossiblyInvalid
|
if token =~ FullTokenPossiblyInvalid
|
||||||
@@ -16,7 +16,7 @@ module Liquid
|
|||||||
@body << token unless token.empty?
|
@body << token unless token.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
raise SyntaxError, options.locale.t("errors.syntax.tag_never_closed", block_name: block_name)
|
raise SyntaxError, parse_context.locale.t("errors.syntax.tag_never_closed", block_name: block_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_to_output_buffer(_context, output)
|
def render_to_output_buffer(_context, output)
|
||||||
|
|||||||
Reference in New Issue
Block a user