[FIX] doc: Sphinx 1.2 support in html_domain
9a07a459 added "override=True" to silence a Sphinx warning in about
the address node already existing, however the override=True parameter
was added in Sphinx 1.4 (alongside the warning), so this breaks in
1.2.
Only pass in override=True if we're in 1.4 or later.
Closes #18232
This commit is contained in:
committed by
Xavier Morel
parent
fdc8bc1711
commit
0819d3f116
@@ -13,6 +13,7 @@ from docutils import nodes, utils
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
from docutils.parsers.rst.directives.body import LineBlock
|
||||
|
||||
import sphinx
|
||||
import sphinx.roles
|
||||
from sphinx.domains import Domain
|
||||
|
||||
@@ -21,10 +22,12 @@ def setup(app):
|
||||
app.add_node(div, html=(
|
||||
lambda self, node: self.body.append(self.starttag(node, 'div')),
|
||||
lambda self, node: self.body.append('</div>\n')))
|
||||
# override parameter was added for version sphinx >= 1.4, TypeError before
|
||||
kw = {'override': True} if sphinx.version_info >= (1, 4) else {}
|
||||
app.add_node(address, html=(
|
||||
lambda self, node: self.body.append(self.starttag(node, 'address')),
|
||||
lambda self, node: self.body.append('</address>\n')
|
||||
), override=True) # docutils.nodes.address exists and is a bibliographic element
|
||||
), **kw) # docutils.nodes.address exists and is a bibliographic element
|
||||
app.add_node(cite, html=(visit_cite, depart_cite))
|
||||
for name, node in [('mark', mark), ('ins', insert), ('del', delete),
|
||||
('s', strikethrough), ('u', underline), ('small', small),
|
||||
|
||||
Reference in New Issue
Block a user