[IMP] doc: support for image centering

Also handle (and ignore) substitution definition nodes.
This commit is contained in:
Xavier Morel 2015-07-10 11:56:02 +02:00
parent 0f4399bb7b
commit 610f6fdafe
1 changed files with 16 additions and 0 deletions

View File

@ -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