def cover_tag doc, face, use_placeholder = false
if (cover_image = doc.attr %(#{face}-cover-image))
width_attr = nil
depth_attr = nil
if (cover_image.include? ':') && ImageMacroRx =~ cover_image
cover_image = doc.image_uri $1
unless $2.empty?
attrs = (AttributeList.new $2).parse ['alt', 'width', 'height']
if attrs.key? 'scaledwidth'
width_attr = %( width="#{attrs['scaledwidth']}")
else
width_attr = %( contentwidth="#{attrs['width']}") if attrs.key? 'width'
depth_attr = %( contentdepth="#{attrs['height']}") if attrs.key? 'height'
end
end
end
%(<cover role="#{face}">
<mediaobject>
<imageobject>
<imagedata fileref="#{cover_image}"#{width_attr}#{depth_attr}/>
</imageobject>
</mediaobject>
</cover>)
elsif use_placeholder
%(<cover role="#{face}"/>)
end
end