summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2015-07-10 11:56:02 +0200
committerXavier Morel <xmo@odoo.com>2015-07-10 11:57:06 +0200
commit610f6fdafe8beecf90a50b40a271a444f66161f8 (patch)
treecd78f2e40d051e72baed20aea6f53a7043459103 /doc
parent0f4399bb7b9ed811ebb85f65b47c4a3161283412 (diff)
[IMP] doc: support for image centering
Also handle (and ignore) substitution definition nodes.
Diffstat (limited to 'doc')
-rw-r--r--doc/_extensions/odoo/translator.py16
1 files changed, 16 insertions, 0 deletions
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('</%s>' % t)
# Keep non-HTML raw text out of output:
raise nodes.SkipNode
+
+ # internal node
+ def visit_substitution_definition(self, node): raise nodes.SkipNode