def content_for(*args, &block)
if block_given?
if args.size != 1
raise ArgumentError, "expected 1 argument (the name " +
"of the capture) but got #{args.size} instead"
end
name = args[0]
content = capture(&block)
@site.captures_store[@item, name.to_sym] = content
else
if args.size != 2
raise ArgumentError, "expected 2 arguments (the item " +
"and the name of the capture) but got #{args.size} instead"
end
item = args[0]
name = args[1]
current_item = @site.compiler.dependency_tracker.top
if item != current_item
Nanoc::NotificationCenter.post(:visit_started, item)
Nanoc::NotificationCenter.post(:visit_ended, item)
if !@site.captures_store_compiled_items.include? item
@site.captures_store_compiled_items << item
item.forced_outdated = true
item.reps.each do |r|
raw_content = item.raw_content
r.content = { :raw => raw_content, :last => raw_content }
@site.compiler.send(:compile_rep, r)
end
end
end
@site.captures_store[item, name.to_sym]
end
end