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

georg.brandl python-checkins at python.org
Sat May 24 18:24:49 CEST 2008


Author: georg.brandl
Date: Sat May 24 18:24:49 2008
New Revision: 63581

Log:
Another fix for cross-referencing behavior.


Modified:
   doctools/trunk/sphinx/roles.py

Modified: doctools/trunk/sphinx/roles.py
==============================================================================
--- doctools/trunk/sphinx/roles.py	(original)
+++ doctools/trunk/sphinx/roles.py	Sat May 24 18:24:49 2008
@@ -145,7 +145,16 @@
     if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth', 'mod'):
         # fix-up parentheses in link title
         if titleistarget:
-            title = _fix_parens(typ, title.lstrip('.~'), env)
+            title = title.lstrip('.')   # only has a meaning for the target
+            target = target.lstrip('~') # only has a meaning for the title
+            title = _fix_parens(typ, title, env)
+            # if the first character is a tilde, don't display the module/class
+            # parts of the contents
+            if title[0:1] == '~':
+                title = title[1:]
+                dot = title.rfind('.')
+                if dot != -1:
+                    title = title[dot+1:]
         # remove parentheses from the target too
         if target.endswith('()'):
             target = target[:-2]
@@ -154,13 +163,6 @@
         if target[0:1] == '.':
             target = target[1:]
             pnode['refspecific'] = True
-        # if the first character is a tilde, don't display the module/class parts
-        # of the contents
-        elif target[0:1] == '~':
-            target = target[1:]
-            dot = target.rfind('.')
-            if dot != -1:
-                title = target[dot+1:]
     # some other special cases for the target
     elif typ == 'option' and target[0] in '-/':
         # strip option marker from target


More information about the Python-checkins mailing list