mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8679 from tk0miya/8651_xref_for_rubric
Fix #8651: cross-reference for a rubric having inline item is broken
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -28,6 +28,7 @@ Features added
|
||||
* #8649: imgconverter: Skip availability check if builder supports the image
|
||||
type
|
||||
* #6241: mathjax: Include mathjax.js only on the document using equations
|
||||
* #8651: std domain: cross-reference for a rubric having inline item is broken
|
||||
* #8132: Add :confval:`project_copyright` as an alias of :confval:`copyright`
|
||||
* #207: Now :confval:`highlight_language` supports multiple languages
|
||||
|
||||
|
||||
@@ -745,9 +745,11 @@ class StandardDomain(Domain):
|
||||
name, env.doc2path(self.labels[name][0]),
|
||||
location=node)
|
||||
self.anonlabels[name] = docname, labelid
|
||||
if node.tagname in ('section', 'rubric'):
|
||||
if node.tagname == 'section':
|
||||
title = cast(nodes.title, node[0])
|
||||
sectname = clean_astext(title)
|
||||
elif node.tagname == 'rubric':
|
||||
sectname = clean_astext(node)
|
||||
elif self.is_enumerable_node(node):
|
||||
sectname = self.get_numfig_title(node)
|
||||
if not sectname:
|
||||
|
||||
@@ -412,3 +412,13 @@ def test_disabled_docref(app):
|
||||
assert_node(doctree, ([nodes.paragraph, ([pending_xref, nodes.inline, "index"],
|
||||
"\n",
|
||||
[nodes.inline, "index"])],))
|
||||
|
||||
|
||||
def test_labeled_rubric(app):
|
||||
text = (".. _label:\n"
|
||||
".. rubric:: blah *blah* blah\n")
|
||||
restructuredtext.parse(app, text)
|
||||
|
||||
domain = app.env.get_domain("std")
|
||||
assert 'label' in domain.labels
|
||||
assert domain.labels['label'] == ('index', 'label', 'blah blah blah')
|
||||
|
||||
Reference in New Issue
Block a user