mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Allow linking to tables just like figures with :ref:.
This commit is contained in:
parent
eec1b7bf00
commit
0f7072f028
1
CHANGES
1
CHANGES
@ -50,6 +50,7 @@ Features added
|
|||||||
``literalinclude`` directive.
|
``literalinclude`` directive.
|
||||||
- #284: All docinfo metadata is now put into the document metadata, not
|
- #284: All docinfo metadata is now put into the document metadata, not
|
||||||
just the author.
|
just the author.
|
||||||
|
- The ``ref`` role can now also reference tables by caption.
|
||||||
|
|
||||||
* Configuration:
|
* Configuration:
|
||||||
|
|
||||||
|
@ -83,6 +83,9 @@ Cross-referencing arbitrary locations
|
|||||||
a reference ``:ref:`my-figure``` would insert a reference to the figure
|
a reference ``:ref:`my-figure``` would insert a reference to the figure
|
||||||
with link text "Figure caption".
|
with link text "Figure caption".
|
||||||
|
|
||||||
|
The same works for tables that are given an explicit caption using the
|
||||||
|
:dudir:`table` directive.
|
||||||
|
|
||||||
* Labels that aren't placed before a section title can still be referenced
|
* Labels that aren't placed before a section title can still be referenced
|
||||||
to, but you must give the link an explicit title, using this syntax:
|
to, but you must give the link an explicit title, using this syntax:
|
||||||
``:ref:`Link title <label-name>```.
|
``:ref:`Link title <label-name>```.
|
||||||
|
@ -410,6 +410,13 @@ class StandardDomain(Domain):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
elif node.tagname == 'table':
|
||||||
|
for n in node:
|
||||||
|
if n.tagname == 'title':
|
||||||
|
sectname = clean_astext(n)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
# anonymous-only labels
|
# anonymous-only labels
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user