def image node
if node.attr? 'scaledwidth'
width_attribute = %( width="#{node.attr 'scaledwidth'}")
depth_attribute = nil
scale_attribute = nil
elsif node.attr? 'scale'
scale_attribute = %( scale="#{node.attr 'scale'}")
else
width_attribute = (node.attr? 'width') ? %( contentwidth="#{node.attr 'width'}") : nil
depth_attribute = (node.attr? 'height') ? %( contentdepth="#{node.attr 'height'}") : nil
scale_attribute = nil
end
align_attribute = (node.attr? 'align') ? %( align="#{node.attr 'align'}") : nil
mediaobject = %(<mediaobject>
<imageobject>
<imagedata fileref="#{node.image_uri(node.attr 'target')}"#{width_attribute}#{depth_attribute}#{scale_attribute}#{align_attribute}/>
</imageobject>
<textobject><phrase>#{node.alt}</phrase></textobject>
</mediaobject>)
if node.title?
%(<figure#{common_attributes node.id, node.role, node.reftext}>
<title>#{node.title}</title>
#{mediaobject}
</figure>)
else
%(<informalfigure#{common_attributes node.id, node.role, node.reftext}>
#{mediaobject}
</informalfigure>)
end
end