Fix warning with Sphinx 1.4
This commit is contained in:
parent
cbd72da9a1
commit
f857b63986
|
@ -15,6 +15,7 @@ from docutils import nodes
|
||||||
from docutils.parsers.rst import directives
|
from docutils.parsers.rst import directives
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
|
from sphinx import version_info
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.locale import l_, _
|
from sphinx.locale import l_, _
|
||||||
from sphinx.domains import Domain, ObjType, Index
|
from sphinx.domains import Domain, ObjType, Index
|
||||||
|
@ -231,8 +232,8 @@ class RubyObject(ObjectDescription):
|
||||||
|
|
||||||
indextext = self.get_index_text(modname, name_cls)
|
indextext = self.get_index_text(modname, name_cls)
|
||||||
if indextext:
|
if indextext:
|
||||||
self.indexnode['entries'].append(('single', indextext,
|
self.indexnode['entries'].append(
|
||||||
fullname, fullname))
|
_make_index('single', indextext, fullname, fullname))
|
||||||
|
|
||||||
def before_content(self):
|
def before_content(self):
|
||||||
# needed for automatic qualification of members (reset in subclasses)
|
# needed for automatic qualification of members (reset in subclasses)
|
||||||
|
@ -415,11 +416,19 @@ class RubyModule(Directive):
|
||||||
# modindex currently
|
# modindex currently
|
||||||
if not noindex:
|
if not noindex:
|
||||||
indextext = _('%s (module)') % modname
|
indextext = _('%s (module)') % modname
|
||||||
inode = addnodes.index(entries=[('single', indextext,
|
inode = addnodes.index(entries=[_make_index(
|
||||||
'module-' + modname, modname)])
|
'single', indextext, 'module-' + modname, modname)])
|
||||||
ret.append(inode)
|
ret.append(inode)
|
||||||
return ret
|
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):
|
class RubyCurrentModule(Directive):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue