Hi There, I'm trying to use the 'missing-reference' event to solve the following problem: We (the sage development team) have a huge python library with more that 1500 modules. We decided to give an easy access to the user to many of the symbols defined is those modules by importing them in a module named sage.all. For example, there is a function sage.combinat.partition.Partition which is also imported as sage.all.Partition. Note that the documentation of this function is documented only in sage/combinat/partition.html and there is no sage.all.html. I'd like to be able to link Partition from anywhere by just writing :func:`Partition` instead of :func:`sage.combinat.partition.Partition` so I wrote a callback find_sage_dangling_links which try to find the unresolved reference in sage.all and, if found, link to the actual place. My problem is that the generated url is wrong:
Instead of file:///[...]/sage/combinat/partition.html#sage.combinat.partition.Partitions I get file:///[...]/sage/combinat/sage/combinat/partition.html#sage.combinat.partition.Partitions I can't figure out what I am doing wrong. Here is the code: def find_sage_dangling_links(app, env, node, contnode): typ = node['reftype'] target = node['reftarget'] domain = node['refdomain'] if domain == 'py': # python file module = node['py:module'] cls = node['py:class'] basename = target.split(".")[0] try: # to find the module where the node is defined fromdocname = getattr(sys.modules['sage.all'], basename).__module__ except AttributeError: return None newtarget = fromdocname+'.'+target node['reftarget'] = newtarget return app.builder.env.domains['py'].resolve_xref( app.builder.env, fromdocname, app.builder, typ, newtarget, contnode, contnode) I'm probably doing something wrong in that last final call to resolve_xref. Any help is greatly welcome. Cheers, Florent -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.