mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 17:00:39 -07:00
Update context tags to act as a merge rather than a complete overwrite
This commit is contained in:
@@ -2,15 +2,25 @@
|
||||
|
||||
module Liquid
|
||||
class ParseContext
|
||||
attr_accessor :locale, :line_number, :trim_whitespace, :depth, :tags
|
||||
attr_reader :partial, :warnings, :error_mode
|
||||
attr_accessor :locale, :line_number, :trim_whitespace, :depth
|
||||
attr_reader :partial, :warnings, :error_mode, :tags
|
||||
|
||||
class Tags
|
||||
def initialize(tags)
|
||||
@tags = tags || {}
|
||||
end
|
||||
|
||||
def [](tag_name)
|
||||
@tags[tag_name] || Liquid::Template.tags[tag_name]
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options = {})
|
||||
@template_options = options ? options.dup : {}
|
||||
|
||||
@locale = @template_options[:locale] ||= I18n.new
|
||||
@warnings = []
|
||||
@tags = @template_options[:tags] || Liquid::Template.tags
|
||||
@tags = Tags.new(@template_options[:tags])
|
||||
|
||||
self.depth = 0
|
||||
self.partial = false
|
||||
|
||||
Reference in New Issue
Block a user