mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Simplifications from review
This commit is contained in:
@@ -26,11 +26,7 @@ module Liquid
|
|||||||
|
|
||||||
private def parse_for_liquid_tag(tokenizer, parse_context)
|
private def parse_for_liquid_tag(tokenizer, parse_context)
|
||||||
while token = tokenizer.shift
|
while token = tokenizer.shift
|
||||||
case
|
unless token.empty? || token =~ WhitespaceOrNothing
|
||||||
when token.empty? || token =~ WhitespaceOrNothing
|
|
||||||
# pass, but assign line_number below, since it could change even when
|
|
||||||
# the token is empty
|
|
||||||
else
|
|
||||||
unless token =~ LiquidTagToken
|
unless token =~ LiquidTagToken
|
||||||
# line isn't empty but didn't match tag syntax, yield and let the
|
# line isn't empty but didn't match tag syntax, yield and let the
|
||||||
# caller raise a syntax error
|
# caller raise a syntax error
|
||||||
@@ -73,7 +69,7 @@ module Liquid
|
|||||||
|
|
||||||
if tag_name == 'liquid'.freeze
|
if tag_name == 'liquid'.freeze
|
||||||
liquid_tag_tokenizer = Tokenizer.new(markup, line_number: parse_context.line_number, for_liquid_tag: true)
|
liquid_tag_tokenizer = Tokenizer.new(markup, line_number: parse_context.line_number, for_liquid_tag: true)
|
||||||
next parse(liquid_tag_tokenizer, parse_context, &block)
|
next parse_for_liquid_tag(liquid_tag_tokenizer, parse_context, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless tag = registered_tags[tag_name]
|
unless tag = registered_tags[tag_name]
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
syntax:
|
syntax:
|
||||||
tag_unexpected_args: "Syntax Error in '%{tag}' - Valid syntax: %{tag}"
|
tag_unexpected_args: "Syntax Error in '%{tag}' - Valid syntax: %{tag}"
|
||||||
assign: "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"
|
assign: "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"
|
||||||
local: "Syntax Error in 'local' - Valid syntax: local [var] = [source]"
|
|
||||||
capture: "Syntax Error in 'capture' - Valid syntax: capture [var]"
|
capture: "Syntax Error in 'capture' - Valid syntax: capture [var]"
|
||||||
case: "Syntax Error in 'case' - Valid syntax: case [condition]"
|
case: "Syntax Error in 'case' - Valid syntax: case [condition]"
|
||||||
case_invalid_when: "Syntax Error in tag 'case' - Valid when condition: {% when [condition] [or condition2...] %}"
|
case_invalid_when: "Syntax Error in tag 'case' - Valid when condition: {% when [condition] [or condition2...] %}"
|
||||||
|
|||||||
Reference in New Issue
Block a user