diff options
| author | Georg Brandl <georg@python.org> | 2010-05-30 12:11:52 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-05-30 12:11:52 +0200 |
| commit | d653dacea8d7a933a02dbf08ad1708255ad14630 (patch) | |
| tree | 499503f34149677d2e3b2b5b2696e1b4065adc9f | |
| parent | f713c87d438f3adb668c7190d1c29fe66282277f (diff) | |
| download | sphinx-d653dacea8d7a933a02dbf08ad1708255ad14630.tar.gz | |
Allow linking to tables just like figures with :ref:.
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | doc/markup/inline.rst | 3 | ||||
| -rw-r--r-- | sphinx/domains/std.py | 7 |
3 files changed, 11 insertions, 0 deletions
@@ -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: diff --git a/doc/markup/inline.rst b/doc/markup/inline.rst index 4d4ebe24..bb1ed68e 100644 --- a/doc/markup/inline.rst +++ b/doc/markup/inline.rst @@ -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>```. diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 68bff15e..63a3bf6d 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -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 |
