Skip to content

Commit

Permalink
Merge pull request #10178 from stephenfin/issue-10177
Browse files Browse the repository at this point in the history
Revert "Close #9993: std domain: Allow to refer an inline target via ref role"
  • Loading branch information
tk0miya authored Mar 27, 2022
2 parents c93b95d + 105c583 commit 4a496bf
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
Original file line number Diff line number Diff line change
Expand Up @@ -754,20 +754,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
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 4a496bf

Please sign in to comment.