def image(doc, src, name, height=nil, width=nil, attr=nil, alt=nil)
if width or height
@view_buffer << "<m:image #{attr}"
if height
@view_buffer << " height=\"" << height
@view_buffer << "ex" if not height =~ /%/
@view_buffer << "\""
end
if width
@view_buffer << " width=\"" << width
@view_buffer << "em" if not width =~ /%/
@view_buffer << "\""
end
else
@view_buffer << "<m:icon #{attr}"
end
if name
@view_buffer << " ref=\"instance('" << name << "')/" << src << "\">"
else
@view_buffer << '>' << src
end
if height or width
@view_buffer << '</m:image>'
else
@view_buffer << '</m:icon>'
end
end