Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-03-27 17:10:52 +0300
committerGitHub <noreply@github.com>2022-03-27 17:10:52 +0300
commit4a496bfc98feced56e9e84eb6cf96264982d0e7a (patch)
tree1dbd510227622764526cdb6e000db4815781f2f7
parentc93b95d685aea6c8e4392d624e4668587b9e5726 (diff)
parent105c583f0605d336c9fc981e49e7a4ed4ef25f30 (diff)
Merge pull request #10178 from stephenfin/issue-10177
Revert "Close #9993: std domain: Allow to refer an inline target via ref role"
-rw-r--r--sphinx/domains/std.py8
-rw-r--r--tests/test_domain_std.py9
2 files changed, 3 insertions, 14 deletions
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
index 11a3260b7..a04c0b526 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -754,11 +754,10 @@ class StandardDomain(Domain):
sectname = clean_astext(title)
elif node.tagname == 'rubric':
sectname = clean_astext(node)
- elif node.tagname == 'target' and len(node) > 0:
- # inline target (ex: blah _`blah` blah)
- sectname = clean_astext(node)
elif self.is_enumerable_node(node):
sectname = self.get_numfig_title(node)
+ if not sectname:
+ continue
else:
toctree = next(node.findall(addnodes.toctree), None)
if toctree and toctree.get('caption'):
@@ -766,8 +765,7 @@ class StandardDomain(Domain):
else:
# anonymous-only labels
continue
- if sectname:
- self.labels[name] = docname, labelid, sectname
+ self.labels[name] = docname, labelid, sectname
def add_program_option(self, program: str, name: str, docname: str, labelid: str) -> None:
self.progoptions[program, name] = (docname, labelid)
diff --git a/tests/test_domain_std.py b/tests/test_domain_std.py
index e92030517..3577b549e 100644
--- a/tests/test_domain_std.py
+++ b/tests/test_domain_std.py
@@ -445,12 +445,3 @@ def test_labeled_rubric(app):
domain = app.env.get_domain("std")
assert 'label' in domain.labels
assert domain.labels['label'] == ('index', 'label', 'blah blah blah')
-
-
-def test_inline_target(app):
- text = "blah _`inline target` blah\n"
- restructuredtext.parse(app, text)
-
- domain = app.env.get_domain("std")
- assert 'inline target' in domain.labels
- assert domain.labels['inline target'] == ('index', 'inline-target', 'inline target')