Skip to content

Commit

Permalink
Revert "Close #9993: std domain: Allow to refer an inline target via …
Browse files Browse the repository at this point in the history
…ref role"

This reverts commit e3ee8b3. 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
  • Loading branch information
stephenfin committed Feb 8, 2022
1 parent 73f9806 commit 105c583
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
8 changes: 3 additions & 5 deletions sphinx/domains/std.py
Expand Up @@ -762,20 +762,18 @@ def process_doc(self, env: "BuildEnvironment", docname: str, document: nodes.doc
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'):
sectname = toctree.get('caption')
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)
Expand Down
9 changes: 0 additions & 9 deletions tests/test_domain_std.py
Expand Up @@ -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')

0 comments on commit 105c583

Please sign in to comment.