Georg Brandl avatar Georg Brandl committed 9e35e7e

Fix #616: Allow keywords to be linked via intersphinx.

Comments (0)

Files changed (3)

 Release 1.0.8 (Sep 22, 2011)
 ============================
 
+* #616: Allow keywords to be linked via intersphinx.
+
 * #613: Allow Unicode characters in production list token names.
 
 * #720: Add dummy visitors for graphviz nodes for text and man.

sphinx/domains/std.py

     object_types = {
         'term': ObjType(l_('glossary term'), 'term', searchprio=-1),
         'token': ObjType(l_('grammar token'), 'token', searchprio=-1),
-        'label': ObjType(l_('reference label'), 'ref', searchprio=-1),
+        'label': ObjType(l_('reference label'), 'ref', 'keyword',
+                         searchprio=-1),
         'envvar': ObjType(l_('environment variable'), 'envvar'),
         'cmdoption': ObjType(l_('program option'), 'option'),
     }

sphinx/ext/intersphinx.py

 
 from docutils import nodes
 
+from sphinx.locale import _
 from sphinx.builders.html import INVENTORY_FILENAME
 
 handlers = [urllib2.ProxyHandler(), urllib2.HTTPRedirectHandler(),
                 continue
             proj, version, uri, dispname = inventory[objtype][target]
             newnode = nodes.reference('', '', internal=False, refuri=uri,
-                                      reftitle='(in %s v%s)' % (proj, version))
+                                      reftitle=_('(in %s v%s)') % (proj, version))
             if node.get('refexplicit'):
                 # use whatever title was given
                 newnode.append(contnode)
-            elif dispname == '-':
+            elif dispname == '-' or \
+                    (domain == 'std' and node['reftype'] == 'keyword'):
                 # use whatever title was given, but strip prefix
                 title = contnode.astext()
                 if in_set and title.startswith(in_set+':'):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.