From 7dc488a73b8bbe8717f318ed510bacc090abe3be Mon Sep 17 00:00:00 2001 From: Justin Li Date: Tue, 9 Apr 2019 15:19:47 -0400 Subject: [PATCH] Simplifications from review --- lib/liquid/block_body.rb | 8 ++------ lib/liquid/locales/en.yml | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/liquid/block_body.rb b/lib/liquid/block_body.rb index 4861bca..cffb15b 100644 --- a/lib/liquid/block_body.rb +++ b/lib/liquid/block_body.rb @@ -26,11 +26,7 @@ module Liquid private def parse_for_liquid_tag(tokenizer, parse_context) while token = tokenizer.shift - case - when token.empty? || token =~ WhitespaceOrNothing - # pass, but assign line_number below, since it could change even when - # the token is empty - else + unless token.empty? || token =~ WhitespaceOrNothing unless token =~ LiquidTagToken # line isn't empty but didn't match tag syntax, yield and let the # caller raise a syntax error @@ -73,7 +69,7 @@ module Liquid if tag_name == 'liquid'.freeze 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 unless tag = registered_tags[tag_name] diff --git a/lib/liquid/locales/en.yml b/lib/liquid/locales/en.yml index 56c068f..48b3b1d 100644 --- a/lib/liquid/locales/en.yml +++ b/lib/liquid/locales/en.yml @@ -3,7 +3,6 @@ syntax: tag_unexpected_args: "Syntax Error in '%{tag}' - Valid syntax: %{tag}" 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]" case: "Syntax Error in 'case' - Valid syntax: case [condition]" case_invalid_when: "Syntax Error in tag 'case' - Valid when condition: {% when [condition] [or condition2...] %}"