Allow linking to tables just like figures with :ref:.

This commit is contained in:
Georg Brandl 2010-05-30 12:11:52 +02:00
parent eec1b7bf00
commit 0f7072f028
3 changed files with 11 additions and 0 deletions

View File

@ -50,6 +50,7 @@ Features added
``literalinclude`` directive.
- #284: All docinfo metadata is now put into the document metadata, not
just the author.
- The ``ref`` role can now also reference tables by caption.
* Configuration:

View File

@ -83,6 +83,9 @@ Cross-referencing arbitrary locations
a reference ``:ref:`my-figure``` would insert a reference to the figure
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
to, but you must give the link an explicit title, using this syntax:
``:ref:`Link title <label-name>```.

View File

@ -410,6 +410,13 @@ class StandardDomain(Domain):
break
else:
continue
elif node.tagname == 'table':
for n in node:
if n.tagname == 'title':
sectname = clean_astext(n)
break
else:
continue
else:
# anonymous-only labels
continue