def docinfo location = :head, suffix = nil
if safe >= SafeMode::SECURE
''
else
content = []
qualifier = %(-#{location}) unless location == :head
suffix = @outfilesuffix unless suffix
if (docinfo = @attributes['docinfo']).nil_or_empty?
if @attributes.key? 'docinfo2'
docinfo = ['private', 'shared']
elsif @attributes.key? 'docinfo1'
docinfo = ['shared']
else
docinfo = docinfo ? ['private'] : nil
end
else
docinfo = docinfo.split(',').map {|it| it.strip }
end
if docinfo
docinfo_file, docinfo_dir, docinfo_subs = %(docinfo#{qualifier}#{suffix}), @attributes['docinfodir'], resolve_docinfo_subs
unless (docinfo & ['shared', %(shared-#{location})]).empty?
docinfo_path = normalize_system_path docinfo_file, docinfo_dir
if (shd_content = (read_asset docinfo_path, :normalize => true))
content << (apply_subs shd_content, docinfo_subs)
end
end
unless @attributes['docname'].nil_or_empty? || (docinfo & ['private', %(private-#{location})]).empty?
docinfo_path = normalize_system_path %(#{@attributes['docname']}-#{docinfo_file}), docinfo_dir
if (pvt_content = (read_asset docinfo_path, :normalize => true))
content << (apply_subs pvt_content, docinfo_subs)
end
end
end
if @extensions && (docinfo_processors? location)
content += @docinfo_processor_extensions[location].map {|ext| ext.process_method[self] }.compact
end
content * LF
end
end