Merge pull request #10178 from stephenfin/issue-10177

Revert "Close #9993: std domain: Allow to refer an inline target via ref role"
This commit is contained in:
Takeshi KOMIYA 2022-03-27 23:10:52 +09:00 committed by GitHub
commit 4a496bfc98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 14 deletions

View File

@ -754,11 +754,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'):
@ -766,8 +765,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)

View File

@ -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')