mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Attempt to strict parse variables before lax parsing in lax error mode (#1338)
This commit is contained in:
committed by
GitHub
parent
1d63d5db5f
commit
7754d5aef5
@@ -2,6 +2,18 @@
|
||||
|
||||
module Liquid
|
||||
module ParserSwitching
|
||||
def strict_parse_with_error_mode_fallback(markup)
|
||||
strict_parse_with_error_context(markup)
|
||||
rescue SyntaxError => e
|
||||
case parse_context.error_mode
|
||||
when :strict
|
||||
raise
|
||||
when :warn
|
||||
parse_context.warnings << e
|
||||
end
|
||||
lax_parse(markup)
|
||||
end
|
||||
|
||||
def parse_with_selected_parser(markup)
|
||||
case parse_context.error_mode
|
||||
when :strict then strict_parse_with_error_context(markup)
|
||||
|
||||
@@ -30,7 +30,7 @@ module Liquid
|
||||
@parse_context = parse_context
|
||||
@line_number = parse_context.line_number
|
||||
|
||||
parse_with_selected_parser(markup)
|
||||
strict_parse_with_error_mode_fallback(markup)
|
||||
end
|
||||
|
||||
def raw
|
||||
|
||||
Reference in New Issue
Block a user