From 52589b01ea1d524f10d4492e4c666bbe7a933788 Mon Sep 17 00:00:00 2001 From: Ajit Kenjale Date: Wed, 12 Jun 2024 12:33:57 +0530 Subject: [PATCH] Added support for additional attributes. --- lib/dita-topic.rb | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/dita-topic.rb b/lib/dita-topic.rb index cd60bc5..ac54b1c 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