From 3812b3e5d7c0b9dcd71ec4641481b757ba538a0f Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Fri, 14 Mar 2025 10:01:37 -0600 Subject: [PATCH] Experiment: Hardcode parser to :strict everywhere --- lib/liquid/environment.rb | 14 +++++++++----- lib/liquid/template.rb | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/liquid/environment.rb b/lib/liquid/environment.rb index 31b17b234..d94711c81 100644 --- a/lib/liquid/environment.rb +++ b/lib/liquid/environment.rb @@ -4,10 +4,6 @@ module Liquid # The Environment is the container for all configuration options of Liquid, such as # the registered tags, filters, and the default error mode. 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. attr_accessor :tags @@ -75,7 +71,7 @@ def dangerously_override(environment) # @api private def initialize @tags = Tags::STANDARD_TAGS.dup - @error_mode = :lax + @error_mode = :strict @strainer_template = Class.new(StrainerTemplate).tap do |klass| klass.add_filter(StandardFilters) end @@ -85,6 +81,14 @@ def initialize @strainer_template_class_cache = {} end + def error_mode + :strict + end + + def error_mode=(mode) + :strict + end + # Registers a new tag with the environment. # # @param name [String] The name of the tag. diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb index 9fb4089a4..e5c604c5a 100644 --- a/lib/liquid/template.rb +++ b/lib/liquid/template.rb @@ -27,11 +27,11 @@ class << self # :strict will enforce correct syntax. def error_mode=(mode) Deprecations.warn("Template.error_mode=", "Environment#error_mode=") - Environment.default.error_mode = mode + Environment.default.error_mode = :strict end def error_mode - Environment.default.error_mode + :strict end def default_exception_renderer=(renderer)