Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Close #9993: std domain: Allow to refer an inline target via ref role" #10178

Merged
merged 1 commit into from Mar 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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')