From 610f6fdafe8beecf90a50b40a271a444f66161f8 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 10 Jul 2015 11:56:02 +0200 Subject: [PATCH] [IMP] doc: support for image centering Also handle (and ignore) substitution definition nodes. --- doc/_extensions/odoo/translator.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/_extensions/odoo/translator.py b/doc/_extensions/odoo/translator.py index 9e0762ed208..1fd73493098 100644 --- a/doc/_extensions/odoo/translator.py +++ b/doc/_extensions/odoo/translator.py @@ -356,6 +356,19 @@ class BootstrapTranslator(nodes.NodeVisitor, object): attrs = {'src': uri, 'class': 'img-responsive'} if 'alt' in node: attrs['alt'] = node['alt'] + if 'align' in node: + if node['align'] == 'center': + attrs['class'] += ' center-block' + else: + doc = None + if node.source: + doc = node.source + if node.line: + doc += ':%d' % node.line + self.builder.app.warn( + "Unsupported alignment value \"%s\"" % node['align'], + location=doc + ) # todo: explicit width/height/scale? self.body.append(self.starttag(node, 'img', **attrs)) def depart_image(self, node): pass @@ -661,3 +674,6 @@ class BootstrapTranslator(nodes.NodeVisitor, object): self.body.append('' % t) # Keep non-HTML raw text out of output: raise nodes.SkipNode + + # internal node + def visit_substitution_definition(self, node): raise nodes.SkipNode