mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-17 01:40:42 -07:00
Update infrastructure that handles parsing switching:
* Remove development helpers from parse context * Simplify strict_parse_with_error_mode_fallback and update documentation * Add unit tests for `Liquid::Expression` and `Liquid::ParseContext` * Update test helpers to work better with the `:rigid` mode
This commit is contained in:
committed by
Guilherme Carreiro
parent
4cd367d971
commit
738540a601
@@ -55,10 +55,15 @@ module Liquid
|
||||
end
|
||||
|
||||
def parse_expression(markup, safe: false)
|
||||
# todo(guilherme): remove this once rigid mode is fully using safe_parse_expression
|
||||
if !safe && @error_mode == :rigid
|
||||
# raise Liquid::InternalError, "parse_expression is not supported in rigid mode"
|
||||
puts("🚨 parse_expression used in rigid mode")
|
||||
# parse_expression is a widely used API. To maintain backward
|
||||
# compatibility while raising awareness about rigid parser standards,
|
||||
# the safe flag supports API users make a deliberate decision.
|
||||
#
|
||||
# In rigid mode, markup MUST come from a string returned by the parser
|
||||
# (e.g., parser.expression). We're not calling the parser here to
|
||||
# prevent redundant parser overhead.
|
||||
raise Liquid::InternalError, "unsafe parse_expression cannot be used in rigid mode"
|
||||
end
|
||||
|
||||
Expression.parse(markup, @string_scanner, @expression_cache)
|
||||
|
||||
Reference in New Issue
Block a user