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:
authorStephen Finucane <stephen@that.guru>2022-02-08 18:59:09 +0300
committerStephen Finucane <stephen@that.guru>2022-02-08 19:00:01 +0300
commit105c583f0605d336c9fc981e49e7a4ed4ef25f30 (patch)
tree43ff62bcd628c33470ee997a34f9a93a8a38ab84
parent73f980641c28660aaa2412fced5b747128e65931 (diff)
Revert "Close #9993: std domain: Allow to refer an inline target via ref role"
This reverts commit e3ee8b378a37958f48d97d74a5c264f1f02e153e. This is a breaking change that should not have been introduced in a minor release (or arguably at all, given the impact). Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #10177
-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 e9f75325a..0a3e6a342 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -762,11 +762,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'):
@@ -774,8 +773,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 00e7361a3..d001a939d 100644
--- a/tests/test_domain_std.py
+++ b/tests/test_domain_std.py
@@ -453,12 +453,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')