Experiment: Hardcode parser to :strict everywhere

This commit is contained in:
Albert Chu
2025-03-14 10:01:37 -06:00
parent c5711c095f
commit 3812b3e5d7
2 changed files with 11 additions and 7 deletions
+9 -5
View File
@@ -4,10 +4,6 @@ module Liquid
# The Environment is the container for all configuration options of Liquid, such as # The Environment is the container for all configuration options of Liquid, such as
# the registered tags, filters, and the default error mode. # the registered tags, filters, and the default error mode.
class Environment class Environment
# The default error mode for all templates. This can be overridden on a
# per-template basis.
attr_accessor :error_mode
# The tags that are available to use in the template. # The tags that are available to use in the template.
attr_accessor :tags attr_accessor :tags
@@ -75,7 +71,7 @@ module Liquid
# @api private # @api private
def initialize def initialize
@tags = Tags::STANDARD_TAGS.dup @tags = Tags::STANDARD_TAGS.dup
@error_mode = :lax @error_mode = :strict
@strainer_template = Class.new(StrainerTemplate).tap do |klass| @strainer_template = Class.new(StrainerTemplate).tap do |klass|
klass.add_filter(StandardFilters) klass.add_filter(StandardFilters)
end end
@@ -85,6 +81,14 @@ module Liquid
@strainer_template_class_cache = {} @strainer_template_class_cache = {}
end end
def error_mode
:strict
end
def error_mode=(mode)
:strict
end
# Registers a new tag with the environment. # Registers a new tag with the environment.
# #
# @param name [String] The name of the tag. # @param name [String] The name of the tag.
+2 -2
View File
@@ -27,11 +27,11 @@ module Liquid
# :strict will enforce correct syntax. # :strict will enforce correct syntax.
def error_mode=(mode) def error_mode=(mode)
Deprecations.warn("Template.error_mode=", "Environment#error_mode=") Deprecations.warn("Template.error_mode=", "Environment#error_mode=")
Environment.default.error_mode = mode Environment.default.error_mode = :strict
end end
def error_mode def error_mode
Environment.default.error_mode :strict
end end
def default_exception_renderer=(renderer) def default_exception_renderer=(renderer)