summaryrefslogtreecommitdiff
path: root/doc/_extensions/html_domain.py
diff options
context:
space:
mode:
authorMoisés López <moylop260@vauxoo.com>2017-07-14 12:34:01 -0500
committerXavier Morel <xmo@odoo.com>2017-08-10 16:18:29 +0200
commit0819d3f116848276ec6d35bcd5ede0fc60f41633 (patch)
tree8047e8f9a8e27cb61cabf61c7ae35f0613e3dc25 /doc/_extensions/html_domain.py
parentfdc8bc171108c6d97b9f73ad9dc5ebeea1860d56 (diff)
[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
Diffstat (limited to 'doc/_extensions/html_domain.py')
-rw-r--r--doc/_extensions/html_domain.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/_extensions/html_domain.py b/doc/_extensions/html_domain.py
index 4b0f18a9b82..75d3c6e1127 100644
--- a/doc/_extensions/html_domain.py
+++ b/doc/_extensions/html_domain.py
@@ -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),