Skip to content

Commit 4a496bf

Browse files
authored
Merge pull request #10178 from stephenfin/issue-10177
Revert "Close #9993: std domain: Allow to refer an inline target via ref role"
2 parents c93b95d + 105c583 commit 4a496bf

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

sphinx/domains/std.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,20 +754,18 @@ def process_doc(self, env: "BuildEnvironment", docname: str, document: nodes.doc
754754
sectname = clean_astext(title)
755755
elif node.tagname == 'rubric':
756756
sectname = clean_astext(node)
757-
elif node.tagname == 'target' and len(node) > 0:
758-
# inline target (ex: blah _`blah` blah)
759-
sectname = clean_astext(node)
760757
elif self.is_enumerable_node(node):
761758
sectname = self.get_numfig_title(node)
759+
if not sectname:
760+
continue
762761
else:
763762
toctree = next(node.findall(addnodes.toctree), None)
764763
if toctree and toctree.get('caption'):
765764
sectname = toctree.get('caption')
766765
else:
767766
# anonymous-only labels
768767
continue
769-
if sectname:
770-
self.labels[name] = docname, labelid, sectname
768+
self.labels[name] = docname, labelid, sectname
771769

772770
def add_program_option(self, program: str, name: str, docname: str, labelid: str) -> None:
773771
self.progoptions[program, name] = (docname, labelid)

tests/test_domain_std.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,3 @@ def test_labeled_rubric(app):
445445
domain = app.env.get_domain("std")
446446
assert 'label' in domain.labels
447447
assert domain.labels['label'] == ('index', 'label', 'blah blah blah')
448-
449-
450-
def test_inline_target(app):
451-
text = "blah _`inline target` blah\n"
452-
restructuredtext.parse(app, text)
453-
454-
domain = app.env.get_domain("std")
455-
assert 'inline target' in domain.labels
456-
assert domain.labels['inline target'] == ('index', 'inline-target', 'inline target')

0 commit comments

Comments
 (0)