Fix #7219: py:module directive generates incorrect index entry

This commit is contained in:
Takeshi KOMIYA
2020-03-29 19:36:41 +09:00
parent ce25d0080e
commit fe9473f42e
2 changed files with 3 additions and 3 deletions

View File

@@ -926,8 +926,8 @@ class PyModule(SphinxDirective):
# the platform and synopsis aren't printed; in fact, they are only
# used in the modindex currently
ret.append(target)
indextext = _('%s (module)') % modname
inode = addnodes.index(entries=[('single', indextext, node_id, '', None)])
indextext = '%s; %s' % (pairindextypes['module'], modname)
inode = addnodes.index(entries=[('pair', indextext, node_id, '', None)])
ret.append(inode)
return ret

View File

@@ -481,7 +481,7 @@ def test_pyfunction(app):
assert_node(doctree[0], addnodes.index,
entries=[('pair', 'built-in function; func1()', 'func1', '', None)])
assert_node(doctree[3], addnodes.index,
entries=[('single', 'example (module)', 'module-example', '', None)])
entries=[('pair', 'module; example', 'module-example', '', None)])
assert_node(doctree[4], addnodes.index,
entries=[('single', 'func2() (in module example)', 'example.func2', '', None)])