Jacob Kaplan-Moss schrieb:
> On Mon, Feb 23, 2009 at 7:37 PM, Roger Binns <[email protected]> wrote:
>> A nice simplification is if we could write `foo.bar.bam` without the
>> leading :meth:, :attr: etc.
> 
> I think that'd be brilliant. I'd love to see Sphinx just make a "best
> guess"; if it's wrong the author could always clarify by using an
> explicit reference in the current style.

Not having to give the object type is possible right now, by using

default_role = 'obj'

in conf.py -- `django.forms.Form.errors` then works.

>> As for the item being referenced (eg
>> django.contrib.comments.models.Comment.save), only enough of it to be
>> unambiguous is needed.
> 
> Again, you read my mind -- this is exactly what I want.
> 
> So: if I hack up a patch, is there a chance it'll get merged back upstream?

Could you try the following?

diff -r 3435776fbd6f sphinx/environment.py


--- a/sphinx/environment.py     Mon Feb 23 19:24:22 2009 +0100


+++ b/sphinx/environment.py     Tue Feb 24 13:16:05 2009 +0100


@@ -1563,6 +1559,13 @@ class BuildEnvironment:
                 newname = modname + '.' + name
             elif name in self.descrefs:
                 newname = name
+            else:
+                # find suffixes: .forms.Form matches django.forms.Form
+                dotname = '.'+name
+                for existing in self.descrefs:
+                    if existing.endswith(dotname):
+                        newname = existing
+                        break
         else:
             if name in self.descrefs:
                 newname = name


With it, references of the form `.Form.errors` should match anywhere
(but the risk of multiple matches is yours).

cheers,
Georg

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to