[FIX] 1.2 compatibility

app.add_node doesn't work right for custom translators in 1.2, since
mementos are using ``h:div`` reimplement that in the
BootstrapTranslator.

Alternative would be to monkeypatch app.add_node for Sphinx 1.2, but
let's not do that...
This commit is contained in:
Xavier Morel
2015-11-20 11:37:18 +01:00
parent fbea64a257
commit e2204cdd72
2 changed files with 16 additions and 1 deletions

View File

@@ -677,3 +677,15 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
# internal node
def visit_substitution_definition(self, node): raise nodes.SkipNode
# without set_translator, add_node doesn't work correctly, so the
# serialization of html_domain nodes needs to be embedded here
def visit_div(self, node):
self.body.append(self.starttag(node, 'div'))
def depart_div(self, node):
self.body.append(u'</div>\n')
def visit_address(self, node):
self.body.append(self.starttag(node, 'address'))
def depart_address(self, node):
self.body.append(u'</address>')
# TODO: inline elements