mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 18:30:40 -07:00
Add strict_variables/strict_filters render options to check for undefined variables and filters
This commit is contained in:
@@ -181,12 +181,7 @@ module Liquid
|
||||
|
||||
registers.merge!(options[:registers]) if options[:registers].is_a?(Hash)
|
||||
|
||||
context.add_filters(options[:filters]) if options[:filters]
|
||||
|
||||
context.global_filter = options[:global_filter] if options[:global_filter]
|
||||
|
||||
context.exception_handler = options[:exception_handler] if options[:exception_handler]
|
||||
|
||||
apply_options_to_context(context, options)
|
||||
when Module, Array
|
||||
context.add_filters(args.pop)
|
||||
end
|
||||
@@ -235,5 +230,13 @@ module Liquid
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def apply_options_to_context(context, options)
|
||||
context.add_filters(options[:filters]) if options[:filters]
|
||||
context.global_filter = options[:global_filter] if options[:global_filter]
|
||||
context.exception_handler = options[:exception_handler] if options[:exception_handler]
|
||||
context.strict_variables = options[:strict_variables] if options[:strict_variables]
|
||||
context.strict_filters = options[:strict_filters] if options[:strict_filters]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user