Commits

Georg Brandl committed f56871c

#490: Fix cross-references to objects of types added by the :func:`~.Sphinx.add_object_type` API function.

  • Participants
  • Parent commits 6bc18a7

Comments (0)

Files changed (3)

 Release 1.0.2 (Aug 05, 2010)
 ============================
 
+* #490: Fix cross-references to objects of types added by the
+  :func:`~.Sphinx.add_object_type` API function.
+
 * Allow breaking long signatures, continuing with backlash-escaped
   newlines.
 

File sphinx/domains/std.py

                 return make_refnode(builder, fromdocname, docname,
                                     labelid, contnode)
         else:
-            docname, labelid = self.data['objects'].get((typ, target), ('', ''))
+            objtypes = self.objtypes_for_role(typ) or []
+            for objtype in objtypes:
+                if (objtype, target) in self.data['objects']:
+                    docname, labelid = self.data['objects'][objtype, target]
+                    break
+            else:
+                docname, labelid = '', ''
             if not docname:
                 if typ == 'term':
                     env.warn(node.get('refdoc', fromdocname),

File tests/test_build_html.py

         (".//a[@href='#mod.Cls'][@class='reference internal']", ''),
         (".//dl[@class='userdesc']", ''),
         (".//dt[@id='userdesc-myobj']", ''),
-        (".//a[@href='#userdesc-myobj']", ''),
+        (".//a[@href='#userdesc-myobj'][@class='reference internal']", ''),
         # C references
         (".//span[@class='pre']", 'CFunction()'),
         (".//a[@href='#Sphinx_DoSomething']", ''),