def image node
width_attribute = (node.attr? 'width') ? %( contentwidth="#{node.attr 'width'}") : nil
depth_attribute = (node.attr? 'height') ? %( contentdepth="#{node.attr 'height'}") : nil
swidth_attribute = (node.attr? 'scaledwidth') ? %( width="#{node.attr 'scaledwidth'}" scalefit="1") : nil
scale_attribute = (node.attr? 'scale') ? %( scale="#{node.attr 'scale'}") : nil
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}#{swidth_attribute}#{scale_attribute}#{align_attribute}/>
</imageobject>
<textobject><phrase>#{node.attr '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