From f857b6398630f2588e68b0b7b520feaf8b784a31 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 16 Jul 2016 19:34:39 +0900 Subject: [PATCH] Fix warning with Sphinx 1.4 --- doc/_exts/sphinxcontrib/rubydomain.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/_exts/sphinxcontrib/rubydomain.py b/doc/_exts/sphinxcontrib/rubydomain.py index bba02f5d..79dbf655 100644 --- a/doc/_exts/sphinxcontrib/rubydomain.py +++ b/doc/_exts/sphinxcontrib/rubydomain.py @@ -15,6 +15,7 @@ from docutils import nodes from docutils.parsers.rst import directives from sphinx import addnodes +from sphinx import version_info from sphinx.roles import XRefRole from sphinx.locale import l_, _ from sphinx.domains import Domain, ObjType, Index @@ -231,8 +232,8 @@ class RubyObject(ObjectDescription): indextext = self.get_index_text(modname, name_cls) if indextext: - self.indexnode['entries'].append(('single', indextext, - fullname, fullname)) + self.indexnode['entries'].append( + _make_index('single', indextext, fullname, fullname)) def before_content(self): # needed for automatic qualification of members (reset in subclasses) @@ -415,11 +416,19 @@ class RubyModule(Directive): # modindex currently if not noindex: indextext = _('%s (module)') % modname - inode = addnodes.index(entries=[('single', indextext, - 'module-' + modname, modname)]) + inode = addnodes.index(entries=[_make_index( + 'single', indextext, 'module-' + modname, modname)]) ret.append(inode) return ret +def _make_index(entrytype, entryname, target, ignored, key=None): + # Sphinx 1.4 introduced backward incompatible changes, it now + # requires 5 tuples. Last one is categorization key. See + # http://www.sphinx-doc.org/en/stable/extdev/nodes.html#sphinx.addnodes.index + if version_info >= (1, 4, 0, '', 0): + return (entrytype, entryname, target, ignored, key) + else: + return (entrytype, entryname, target, ignored) class RubyCurrentModule(Directive): """