From b6f35afe8eed2c00841a034f97923544fe595ce6 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 8 Nov 2019 13:45:51 +0100 Subject: [PATCH] [IMP] _extension: support for width attribute It was ignored in our custom rst translator --- _extensions/odoo/translator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_extensions/odoo/translator.py b/_extensions/odoo/translator.py index de7901c2f..769496f8a 100644 --- a/_extensions/odoo/translator.py +++ b/_extensions/odoo/translator.py @@ -377,7 +377,11 @@ class BootstrapTranslator(nodes.NodeVisitor, object): "Unsupported alignment value \"%s\"" % node['align'], location=doc ) - # todo: explicit width/height/scale? + attrs['style'] = '; '.join( + '%s:%s' % (name, node[name] + ('px' if re.match(r'^[0-9]+$', node[name]) else '')) + for name in ['width', 'height'] + if name in node + ) self.body.append(self.starttag(node, 'img', **attrs)) def depart_image(self, node): pass def visit_figure(self, node):