def inline_quoted node
open, close, is_tag = QUOTE_TAGS[node.type]
if (role = node.role)
if is_tag
quoted_text = %(#{open.chop} class="#{role}">#{node.text}#{close})
else
quoted_text = %(<span class="#{role}">#{open}#{node.text}#{close}</span>)
end
else
quoted_text = %(#{open}#{node.text}#{close})
end
node.id ? %(<a id="#{node.id}"></a>#{quoted_text}) : quoted_text
end
def append_boolean_attribute name, xml
xml ? %( #{name}="#{name}") : %( #{name})
end
def read_svg_contents node, target
if (svg = node.read_contents target, :start => (node.document.attr 'imagesdir'), :normalize => true, :label => 'SVG')
svg = svg.sub SvgPreambleRx, ''
start_tag = nil
['width', 'height'].each do |dim|
if node.attr? dim
# NOTE width, height and style attributes are removed if either width or height is specified
start_tag ||= (svg.match SvgStartTagRx)[0].gsub DimensionAttributeRx, ''
start_tag = %(#{start_tag.chop} #{dim}="#{node.attr dim}px">)
end
end
svg = svg.sub SvgStartTagRx, start_tag if start_tag
end
svg
end
end
end