Fix accessors

This commit is contained in:
Mike Angell
2019-10-16 01:57:42 +10:00
parent 938ca78be6
commit 7f1e25005b
5 changed files with 7 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ module Liquid
def parse(tokens)
@blocks = []
if options =~ Syntax
if markup =~ Syntax
@left = Expression.parse(Regexp.last_match(1))
else
raise SyntaxError, options[:locale].t("errors.syntax.case")

View File

@@ -25,7 +25,7 @@ module Liquid
@variables = variables_from_string(Regexp.last_match(2))
@name = Expression.parse(Regexp.last_match(1))
when SimpleSyntax
@variables = variables_from_string(@markup)
@variables = variables_from_string(markup)
@name = @variables.to_s
else
raise SyntaxError, options[:locale].t("errors.syntax.cycle")

View File

@@ -15,11 +15,11 @@ module Liquid
attr_reader :variable
def parse(_tokens)
@variable = Variable.new(markup, options)
@variable = Variable.new(markup, parse_context)
end
def render(context)
variable&.render_to_output_buffer(context, +'')
@variable.render_to_output_buffer(context, +'')
end
end

View File

@@ -52,9 +52,9 @@ module Liquid
def parse(tokens)
@from = @limit = nil
parse_with_selected_parser(markup)
@for_block = BlockBody.new
@else_block = nil
parse_with_selected_parser(markup)
return unless parse_body(@for_block, tokens)
parse_body(@else_block, tokens)
end

View File

@@ -6,7 +6,7 @@ module Liquid
FullTokenPossiblyInvalid = /\A(.*)#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}\z/om
def parse(tokens)
ensure_valid_markup(tag_name, markup, options)
ensure_valid_markup(tag_name, markup, parse_context)
@body = +''
while (token = tokens.shift)
if token =~ FullTokenPossiblyInvalid
@@ -16,7 +16,7 @@ module Liquid
@body << token unless token.empty?
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
def render_to_output_buffer(_context, output)