Support `:no-index-entry: in .. {js,py}:module::` (#13272)

This commit is contained in:
Adam Turner
2025-01-28 01:33:28 +00:00
committed by GitHub
parent 60f88cc16e
commit 7801540c08
8 changed files with 59 additions and 21 deletions

View File

@@ -326,6 +326,25 @@ def test_no_index_entry(app):
)
assert_node(doctree[2], addnodes.index, entries=[])
text = '.. js:class:: f\n.. js:class:: g\n :no-index-entry:\n'
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index, desc, addnodes.index, desc))
assert_node(
doctree[0],
addnodes.index,
entries=[('single', 'f() (class)', 'f', '', None)],
)
assert_node(doctree[2], addnodes.index, entries=[])
text = '.. js:module:: f\n.. js:module:: g\n :no-index-entry:\n'
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index, nodes.target, nodes.target))
assert_node(
doctree[0],
addnodes.index,
entries=[('single', 'f (module)', 'module-f', '', None)],
)
@pytest.mark.sphinx('html', testroot='root')
def test_module_content_line_number(app):

View File

@@ -836,6 +836,15 @@ def test_no_index_entry(app):
)
assert_node(doctree[2], addnodes.index, entries=[])
text = '.. py:module:: f\n.. py:module:: g\n :no-index-entry:\n'
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index, nodes.target, nodes.target))
assert_node(
doctree[0],
addnodes.index,
entries=[('pair', 'module; f', 'module-f', '', None)],
)
@pytest.mark.sphinx('html', testroot='domain-py-python_use_unqualified_type_names')
def test_python_python_use_unqualified_type_names(app):