[Python-checkins] r61690 - doctools/trunk/sphinx/directives.py doctools/trunk/sphinx/roles.py

georg.brandl python-checkins at python.org
Fri Mar 21 15:00:34 CET 2008


Author: georg.brandl
Date: Fri Mar 21 15:00:34 2008
New Revision: 61690

Modified:
   doctools/trunk/sphinx/directives.py
   doctools/trunk/sphinx/roles.py
Log:
* Allow the ~ prefix on module xrefs.
* The parse function for custom descitems must return the full name for x-refing.


Modified: doctools/trunk/sphinx/directives.py
==============================================================================
--- doctools/trunk/sphinx/directives.py	(original)
+++ doctools/trunk/sphinx/directives.py	Fri Mar 21 15:00:34 2008
@@ -321,18 +321,20 @@
                 # another registered generic x-ref directive
                 rolename, indextext, parse_node = additional_xref_types[desctype]
                 if parse_node:
-                    parse_node(sig, signode)
+                    fullname = parse_node(sig, signode)
                 else:
                     signode.clear()
                     signode += addnodes.desc_name(sig, sig)
+                    fullname = sig
                 if not noindex:
-                    targetname = '%s-%s' % (rolename, sig)
+                    targetname = '%s-%s' % (rolename, fullname)
                     signode['ids'].append(targetname)
                     state.document.note_explicit_target(signode)
                     if indextext:
-                        env.note_index_entry('pair', '%s; %s' % (indextext, sig),
+                        env.note_index_entry('pair',
+                                             '%s; %s' % (indextext, fullname),
                                              targetname, targetname)
-                    env.note_reftarget(rolename, sig, targetname)
+                    env.note_reftarget(rolename, fullname, targetname)
                 # don't use object indexing below
                 continue
         except ValueError, err:

Modified: doctools/trunk/sphinx/roles.py
==============================================================================
--- doctools/trunk/sphinx/roles.py	(original)
+++ doctools/trunk/sphinx/roles.py	Fri Mar 21 15:00:34 2008
@@ -120,8 +120,9 @@
     # we want a cross-reference, create the reference node
     pnode = addnodes.pending_xref(rawtext, reftype=typ, refcaption=False,
                                   modname=env.currmodule, classname=env.currclass)
+    innertext = text
     # special actions for Python object cross-references
-    if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth'):
+    if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth', 'mod'):
         # if the first character is a dot, search more specific namespaces first
         # else search builtins first
         if text[0:1] == '.':
@@ -134,7 +135,6 @@
             dot = text.rfind('.')
             if dot != -1:
                 innertext = text[dot+1:]
-    innertext = text
     # look if explicit title and target are given
     brace = text.find('<')
     if brace != -1:


More information about the Python-checkins mailing list