def layout(layout, filter_name, filter_args)
raise Nanoc::Errors::CannotLayoutBinaryItem.new(self) if self.binary?
if @content[:post].nil?
snapshot(:pre, :final => true)
end
klass = filter_named(filter_name)
raise Nanoc::Errors::UnknownFilter.new(filter_name) if klass.nil?
filter = klass.new(assigns.merge({ :layout => layout }))
Nanoc::NotificationCenter.post(:visit_started, layout)
Nanoc::NotificationCenter.post(:visit_ended, layout)
begin
Nanoc::NotificationCenter.post(:processing_started, layout)
Nanoc::NotificationCenter.post(:filtering_started, self, filter_name)
@content[:last] = filter.setup_and_run(layout.raw_content, filter_args)
snapshot(:post, :final => false)
ensure
Nanoc::NotificationCenter.post(:filtering_ended, self, filter_name)
Nanoc::NotificationCenter.post(:processing_ended, layout)
end
end