diff --git a/lib/dita-topic.rb b/lib/dita-topic.rb index b7910b5..0f70751 100644 --- a/lib/dita-topic.rb +++ b/lib/dita-topic.rb @@ -164,21 +164,31 @@ def convert_floating_title node end # FIXME: Add support for additional attributes. - def convert_image node - # Check if the image has a title specified: + def convert_image(node) + # Check if scale, height, and width exist + scale = node.attr('scale') || 100 + height = node.attr('height') + width = node.attr('width') + + # Construct the attributes string based on if scale, height, and width exist + attributes = "scale=\"#{scale}\"" + attributes += " height=\"#{height}\"" if height + attributes += " width=\"#{width}\"" if width + + # Check if the image has a title specified if node.title? <<~EOF.chomp - #{node.title} - - #{node.alt} - + #{node.title} + + #{node.alt} + EOF else <<~EOF.chomp - - #{node.alt} + + #{node.alt} EOF end