def inline_image node
if (type = node.type) == 'icon' && (node.document.attr? 'icons', 'font')
class_attr_val = %(fa fa-#{node.target})
{'size' => 'fa-', 'rotate' => 'fa-rotate-', 'flip' => 'fa-flip-'}.each do |(key, prefix)|
class_attr_val = %(#{class_attr_val} #{prefix}#{node.attr key}) if node.attr? key
end
title_attr = (node.attr? 'title') ? %( title="#{node.attr 'title'}") : nil
img = %(<i class="#{class_attr_val}"#{title_attr}></i>)
elsif type == 'icon' && !(node.document.attr? 'icons')
img = %([#{node.attr 'alt'}])
else
target = node.target
attrs = ['width', 'height', 'title'].map {|name| (node.attr? name) ? %( #{name}="#{node.attr name}") : nil }.join
if type != 'icon' && ((node.attr? 'format', 'svg', false) || (target.include? '.svg')) &&
node.document.safe < SafeMode::SECURE && ((svg = (node.option? 'inline')) || (obj = (node.option? 'interactive')))
if svg
img = (read_svg_contents node, target) || %(<span class="alt">#{node.attr 'alt'}</span>)
elsif obj
fallback = (node.attr? 'fallback') ? %(<img src="#{node.image_uri(node.attr 'fallback')}" alt="#{node.attr 'alt'}"#{attrs}#{@void_element_slash}>) : %(<span class="alt">#{node.attr 'alt'}</span>)
img = %(<object type="image/svg+xml" data="#{node.image_uri target}"#{attrs}>#{fallback}</object>)
end
end
img ||= %(<img src="#{type == 'icon' ? (node.icon_uri target) : (node.image_uri target)}" alt="#{node.attr 'alt'}"#{attrs}#{@void_element_slash}>)
end
if node.attr? 'link'
window_attr = (node.attr? 'window') ? %( target="#{node.attr 'window'}") : nil
img = %(<a class="image" href="#{node.attr 'link'}"#{window_attr}>#{img}</a>)
end
class_attr_val = (role = node.role) ? %(#{type} #{role}) : type
style_attr = (node.attr? 'float') ? %( style="float: #{node.attr 'float'}") : nil
%(<span class="#{class_attr_val}"#{style_attr}>#{img}</span>)
end